/* ============================================================
   BLOOD BANK MANAGEMENT SOFTWARE — Darker Mediseba Design System
   Dusky lavender-gray workspace, dark navy sidebar, purple primary.
   Visual-only theme. No external fonts/imports (offline-safe).
   ============================================================ */

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

:root {
  --bg: #c9c0e8;              /* darker dusky lavender-gray page background */
  --card: #ffffff;
  --ink: #1e1b3a;             /* near-black navy */
  --ink-2: #4a4668;
  --muted: #6b6885;
  --line: #ece8f5;
  --primary: #7c3aed;         /* deep vivid purple */
  --primary-deep: #6d28d9;
  --primary-ink: #5b21b6;
  --primary-soft: #efecfe;
  --green: #34c98e;  --green-soft: #e2f7ec;
  --blue: #4aa8ff;   --blue-soft: #e3f1ff;
  --orange: #ff9f5a; --orange-soft: #ffeddd;
  --red: #f26d6d;    --red-soft: #ffe9e9;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(30, 27, 58, 0.18);
  --shadow-lg: 0 16px 44px rgba(30, 27, 58, 0.26);
  /* Dark navy sidebar palette */
  --side-bg: linear-gradient(180deg, #1e1b3a 0%, #25204d 100%);
  --side-text: #d3cff0;
  --side-icon: #9c95cf;
  --side-label: #a49ed4;
  --side-hover-bg: rgba(255, 255, 255, 0.08);
  --side-line: rgba(255, 255, 255, 0.14);
  --side-active: #7c6cf0;
  /* Topbar darkened text */
  --top-faint: #4e4a6b;
  --top-sub: #5a5678;
  --search-fill: #f1edf9;
}

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

body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  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; cursor: pointer; }
svg { flex: 0 0 auto; }
::selection { background: var(--primary-soft); color: var(--primary-ink); }

/* screen-reader-only utility */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.bb-layout {
  display: flex;
  gap: 16px;
  padding: 16px;
  min-height: 100vh;
  align-items: flex-start;
}

/* ---------- Sidebar: floating dark navy rounded panel ---------- */
.bb-sidebar {
  width: 256px;
  flex: 0 0 256px;
  background: var(--side-bg);
  border-radius: 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.bb-sidebar::-webkit-scrollbar { width: 6px; }
.bb-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); border-radius: 3px; }

.bb-brand {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bb-brand .brand-drop {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.45);
}
.bb-brand .brand-name {
  font-size: 17px; font-weight: 800;
  color: #ffffff; letter-spacing: -0.01em; line-height: 1.25;
}

/* ---------- Nav ---------- */
.bb-nav {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--side-label);
  padding: 14px 12px 6px;
}

.bb-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--side-text);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}
.bb-nav a svg { color: var(--side-icon); transition: color 0.15s ease; }
.bb-nav a:hover { background: var(--side-hover-bg); color: #ffffff; }
.bb-nav a:hover svg { color: #ffffff; }
.bb-nav a.active { background: var(--side-active); color: #ffffff; font-weight: 700; }
.bb-nav a.active svg { color: #ffffff; }

.bb-side-foot { padding: 16px 20px; border-top: 1px solid var(--side-line); }
.foot-note { font-size: 11px; color: var(--side-label); }

/* ============================================================
   MAIN + TOPBAR
   ============================================================ */
.bb-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  gap: 18px; padding-bottom: 28px;
}

.bb-topbar {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 16px;
  z-index: 30;
}

.page-h {
  font-size: 20px; font-weight: 800;
  color: var(--ink); letter-spacing: -0.01em; margin: 0;
}

.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 13px; color: var(--top-faint); font-weight: 500; }

.demo-badge {
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
  color: #b26a00; background: var(--orange-soft);
  border: 1px solid #ffd9b8;
  padding: 5px 10px; border-radius: 999px;
}

/* Search bar */
.topbar-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--search-fill);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 8px 8px 16px;
  min-width: 300px;
}
.topbar-search input, .topbar-search .search-inp {
  border: none; background: transparent; outline: none;
  font: inherit; color: var(--ink);
  flex: 1; min-width: 0;
}
.topbar-search input::placeholder, .topbar-search .search-inp::placeholder { color: var(--top-sub); }

kbd {
  font-family: inherit; font-size: 11px; font-weight: 700;
  color: var(--top-faint); background: #fff;
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 7px;
}

.topbar-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
.topbar-icon:hover { background: var(--primary-soft); color: var(--primary-deep); }
.topbar-icon .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid #fff;
}
.dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--red);
}

/* User chip */
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--ink);
}
.user-chip .avatar, .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #e7e1fb; color: var(--primary-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.3; }
.user-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.user-role { font-size: 11px; color: var(--top-sub); }

#view { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ============================================================
   KPI CARDS (Mediseba style)
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.kpi {
  background: #ffffff;
  border: 1px solid #dcd6f0;
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(76, 61, 200, 0.12);
  padding: 20px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 18px 46px rgba(76, 61, 200, 0.18); border-color: #c9c0ec; }

.kpi-top { display: flex; align-items: center; gap: 12px; }

.kpi-ic {
  width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 56px;
  background: #6d28d9; /* fallback jewel tone when no inline bg is set */
  color: #fff;
  box-shadow: 0 6px 14px rgba(76, 61, 200, 0.28);
}
.kpi-ic svg { width: 24px; height: 24px; }

.kpi-label { font-size: 14px; font-weight: 700; color: #1e1b3a; line-height: 1.3; }
.kpi-sub { font-size: 12px; color: #475569; font-weight: 500; }

.kpi-arrow {
  margin-left: auto;
  color: #475569;
  font-size: 18px;
  font-weight: 700;
  align-self: flex-start;
  line-height: 1;
}

.kpi-value {
  font-size: 32px; font-weight: 800;
  color: #111111; letter-spacing: -0.02em;
  margin-top: 14px; line-height: 1.1;
}

.kpi-detail { font-size: 12px; color: #475569; margin-top: 6px; }

/* ============================================================
   CARDS / SECTIONS
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}

.card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.card-h h2, .card-h h3 {
  font-size: 16px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.01em; margin: 0;
}
.card-b, .card-body { padding-top: 4px; }

.sub { font-size: 13px; color: var(--muted); }
/* LANE 4 — reports/settings recolor: subtitles dark gray (readable) on report + settings cards */
#rpt-stock .card-h .sub, #rpt-donations .card-h .sub, #rpt-issues .card-h .sub,
#rpt-donors .card-h .sub, #rpt-expiry .card-h .sub, #rpt-screening .card-h .sub,
#card-profile .card-h .sub, #card-bag .card-h .sub, #card-expiry .card-h .sub,
#card-lowstock .card-h .sub, #card-data .card-h .sub { color: #475569; }
#rpt-stock .card-h h3, #rpt-donations .card-h h3, #rpt-issues .card-h h3,
#rpt-donors .card-h h3, #rpt-expiry .card-h h3, #rpt-screening .card-h h3,
#card-profile .card-h h3, #card-bag .card-h h3, #card-expiry .card-h h3,
#card-lowstock .card-h h3, #card-data .card-h h3 { color: #1e1b3a; }
.muted { color: var(--muted); }
.notes { font-size: 13px; color: var(--ink-2); background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 14px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gap-8 { gap: 8px !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }

.toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.actions { display: flex; align-items: center; gap: 8px; }

.filter-row {
  display: flex; align-items: flex-end; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.filter-row label { font-size: 12px; font-weight: 600; color: #4a4668; display: block; margin-bottom: 5px; }

.quick-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13.5px; font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #c7c2d9;
  background: #fff; color: #1e1b3a;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}
.btn:hover { background: #f3f0fd; color: #6d28d9; border-color: #b8aef0; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: #6d28d9; color: #fff; border-color: #6d28d9;
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.38);
}
.btn-primary:hover { background: #5b21b6; border-color: #5b21b6; color: #fff; }

.btn-ghost {
  background: transparent; border-color: #c7c2d9; color: #1e1b3a;
}
.btn-ghost:hover { background: #f3f0fd; color: #1e1b3a; border-color: #b8aef0; }

.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-sm { padding: 7px 13px; font-size: 12.5px; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
  white-space: nowrap; line-height: 1.6;
}
.b-red   { background: #b91c1c; color: #fff; }
.b-green { background: #15803d; color: #fff; }
.b-amber { background: #b45309; color: #fff; }
.b-blue  { background: #1d4ed8; color: #fff; }
.b-gray  { background: #4a4668; color: #fff; }

.badge-ok   { background: #15803d; color: #fff; }
.badge-warn { background: #b45309; color: #fff; }
.badge-bad  { background: #b91c1c; color: #fff; }
.badge-red-outline {
  background: #fff; color: #b91c1c; border: 1.5px solid #b91c1c;
}

.text-red { color: #b91c1c; }
.text-green { color: #15803d; }
.text-amber { color: #b45309; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
}
.a-green { background: var(--green-soft); color: #14532d; border: 1px solid #9edcc0; }
.a-amber { background: var(--orange-soft); color: #92400e; border: 1px solid #f5c98a; }
.a-red   { background: var(--red-soft); color: #991b1b; border: 1px solid #f5a8a8; }
.alert strong { font-weight: 800; }

.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid #d9d4e8;
  font-size: 13px;
  color: var(--ink-2);
}
.alert-row .dot { flex: 0 0 auto; }
.alert-amber .dot { background: #b45309; }

/* ============================================================
   TABLES
   ============================================================ */
.tbl-wrap {
  overflow-x: auto;
  border: 1px solid #d9d4e8;
  border-radius: var(--radius-sm);
  background: #fff;
}

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.tbl thead th {
  text-align: left;
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #ffffff;
  background: #4c1d95;
  padding: 11px 14px;
  white-space: nowrap;
  border-bottom: 1px solid #3b1479;
}

.tbl tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #d9d4e8;
  color: var(--ink-2);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #efeaf8; }

.tbl td.num, .tbl th.num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.trow { cursor: pointer; }

/* ============================================================
   FORMS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 700; color: #1e1b3a; }
.field-span { grid-column: 1 / -1; }
.req { color: #b91c1c; font-weight: 800; }

.inp, .input, select.inp, select.input,
textarea.inp, input.inp, input.input {
  font: inherit; font-size: 13.5px; color: var(--ink);
  background: #fff;
  border: 1.5px solid #a89fc9;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none; width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea.inp { resize: vertical; min-height: 90px; }

.inp:focus, .input:focus, select.inp:focus, select.input:focus, textarea.inp:focus {
  border-color: #6d28d9;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.18);
}

.inp::placeholder, .input::placeholder { color: var(--muted); }

.inp-sm {
  font: inherit; font-size: 12.5px; color: var(--ink);
  background: #fff; border: 1.5px solid #a89fc9;
  border-radius: 10px; padding: 7px 12px; outline: none;
}
.inp-sm:focus { border-color: #6d28d9; box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.18); }

.search-inp {
  font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--bg);
  border: 1.5px solid #a89fc9;
  border-radius: 999px;
  padding: 9px 18px; outline: none; width: 100%;
}
.search-inp:focus { border-color: #6d28d9; box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.18); }
.search-inp::placeholder { color: var(--muted); }

select.inp, select.input {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a87a3' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.form-err {
  background: var(--red-soft); color: #991b1b;
  border: 1px solid #f5a8a8; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; font-weight: 600;
}

/* checkbox / radio rows */
.chk-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chk, .check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  background: var(--bg); border: 1px solid #a89fc9;
  border-radius: 10px; padding: 8px 12px; cursor: pointer;
}
.chk input, .check input { accent-color: var(--primary); width: 16px; height: 16px; }
.check-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.checks { display: flex; flex-direction: column; gap: 8px; }

/* donor search suggestions dropdown */
.ds-suggest {
  position: relative;
}
.ds-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; background: #fff;
  border: 1px solid var(--line); border-top: none;
  padding: 10px 14px; font: inherit; font-size: 13px;
  transition: background 0.12s ease;
}
.ds-item:first-of-type { border-top: 1px solid var(--line); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ds-item:last-of-type { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.ds-item:hover { background: var(--primary-soft); }
.ds-name { font-weight: 700; color: var(--ink); }
.ds-meta { font-size: 12px; color: #4a4668; }
.ds-none { padding: 10px 14px; font-size: 13px; color: #4a4668; }

/* ============================================================
   PROGRESS BARS (blood-group stock chart)
   ============================================================ */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-key { width: 44px; font-weight: 800; font-size: 13px; color: var(--ink); }
.bar-track {
  flex: 1; height: 10px; border-radius: 999px;
  background: var(--bg); overflow: hidden;
}
.bar-fill {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #4f46e5);
  transition: width 0.4s ease;
}
.bar-fill.bf-gray   { background: #9f9ac4; }
.bar-fill.bf-amber  { background: linear-gradient(90deg, #d97706, #ea580c); }
.bar-fill.bf-green  { background: linear-gradient(90deg, #16a34a, #059669); }
.bar-lb { min-width: 32px; text-align: right; font-weight: 700; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ============================================================
   ACTIVITY LIST
   ============================================================ */
.activity-list { display: flex; flex-direction: column; }
.act-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.act-row:last-child { border-bottom: none; }
.act-t { color: var(--ink-2); flex: 1; }
.act-x { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty, .empty-state {
  text-align: center; padding: 44px 20px;
  color: var(--muted);
}
.empty svg, .empty-state svg { color: #c9c6dd; margin-bottom: 10px; }
.empty-t { font-size: 15px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.empty .btn, .empty-state .btn { margin-top: 12px; }

/* ============================================================
   PROFILE / DONOR DETAIL
   ============================================================ */
.profile-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.reason-list { margin: 8px 0 0 18px; font-size: 13px; color: var(--ink-2); }
.reason-list li { margin-bottom: 4px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay, .modal-ov, .bbms-modal-ov {
  position: fixed; inset: 0;
  background: rgba(30, 27, 58, 0.45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal-box {
  background: var(--card);
  border: 1px solid #cfc5ec;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(46, 16, 101, 0.35);
  width: 100%; max-width: 560px;
  max-height: 88vh; overflow: hidden;
  display: flex; flex-direction: column;
  animation: popIn 0.18s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 17px; font-weight: 800; color: #141126; }
.modal-x {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: #e9e4f6; color: #4a4668;
  font-size: 20px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-x:hover { background: #b91c1c; color: #fff; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ============================================================
   TOASTS
   ============================================================ */
#toasts {
  position: fixed; bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 1200;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 13px 18px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  animation: slideUp 0.2s ease;
}
.toast-ok, .toast-success { background: #1f9d68; }
.toast-err, .toast-error { background: #c94a4a; }
.toast-warn { background: #c46a1e; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ============================================================
   REPORT PREVIEWS
   ============================================================ */
.rpt-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 22px 26px;
  margin-top: 4px;
}
.rpt-head { text-align: center; margin-bottom: 18px; }
.rpt-bank { font-size: 19px; font-weight: 800; color: var(--ink); }
.rpt-sub { font-size: 13px; color: #475569; margin-top: 2px; }
.rpt-title { font-size: 15px; font-weight: 700; color: var(--primary-ink); margin-top: 10px; }
.rpt-gen { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rpt .tbl, .rpt-preview .tbl { font-size: 13px; }

/* ============================================================
   ISSUE RECEIPT
   ============================================================ */
.rcpt {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 26px 30px;
  max-width: 640px;
  margin: 0 auto;
  font-size: 13.5px;
}
.rcpt-head { text-align: center; margin-bottom: 14px; }
.rcpt-bank-name { font-size: 18px; font-weight: 800; color: var(--ink); }
.rcpt-bank-sub { font-size: 12.5px; color: var(--muted); }
.rcpt-title { font-size: 14px; font-weight: 800; color: var(--primary-ink); text-align: center; margin: 14px 0 8px; letter-spacing: 0.04em; text-transform: uppercase; }
.rcpt-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-2); }
.rcpt-items { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.rcpt-items th, .rcpt-items td { padding: 8px 6px; border-bottom: 1px dashed var(--line); text-align: left; }
.rcpt-items th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.rcpt-rule { border: none; border-top: 1.5px solid var(--line); margin: 14px 0; }
.rcpt-totals { text-align: right; font-size: 14px; }
.rcpt-foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
.rcpt-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 44px; }

.sig { flex: 1; }
.sig .line {
  border-top: 1.5px solid var(--ink-2);
  padding-top: 6px;
  font-size: 12px; color: var(--muted);
  text-align: center;
}
.grand { font-size: 16px; font-weight: 800; color: var(--ink); }

/* issues module bits */
.iss-reprint { display: inline-flex; gap: 8px; align-items: center; }
.iss-bag-cb { accent-color: var(--primary); width: 16px; height: 16px; }

/* ============================================================
   MISC LEFTOVERS (JS-generated)
   ============================================================ */
.cls { display: none !important; }
.tone { font-size: 12px; color: #6b6885; }

/* receipt key-label cells (issues.js) */
td.k, .k { font-weight: 700; color: var(--ink); font-size: 12.5px; white-space: nowrap; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .bb-layout { flex-direction: column; padding: 12px; gap: 12px; }
  .bb-sidebar {
    width: 100%; flex: none;
    height: auto; position: static;
  }
  .bb-nav { flex-direction: row; flex-wrap: wrap; padding: 10px 12px; }
  .bb-nav a { padding: 9px 12px; }
  .nav-section { width: 100%; padding: 8px 12px 4px; }
  .bb-topbar { position: static; flex-wrap: wrap; }
  .topbar-search { min-width: 0; flex: 1; }
  .kpi-value { font-size: 28px; }
  .rcpt { padding: 18px; }
}
