/* ============================================================
   BLOOD BANK MANAGEMENT SOFTWARE — Design System
   Light professional theme. No external fonts/imports.
   ============================================================ */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --text-soft: #475569;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #eef1f6;
  --border: #dbe1ec;
  --red: #dc2626;
  --red-dark: #b91c1c;
  --red-tint: #fef2f2;
  --red-border: #fecaca;
  --green: #16a34a;
  --green-tint: #f0fdf4;
  --green-border: #bbf7d0;
  --amber: #d97706;
  --amber-tint: #fffbeb;
  --amber-border: #fde68a;
  --blue: #2563eb;
  --blue-tint: #eff6ff;
  --blue-border: #bfdbfe;
  --gray: #64748b;
  --gray-tint: #f1f5f9;
  --gray-border: #e2e8f0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  --navy: #0f172a;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ============================================================
   LAYOUT
   ============================================================ */
.bb-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar — 260px white, full height, sticky */
.bb-sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: var(--card);
  border-right: 1px solid var(--line);
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

/* Brand block: logo + name */
.bb-brand {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.bb-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  flex: 0 0 42px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}
.bb-brand .brand-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.25;
}
.bb-brand .brand-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Nav links */
.bb-nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.bb-nav a {
  display: block;
  padding: 10px 16px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.bb-nav a:hover {
  background: var(--gray-tint);
  color: var(--navy);
}
.bb-nav a.active {
  background: var(--red-tint);
  color: var(--red);
}
.bb-nav a .nav-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 10px;
  background: currentColor;
  opacity: 0.55;
  vertical-align: 1px;
}
.bb-nav .nav-sep {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  padding: 14px 16px 6px;
}

/* Main column */
.bb-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar — white bar, sticky */
.bb-topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
}
.bb-topbar .tb-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}
.bb-topbar .tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bb-body {
  padding: 22px 24px 40px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================================
   TYPOGRAPHY / HELPERS
   ============================================================ */
.page-h {
  margin-bottom: 18px;
}
.page-h h2 {
  font-size: 21px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.page-h .sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, 0.7);
}
.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-h h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
}
.card-h .sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mt { margin-top: 16px; }
.mt-sm { margin-top: 10px; }
.mb { margin-bottom: 16px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
  font-size: 13.5px;
}
.empty .empty-t {
  font-weight: 700;
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 4px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }

.hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--gray-border);
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}
.kpi .k-wash {
  position: absolute;
  top: -30px;
  right: -30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  opacity: 0.14;
  pointer-events: none;
}
.k-ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}
.k-lb {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.k-nm {
  font-size: 30px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
  margin: 2px 0;
  letter-spacing: -0.02em;
}
.k-sb {
  font-size: 12.5px;
  color: var(--muted);
}

/* KPI tint variants (chip + wash) */
.k-red   .k-ic { background: var(--red-tint); color: var(--red); }
.k-red   .k-wash { background: var(--red); }
.k-green .k-ic { background: var(--green-tint); color: var(--green); }
.k-green .k-wash { background: var(--green); }
.k-amber .k-ic { background: var(--amber-tint); color: var(--amber); }
.k-amber .k-wash { background: var(--amber); }
.k-blue  .k-ic { background: var(--blue-tint); color: var(--blue); }
.k-blue  .k-wash { background: var(--blue); }
.k-gray  .k-ic { background: var(--gray-tint); color: var(--gray); }
.k-gray  .k-wash { background: var(--gray); }

/* ============================================================
   TABLES
   ============================================================ */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: 14px;
}
.tbl th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}
.tbl tbody tr:first-child td { border-top: 0; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--gray-border);
  background: #f8fafc;
}
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .row-link { cursor: pointer; }

/* Table inside a .card: pull it flush to card edges */
.card .tbl-wrap { margin: 0 -18px -18px; }
.card .tbl-wrap .tbl { border-radius: 0 0 var(--radius) var(--radius); }
.card .tbl th:first-child, .card .tbl td:first-child { padding-left: 18px; }
.card .tbl th:last-child, .card .tbl td:last-child { padding-right: 18px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }

.field { margin-bottom: 2px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.field .hint {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 4px;
}

.inp {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.inp::placeholder { color: var(--muted-2); }
.inp:focus {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.inp:disabled {
  background: var(--gray-tint);
  color: var(--muted);
  cursor: not-allowed;
}
textarea.inp { resize: vertical; min-height: 76px; }
select.inp {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.inp-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

/* Search input with icon space */
.search-inp { padding-left: 34px; }

/* Checkbox / radio rows */
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-soft);
  cursor: pointer;
}
.check-row input { width: 16px; height: 16px; accent-color: var(--red); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--gray-tint); border-color: #cbd5e1; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }

.btn-danger {
  background: var(--red-dark);
  border-color: var(--red-dark);
  color: #fff;
}
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }

.btn-ghost {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-soft);
  box-shadow: none;
}

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn-success:hover { background: #15803d; border-color: #15803d; }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
}
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 14px;
}
.icon-btn:hover { background: var(--gray-tint); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1.5;
  white-space: nowrap;
}
.b-green { background: var(--green-tint); color: var(--green); border: 1px solid var(--green-border); }
.b-red   { background: var(--red-tint); color: var(--red); border: 1px solid var(--red-border); }
.b-amber { background: var(--amber-tint); color: var(--amber); border: 1px solid var(--amber-border); }
.b-blue  { background: var(--blue-tint); color: var(--blue); border: 1px solid var(--blue-border); }
.b-gray  { background: var(--gray-tint); color: var(--gray); border: 1px solid var(--gray-border); }

/* Blood group pill */
.bg-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--red-tint);
  color: var(--red-dark);
  font-weight: 800;
  font-size: 13px;
  border: 1px solid var(--red-border);
  letter-spacing: 0.02em;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 14px;
  border: 1px solid transparent;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.a-red   { background: var(--red-tint); color: #991b1b; border-color: var(--red-border); }
.a-amber { background: var(--amber-tint); color: #92400e; border-color: var(--amber-border); }
.a-green { background: var(--green-tint); color: #166534; border-color: var(--green-border); }
.a-blue  { background: var(--blue-tint); color: #1e40af; border-color: var(--blue-border); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 16px;
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s ease;
}
.modal-lg { max-width: 760px; }
.modal-sm { max-width: 380px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-h h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}
.modal-x {
  border: 0;
  background: transparent;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.modal-x:hover { color: var(--text); }
.modal-b {
  padding: 20px;
}
.modal-f {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 0 0 16px 16px;
}

/* ============================================================
   TOASTS
   ============================================================ */
#toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}
.toast {
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  animation: toast-in 0.22s ease;
}
.toast.t-ok   { background: #14532d; }
.toast.t-err  { background: #7f1d1d; }
.toast.t-warn { background: #78350f; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   CHARTS (CSS bars)
   ============================================================ */
.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bar-row .bar-key {
  width: 46px;
  flex: 0 0 46px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
}
.bar-row .bar-track {
  flex: 1;
  height: 10px;
  background: var(--gray-tint);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f87171, var(--red-dark));
  min-width: 4px;
  transition: width 0.4s ease;
}
.bar-lb {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Bar color variants */
.bar-fill.bf-green { background: linear-gradient(90deg, #4ade80, #15803d); }
.bar-fill.bf-amber { background: linear-gradient(90deg, #fbbf24, #b45309); }
.bar-fill.bf-blue  { background: linear-gradient(90deg, #60a5fa, #1d4ed8); }
.bar-fill.bf-gray  { background: linear-gradient(90deg, #cbd5e1, #64748b); }

/* ============================================================
   LOGIN / SPLASH
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, #ffe4e4 0%, transparent 60%),
              radial-gradient(1000px 500px at 110% 10%, #dbeafe 0%, transparent 55%),
              var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  border: 1px solid rgba(226, 232, 240, 0.8);
}
.login-card .bb-brand {
  border: 0;
  padding: 0;
  margin-bottom: 24px;
  justify-content: center;
  text-align: left;
}

/* ============================================================
   DETAIL / MISC COMPONENTS
   ============================================================ */
/* Key-value detail rows */
.kv { display: flex; flex-direction: column; gap: 0; }
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-k { color: var(--muted); font-weight: 600; }
.kv-v { color: var(--text); font-weight: 700; text-align: right; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tabs button {
  border: 0;
  background: transparent;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--red); border-bottom-color: var(--red); }

/* Pagination */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.pager .pg-btns { display: flex; gap: 6px; }

/* Donor / item list rows */
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.item-row:last-child { border-bottom: 0; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--red-tint);
  color: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex: 0 0 38px;
}

/* Progress steps (screening pipeline) */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
}
.step {
  flex: 1;
  text-align: center;
  position: relative;
  padding-top: 26px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
}
.step::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
}
.step::after {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(-50% + 10px);
  right: calc(50% + 10px);
  height: 2px;
  background: #e2e8f0;
}
.step:first-child::after { display: none; }
.step.done { color: var(--green); }
.step.done::before { background: var(--green); border-color: var(--green); }
.step.done::after { background: var(--green); }
.step.now { color: var(--red); }
.step.now::before { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px rgba(220,38,38,0.15); }

/* Print-friendly receipt block */
.receipt {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
  font-size: 13px;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.no-print { /* hidden in print via print.css */ }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.grow { flex: 1; }
.w-full { width: 100%; }

/* ============================================================
   RESPONSIVE — under 920px
   ============================================================ */
@media (max-width: 920px) {
  /* Sidebar becomes a top bar */
  .bb-layout { flex-direction: column; }
  .bb-sidebar {
    width: 100%;
    flex: none;
    height: auto;
    min-height: 0;
    position: sticky;
    top: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .bb-brand { padding: 12px 16px; border-bottom: 0; }
  .bb-brand .brand-mark { width: 34px; height: 34px; font-size: 17px; flex-basis: 34px; border-radius: 10px; }
  .bb-nav {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 12px 10px;
    gap: 6px;
  }
  .bb-nav a {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .bb-nav a .nav-dot { display: none; }
  .bb-nav .nav-sep { display: none; }

  .bb-topbar { padding: 10px 16px; }
  .bb-body { padding: 16px 14px 32px; }

  /* Grids collapse to 1 column */
  .grid-2, .form-grid { grid-template-columns: 1fr; }

  /* KPI grid: 2 per row on small screens */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .k-nm { font-size: 24px; }

  /* Tables scroll horizontally */
  .tbl-wrap { overflow-x: auto; }
  table.tbl { min-width: 640px; }

  .modal-back { padding: 24px 12px 12px; }
  .page-h h2 { font-size: 18px; }
}

@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .toolbar .btn { flex: 1; justify-content: center; }
  #toasts { left: 16px; right: 16px; align-items: stretch; }
  .toast { max-width: none; justify-content: center; }
}

/* utility text colors + kpi sub-elements (used by stock module) */
.text-green{color:#059669}.text-red{color:#dc2626}.text-amber{color:#d97706}.text-blue{color:#2563eb}.text-gray{color:#64748b}
.kpi-value{font-size:30px;font-weight:800;color:#0f172a;line-height:1.15}
.kpi-sub{font-size:12.5px;color:#64748b;margin-top:2px}

/* ---------- module structural classes (used by page modules) ---------- */
.badge-ok{background:#e6f7f0;color:#059669}.badge-warn{background:#fef4e2;color:#d97706}.badge-bad{background:#fdecec;color:#dc2626}
.badge-red-outline{background:#fff;color:#dc2626;border:1px solid #f3b4b4}
.alert-amber{background:#fff8e8;border:1px solid #f5dfa8;color:#8a5a00}
.card-b{padding:0}
.kpi-label{font-size:15px;font-weight:800;color:#0f172a}
.empty-state{text-align:center;color:#64748b;padding:28px 12px}
/* dashboard */
.alert-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.alerts-list{display:flex;flex-direction:column;gap:8px}
.activity-list{display:flex;flex-direction:column}
.act-row{display:flex;gap:10px;padding:8px 0;border-top:1px solid #eef1f6;align-items:baseline}
.act-row:first-child{border-top:0}
.act-t{font-size:11px;color:#94a3b8;white-space:nowrap}
.act-x{font-size:13.5px;color:#334155}
.quick-row{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}
/* donors */
.profile-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px 18px}
.profile-head{display:flex;gap:14px;align-items:center;margin-bottom:14px}
.reason-list{margin:8px 0 0 18px;padding:0;color:#8a5a00;font-size:13px}
.form-err{display:none;background:#fdecec;color:#b91c1c;border:1px solid #f3b4b4;border-radius:10px;padding:10px 12px;margin-bottom:12px;font-size:13px}
.checks{display:flex;flex-direction:column;gap:6px}
.check{display:flex;gap:8px;align-items:center;font-size:13.5px}
td.actions{white-space:nowrap}
/* donations */
.chk-row{display:flex;gap:14px;flex-wrap:wrap}
.chk{display:flex;gap:6px;align-items:center;font-size:13.5px}
.field-span{grid-column:1/-1}
.form-actions{margin-top:14px;display:flex;gap:10px}
.req{color:#dc2626}
.ds-suggest{position:relative}
.ds-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;background:#fff;border:1px solid #eef1f6;border-top:0;padding:8px 10px;cursor:pointer}
.ds-item:hover{background:#f8fafc}
.ds-name{font-weight:700;font-size:13.5px}
.ds-meta{font-size:12px;color:#64748b}
.ds-none{padding:8px 10px;color:#94a3b8;font-size:13px}
/* stock */
.filter-row{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end}
/* issues */
.iss-bag-cb{margin-right:8px}
.iss-reprint{white-space:nowrap}
/* reports */
.rpt-preview{overflow-x:auto}
.rpt-bank{font-size:18px;font-weight:800}
.rpt-sub{font-size:12px;color:#64748b}
.rpt-gen{font-size:12px;color:#64748b;margin-bottom:10px}
/* shell extras */
.bb-side-foot{padding:14px 16px;border-top:1px solid #eef1f6;font-size:11.5px;color:#94a3b8}
.brand-drop{font-size:11px;color:#94a3b8}
.demo-badge{font-size:11px;font-weight:700;background:#fef4e2;color:#b45309;border-radius:20px;padding:3px 10px}
.foot-note{font-size:11px;color:#94a3b8}
.topbar-date{font-size:12.5px;color:#64748b}
.topbar-right{display:flex;gap:10px;align-items:center}
.card-body{padding:0}
.notes{font-size:13.5px;color:#334155;background:#f8fafc;border-radius:10px;padding:10px 12px}
