/* ════════════════════════════════════════════════════════════════
   CloudLedgerAI — Invoices · Delivery Challans · Credit Notes
   Prefix: bd-  (master list + document preview workspace)
   ════════════════════════════════════════════════════════════════ */

/* Sidebar group now holds five sub-items */
.nav-group.sales-group.open .nav-sub,
.nav-group.purchases-group.open .nav-sub { max-height: 260px; }

/* ── Split workspace ───────────────────────────────────────────── */
.bd-split {
  display: grid; grid-template-columns: 340px 1fr; gap: 16px;
  align-items: start; min-height: 560px;
}
.bd-list-pane, .bd-detail {
  background: #fff; border: 1px solid var(--border-color); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); overflow: hidden;
}
.bd-list-pane { display: flex; flex-direction: column; position: sticky; top: 0; max-height: calc(100vh - 210px); }
.bd-list-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border-color); background: #fafbff; }
.bd-list-head select {
  flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 9px;
  font: 600 13px var(--font-sans); background: #fff; color: var(--text-primary); cursor: pointer;
}
.bd-search { padding: 10px 12px; border-bottom: 1px solid var(--border-color); }
.bd-search input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 9px;
  font: 13px var(--font-sans); background: #f8fafc;
}
.bd-search input:focus { outline: none; border-color: var(--im-indigo); box-shadow: var(--im-ring); background: #fff; }
.bd-list { overflow-y: auto; flex: 1; }
.bd-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9; cursor: pointer; border-left: 3px solid transparent;
  transition: background 0.12s ease;
}
.bd-row:hover { background: #f8faff; }
.bd-row.selected { background: var(--im-indigo-soft); border-left-color: var(--im-indigo); }
.bd-row-name { font-weight: 600; font-size: 13.5px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-row-amt { font-family: var(--font-mono); font-weight: 600; font-size: 13px; text-align: right; }
.bd-row-meta { font-size: 11.5px; color: #64748b; }
.bd-row-meta b { color: var(--im-indigo); font-family: var(--font-mono); font-weight: 600; }
.bd-row-status { font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; text-align: right; }
.bd-row-empty { padding: 40px 18px; text-align: center; color: #94a3b8; font-size: 13px; }

/* status colours (text + pill) */
.bd-st-draft { color: #64748b; } .bd-st-sent, .bd-st-open, .bd-st-dispatched { color: var(--im-indigo); }
.bd-st-partially_paid { color: #b45309; } .bd-st-overdue { color: var(--im-rose); }
.bd-st-paid, .bd-st-delivered, .bd-st-closed { color: var(--im-green); }
.bd-st-invoiced { color: var(--im-violet); } .bd-st-void, .bd-st-cancelled { color: #94a3b8; }

/* ── Detail pane ───────────────────────────────────────────────── */
.bd-detail-empty { padding: 90px 20px; text-align: center; color: #94a3b8; }
.bd-detail-empty .big { font-size: 42px; margin-bottom: 8px; }
.bd-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px;
  border-bottom: 1px solid var(--border-color); background: #fafbff;
}
.bd-toolbar .bd-doc-title { font-weight: 700; font-size: 16px; margin-right: auto; display: flex; align-items: center; gap: 10px; }
.bd-btn {
  border: 1px solid var(--border-color); background: #fff; color: var(--text-primary);
  padding: 7px 13px; border-radius: 9px; font: 600 12.5px var(--font-sans); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s ease;
}
.bd-btn:hover { border-color: #c7d2fe; background: var(--im-indigo-soft); color: var(--im-indigo); }
.bd-btn.primary { background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff; border-color: transparent; box-shadow: 0 4px 10px -3px rgba(79, 70, 229, 0.5); }
.bd-btn.primary:hover { filter: brightness(1.08); color: #fff; transform: translateY(-1px); }
.bd-btn.danger:hover { background: var(--im-rose-soft); border-color: #fecdd3; color: var(--im-rose); }

.bd-next {
  margin: 16px 16px 0; padding: 12px 16px; border-radius: 12px; display: flex; gap: 12px; align-items: center;
  background: linear-gradient(90deg, #eef2ff, #f5f3ff); border: 1px solid #e0e7ff; font-size: 13px; color: #3730a3;
}
.bd-next .ico { font-size: 18px; }
.bd-next.warn { background: linear-gradient(90deg, #fffbeb, #fff7ed); border-color: #fde68a; color: #92400e; }
.bd-next.ok { background: linear-gradient(90deg, #ecfdf5, #f0fdfa); border-color: #a7f3d0; color: #065f46; }

.bd-detail-body { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; padding: 16px; align-items: start; }
.bd-side { display: flex; flex-direction: column; gap: 12px; }
.bd-card { border: 1px solid var(--border-color); border-radius: 12px; padding: 14px 16px; background: #fff; }
.bd-card h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: #64748b; margin-bottom: 10px; }
.bd-kv { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; color: var(--text-secondary); gap: 10px; }
.bd-kv span:last-child { font-weight: 600; color: var(--text-primary); text-align: right; font-family: var(--font-mono); }
.bd-big { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; font-family: var(--font-mono); }
.bd-big.due { color: var(--im-rose); } .bd-big.good { color: var(--im-green); } .bd-big.info { color: var(--im-indigo); }
.bd-hist { font-size: 12px; padding: 7px 0; border-top: 1px dashed #e2e8f0; display: flex; justify-content: space-between; gap: 8px; }
.bd-hist:first-of-type { border-top: none; }
.bd-hist small { color: #94a3b8; display: block; }
.bd-link { color: var(--im-indigo); font-weight: 600; cursor: pointer; }
.bd-link:hover { text-decoration: underline; }

/* ── Paper (document preview / print) ──────────────────────────── */
.bd-paper-wrap { background: #eef1f6; border-radius: 12px; padding: 18px; overflow-x: auto; }
.bd-paper {
  position: relative; background: #fff; max-width: 780px; margin: 0 auto; padding: 38px 42px 30px;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.25); font-size: 12.5px; color: #1e293b; min-height: 560px;
}
.bd-paper::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, #4f46e5, #0d9488); }
.bd-stamp {
  position: absolute; top: 120px; right: 46px; transform: rotate(-12deg); pointer-events: none;
  border: 3px solid currentColor; border-radius: 8px; padding: 2px 14px; font: 800 24px var(--font-sans);
  letter-spacing: 3px; opacity: 0.55; text-transform: uppercase;
}
.bd-paper-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.bd-paper-org h2 { font-size: 17px; font-weight: 800; margin-bottom: 3px; }
.bd-paper-org p { color: #64748b; line-height: 1.5; font-size: 12px; }
.bd-paper-title { text-align: right; }
.bd-paper-title h1 { font-size: 26px; font-weight: 300; letter-spacing: 2px; text-transform: uppercase; color: #4f46e5; }
.bd-paper-title .num { font-family: var(--font-mono); font-weight: 700; font-size: 13px; margin-top: 4px; }
.bd-paper-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.bd-paper-box h5 { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; color: #94a3b8; margin-bottom: 5px; }
.bd-paper-box .nm { font-weight: 700; font-size: 13.5px; color: #4f46e5; }
.bd-paper-box p { color: #475569; line-height: 1.5; white-space: pre-line; }
.bd-meta { width: 100%; border-collapse: collapse; }
.bd-meta td { padding: 3px 0; font-size: 12px; } .bd-meta td:first-child { color: #94a3b8; width: 46%; }
.bd-meta td:last-child { text-align: right; font-weight: 600; }
.bd-items { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
.bd-items th { background: #1e293b; color: #fff; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 8px; text-align: left; }
.bd-items td { padding: 9px 8px; border-bottom: 1px solid #eef0f4; vertical-align: top; }
.bd-items .r { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.bd-items small { display: block; color: #94a3b8; margin-top: 2px; }
.bd-paper-foot { display: grid; grid-template-columns: 1fr 250px; gap: 24px; }
.bd-sum .row { display: flex; justify-content: space-between; padding: 4px 0; }
.bd-sum .row span:last-child { font-family: var(--font-mono); font-weight: 600; }
.bd-sum .grand { border-top: 2px solid #1e293b; margin-top: 6px; padding-top: 8px; font-size: 14px; font-weight: 800; }
.bd-sum .grand span:last-child { color: #4f46e5; }
.bd-sum .due { background: #fef2f2; color: #b91c1c; padding: 6px 8px; border-radius: 6px; margin-top: 8px; font-weight: 700; }
.bd-note h5 { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; color: #94a3b8; margin: 8px 0 3px; }
.bd-note p { white-space: pre-line; color: #475569; }
.bd-sign { margin-top: 38px; display: flex; justify-content: space-between; color: #94a3b8; font-size: 11px; }
.bd-sign div { border-top: 1px solid #cbd5e1; padding-top: 5px; width: 170px; text-align: center; }

/* ── Form drawer extras ────────────────────────────────────────── */
.bd-drawer { width: min(1120px, 98vw); }
.bd-cust-card {
  margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: #f8fafc; border: 1px dashed #cbd5e1;
  font-size: 12px; color: #475569; line-height: 1.55; white-space: pre-line;
}
.bd-cust-row { display: flex; gap: 10px; align-items: center; }
.bd-cust-row select { flex: 1; }
.bd-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.bd-total-input { width: 110px; padding: 6px 9px; text-align: right; font-family: var(--font-mono); }
.bd-total-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; color: var(--text-secondary); }
.bd-total-row input[type=text].lbl { width: 120px; padding: 6px 9px; border-style: dashed; }
.bd-total-row .val { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); min-width: 80px; text-align: right; }
.bd-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ── Small modal ───────────────────────────────────────────────── */
.bd-modal-overlay {
  position: fixed; inset: 0; z-index: 2200; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; animation: bdFade 0.15s ease;
}
.bd-modal { width: min(440px, 94vw); background: #fff; border-radius: 16px; box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.5); overflow: hidden; animation: bdPop 0.2s cubic-bezier(0.22, 1, 0.36, 1); }
.bd-modal h3 { padding: 16px 20px; font-size: 16px; border-bottom: 1px solid var(--border-color); background: linear-gradient(180deg, #fafbff, #fff); }
.bd-modal-body { padding: 16px 20px 6px; }
.bd-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border-color); }
.bd-modal .hint { font-size: 12px; color: #64748b; margin-bottom: 12px; }
@keyframes bdFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bdPop { from { transform: translateY(12px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 1100px) {
  .bd-split { grid-template-columns: 1fr; }
  .bd-list-pane { position: static; max-height: 360px; }
  .bd-detail-body { grid-template-columns: 1fr; }
  .bd-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media print { .bd-paper { box-shadow: none; } }

/* ════════════════════════════════════════════════════════════════
   Zoho Books Style: All Bills Table View & Enhanced Bill Drawer
   ════════════════════════════════════════════════════════════════ */

/* View Header */
.zb-bills-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.zb-head-left { display: flex; align-items: center; gap: 14px; }
.zb-title-dropdown {
  position: relative; display: inline-flex; align-items: center;
  font-size: 22px; font-weight: 700; color: #1e293b; cursor: pointer;
  user-select: none; gap: 8px;
}
.zb-title-dropdown svg { width: 18px; height: 18px; color: #64748b; transition: transform 0.15s ease; }
.zb-title-dropdown:hover { color: #2563eb; }
.zb-dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 100;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  min-width: 220px; padding: 6px 0; display: none;
}
.zb-dropdown-menu.open { display: block; animation: bdPop 0.15s ease; }
.zb-dropdown-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; font-size: 13px; font-weight: 500; color: #334155;
  cursor: pointer; transition: background 0.12s;
}
.zb-dropdown-item:hover { background: #f1f5f9; color: #2563eb; }
.zb-dropdown-item.active { background: #eff6ff; color: #2563eb; font-weight: 700; }
.zb-dropdown-item .badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #e2e8f0; color: #475569; }

/* Right actions & Switchers */
.zb-head-right { display: flex; align-items: center; gap: 8px; }
.zb-seg-group {
  display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 2px; border: 1px solid #e2e8f0;
}
.zb-seg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 30px; border-radius: 6px; border: none; background: transparent;
  color: #64748b; cursor: pointer; transition: all 0.15s ease;
}
.zb-seg-btn:hover { color: #1e293b; }
.zb-seg-btn.active { background: #fff; color: #2563eb; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.zb-btn-new {
  display: inline-flex; align-items: center; gap: 6px;
  background: #2563eb; color: #fff; font-weight: 600; font-size: 13px;
  padding: 7px 14px; border-radius: 8px; border: none; cursor: pointer;
  box-shadow: 0 2px 4px rgba(37,99,235,0.25); transition: all 0.15s ease;
}
.zb-btn-new:hover { background: #1d4ed8; transform: translateY(-1px); }

.zb-icon-action {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #64748b;
  cursor: pointer; transition: all 0.15s;
}
.zb-icon-action:hover { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }
.zb-icon-action.ai-btn { color: #8b5cf6; }
.zb-icon-action.ai-btn:hover { background: #f5f3ff; border-color: #c4b5fd; color: #7c3aed; }

/* Table View Container */
.zb-table-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.zb-bulk-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: #eff6ff; border-bottom: 1px solid #dbeafe;
  font-size: 13px; color: #1e40af; font-weight: 600;
}
.zb-bulk-actions { display: flex; align-items: center; gap: 8px; }

.zb-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.zb-table th {
  background: #f8fafc; color: #64748b; font-weight: 600; font-size: 11px;
  letter-spacing: 0.6px; text-transform: uppercase; padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0; text-align: left; user-select: none;
}
.zb-table th.text-right, .zb-table td.text-right { text-align: right; }
.zb-table th.th-checkbox, .zb-table td.td-checkbox { width: 38px; text-align: center; padding-left: 12px; padding-right: 6px; }
.zb-table tbody tr {
  border-bottom: 1px solid #f1f5f9; transition: background 0.12s ease; cursor: pointer;
}
.zb-table tbody tr:hover { background: #f8faff; }
.zb-table tbody tr.selected { background: #eff6ff; }
.zb-table td { padding: 12px 14px; color: #334155; vertical-align: middle; }

/* Cell elements */
.zb-bill-num {
  font-weight: 600; color: #2563eb; text-decoration: none; display: inline-flex;
  align-items: center; gap: 5px; font-family: var(--font-mono, monospace);
}
.zb-bill-num:hover { text-decoration: underline; }
.zb-warn-icon { color: #f59e0b; font-size: 13px; display: inline-flex; align-items: center; }

.zb-vendor-name { font-weight: 600; color: #0f172a; }
.zb-ref-text { color: #64748b; font-size: 12px; }
.zb-date-text { color: #475569; font-size: 12px; white-space: nowrap; }
.zb-money { font-family: var(--font-mono, monospace); font-weight: 600; font-size: 12.5px; white-space: nowrap; }

/* Status Labels (Zoho style text badges) */
/* Status Labels (Enterprise soft pill badges) */
.zb-st-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.3;
}
.zb-st-pending_approval { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.zb-st-partially_paid { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.zb-st-open, .zb-st-sent { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.zb-st-approval_overdue { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.zb-st-overdue { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.zb-st-paid { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.zb-st-draft { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.zb-st-void, .zb-st-cancelled { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }

[data-theme="dark"] .zb-st-pending_approval { background: rgba(245, 158, 11, 0.18) !important; color: #fbbf24 !important; border-color: rgba(245, 158, 11, 0.3) !important; }
[data-theme="dark"] .zb-st-partially_paid { background: rgba(16, 185, 129, 0.18) !important; color: #34d399 !important; border-color: rgba(16, 185, 129, 0.3) !important; }
[data-theme="dark"] .zb-st-open, [data-theme="dark"] .zb-st-sent { background: rgba(59, 130, 246, 0.18) !important; color: #60a5fa !important; border-color: rgba(59, 130, 246, 0.3) !important; }
[data-theme="dark"] .zb-st-approval_overdue { background: rgba(234, 88, 12, 0.18) !important; color: #fb923c !important; border-color: rgba(234, 88, 12, 0.3) !important; }
[data-theme="dark"] .zb-st-overdue { background: rgba(239, 68, 68, 0.18) !important; color: #f87171 !important; border-color: rgba(239, 68, 68, 0.3) !important; }
[data-theme="dark"] .zb-st-paid { background: rgba(34, 197, 94, 0.18) !important; color: #4ade80 !important; border-color: rgba(34, 197, 94, 0.3) !important; }
[data-theme="dark"] .zb-st-draft { background: rgba(148, 163, 184, 0.18) !important; color: #cbd5e1 !important; border-color: rgba(148, 163, 184, 0.3) !important; }
[data-theme="dark"] .zb-st-void, [data-theme="dark"] .zb-st-cancelled { background: rgba(107, 114, 128, 0.18) !important; color: #9ca3af !important; border-color: rgba(107, 114, 128, 0.3) !important; }

/* New Bill Form Styling (matching screenshots) */
.zb-bill-drawer {
  width: min(980px, 98vw) !important;
}
.zb-form-row-vendor {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding-bottom: 12px; border-bottom: 1px solid #f1f5f9; margin-bottom: 14px;
}
.zb-vendor-detail-btn {
  background: #334155; color: #fff; font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 8px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: background 0.15s;
}
.zb-vendor-detail-btn:hover { background: #1e293b; }

.zb-badge-currency {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; color: #065f46;
}

.zb-addr-box {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 12px 14px; font-size: 12px; line-height: 1.6; color: #475569;
  margin-top: 8px;
}
.zb-addr-title {
  font-weight: 700; font-size: 11px; text-transform: uppercase; color: #64748b;
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.zb-addr-edit { color: #2563eb; cursor: pointer; font-size: 12px; font-weight: normal; }
.zb-addr-edit:hover { text-decoration: underline; }

.zb-remarks-box {
  margin-top: 8px; font-size: 12px; color: #64748b;
}

.zb-attach-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: #2563eb; cursor: pointer;
  height: 38px; align-self: flex-end;
}
.zb-attach-badge:hover { background: #eff6ff; border-color: #93c5fd; }

.zb-open-pos-callout {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 9px 14px; font-size: 12.5px; color: #92400e; margin: 12px 0;
  display: flex; align-items: center; gap: 8px;
}
.zb-open-pos-callout a {
  color: #2563eb; font-weight: 700; text-decoration: underline; cursor: pointer;
}

.zb-item-table th {
  background: #f8fafc; font-size: 11px; font-weight: 700; color: #475569;
  text-transform: uppercase; padding: 9px 8px; border-bottom: 1px solid #e2e8f0;
}
.zb-item-table td { padding: 8px 6px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }

/* ── Purchase Drawer Container & Transitions ──────────────────────────────── */
#purchase-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  justify-content: flex-end;
}

#purchase-drawer-overlay.open,
#purchase-drawer-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

#purchase-drawer {
  position: relative;
  width: min(960px, 98vw);
  height: 100%;
  max-height: 100vh;
  background: #ffffff;
  box-shadow: -16px 0 40px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

#purchase-drawer-overlay.open #purchase-drawer,
#purchase-drawer-overlay.active #purchase-drawer,
#purchase-drawer.open {
  transform: translateX(0) !important;
}

.zb-bill-drawer .im-drawer-body {
  flex: 1;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════════════════════
   DARK MODE OVERRIDES (Delivery Challans, Credit Notes & Bills)
   ══════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .bd-list-head {
  background: #0f172a !important;
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] .bd-list-head select {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .bd-search {
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] .bd-search input {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .bd-search input:focus {
  background: #0f172a !important;
  border-color: #2563eb !important;
}
[data-theme="dark"] .bd-row:hover {
  background: rgba(51, 65, 85, 0.45) !important;
}
[data-theme="dark"] .bd-row.selected {
  background: rgba(37, 99, 235, 0.22) !important;
  border-left-color: #2563eb !important;
}
[data-theme="dark"] .bd-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .bd-list-pane,
[data-theme="dark"] .bd-detail {
  background: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .bd-toolbar {
  background: #0f172a !important;
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] .bd-btn {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .bd-modal {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .zb-seg-group {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
}
[data-theme="dark"] .zb-seg-btn {
  color: #94a3b8 !important;
}
[data-theme="dark"] .zb-seg-btn:hover {
  color: #f8fafc !important;
}
[data-theme="dark"] .zb-seg-btn.active {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}
[data-theme="dark"] .zb-table-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .zb-table th {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .zb-table td {
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .zb-table tbody tr:hover {
  background: rgba(51, 65, 85, 0.45) !important;
}
[data-theme="dark"] .zb-table tbody tr.selected {
  background: rgba(37, 99, 235, 0.18) !important;
}
[data-theme="dark"] .zb-vendor-name {
  color: #f8fafc !important;
}
[data-theme="dark"] .zb-date-text {
  color: #94a3b8 !important;
}
[data-theme="dark"] .zb-bill-drawer {
  background: #1e293b !important;
  color: #f8fafc !important;
}
[data-theme="dark"] #purchase-drawer {
  background: #1e293b !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .zb-dropdown-menu {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .zb-dropdown-item {
  color: #cbd5e1 !important;
}
[data-theme="dark"] .zb-dropdown-item:hover {
  background: #334155 !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .zb-addr-box,
[data-theme="dark"] .zb-remarks-box {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
