/* =====================================================================
   MUMOLAS 2.0 — staff client design system
   Top module bar + left sub-menu, light & dark themes (Bootstrap 5.3 data-bs-theme)
   Powered by Erasoft Solution Pvt. Ltd.
   ===================================================================== */
:root {
  --mu-primary: #1f4e79;
  --mu-primary-700: #173b5c;
  --mu-accent: #f59e0b;
  --mu-bg: #f3f5f9;
  --mu-surface: #ffffff;
  --mu-surface-2: #f8fafc;
  --mu-border: #e3e8ef;
  --mu-text: #1e293b;
  --mu-muted: #64748b;
  --mu-topbar: #0f2a44;
  --mu-topbar-text: #dbe7f3;
  --mu-sidebar: #ffffff;
  --mu-sidebar-active: rgba(31, 78, 121, .10);
  --mu-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
  --mu-radius: 12px;
  --bs-body-bg: var(--mu-bg);
  --bs-body-color: var(--mu-text);
  --bs-primary: var(--mu-primary);
  --bs-primary-rgb: 31, 78, 121;
  --bs-link-color: var(--mu-primary);
  --bs-link-hover-color: var(--mu-primary-700);
  --bs-border-color: var(--mu-border);
  --bs-font-sans-serif: "Inter", "Mukta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-bs-theme="dark"] {
  --mu-bg: #0b1220;
  --mu-surface: #111a2b;
  --mu-surface-2: #16213a;
  --mu-border: #233250;
  --mu-text: #e6edf7;
  --mu-muted: #94a3b8;
  --mu-topbar: #0a1526;
  --mu-topbar-text: #c9d7e8;
  --mu-sidebar: #0f1829;
  --mu-sidebar-active: rgba(96, 165, 250, .16);
  --mu-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .5);
  --bs-body-bg: var(--mu-bg);
  --bs-body-color: var(--mu-text);
  --bs-border-color: var(--mu-border);
  --bs-link-color: #7fb3e8;
  --bs-link-hover-color: #a9ccf3;
  --bs-secondary-bg: var(--mu-surface-2);
  --bs-tertiary-bg: var(--mu-surface-2);
}
html, body { height: 100%; }
body { font-size: 14px; background: var(--mu-bg); color: var(--mu-text); }
a { text-decoration: none; }

/* ---------- Top bar ---------- */
.mu-topbar { position: sticky; top: 0; z-index: 1030; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--mu-topbar); color: var(--mu-topbar-text); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.mu-brand { display: flex; align-items: center; gap: 6px; min-width: 190px; }
.mu-brand a { color: #fff; }
.mu-logo { width: 32px; height: 32px; border-radius: 8px; background: #fff; padding: 3px; object-fit: contain; }
.mu-brand-text { font-size: 17px; letter-spacing: .3px; }
.mu-ver { font-size: 11px; background: var(--mu-accent); color: #1a1a1a; border-radius: 6px; padding: 1px 6px; font-weight: 700; vertical-align: middle; }
.mu-sidebar-toggle { color: #fff; font-size: 22px; padding: 0 6px; }
.mu-modules { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mu-modules::-webkit-scrollbar { display: none; }
.mu-module { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; color: var(--mu-topbar-text); font-weight: 500; white-space: nowrap; font-size: 13.5px; transition: background .15s; }
.mu-module i { font-size: 15px; opacity: .9; }
.mu-module:hover { background: rgba(255,255,255,.08); color: #fff; }
.mu-module.active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 -3px 0 var(--mu-accent); }
.mu-topright { display: flex; align-items: center; gap: 6px; }
.mu-quick { position: relative; display: none; }
.mu-quick input { width: 200px; padding-left: 30px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: #fff; }
.mu-quick input::placeholder { color: rgba(255,255,255,.65); }
.mu-quick i { position: absolute; left: 10px; top: 7px; color: rgba(255,255,255,.75); }
.mu-icon-btn { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--mu-topbar-text); background: transparent; border: 0; font-size: 17px; }
.mu-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.mu-user { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border: 0; color: #fff; border-radius: 10px; padding: 4px 10px 4px 4px; }
.mu-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--mu-accent); color: #111; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
@media (min-width: 1600px) { .mu-quick { display: block; } }
@media (min-width: 1200px) { .mu-module span { display: inline; } }
@media (max-width: 1199px) { .mu-module span { display: none; } .mu-module { padding: 8px 10px; } }

/* ---------- Shell / sidebar ---------- */
.mu-shell { display: flex; min-height: calc(100vh - 56px); }
.mu-sidebar { width: 250px; flex: 0 0 250px; background: var(--mu-sidebar); border-right: 1px solid var(--mu-border); position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; display: flex; flex-direction: column; }
.mu-sidebar-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 8px; font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mu-muted); }
.mu-sidebar-head i { font-size: 16px; color: var(--mu-primary); }
[data-bs-theme="dark"] .mu-sidebar-head i { color: #7fb3e8; }
.mu-submenu { display: flex; flex-direction: column; padding: 4px 10px; gap: 2px; }
.mu-subitem { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--mu-text); font-size: 13.5px; transition: background .12s, color .12s; }
.mu-subitem i { width: 18px; text-align: center; color: var(--mu-muted); font-size: 15px; }
.mu-subitem:hover { background: var(--mu-surface-2); }
.mu-subitem.active { background: var(--mu-sidebar-active); color: var(--mu-primary); font-weight: 600; }
.mu-subitem.active i { color: var(--mu-primary); }
[data-bs-theme="dark"] .mu-subitem.active, [data-bs-theme="dark"] .mu-subitem.active i { color: #a9ccf3; }
.mu-sidebar-foot { margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--mu-border); font-size: 12px; }
@media (max-width: 991.98px) {
  .mu-sidebar { position: fixed; left: -260px; top: 56px; z-index: 1025; transition: left .2s; box-shadow: var(--mu-shadow); }
  .mu-sidebar.open { left: 0; }
}

/* ---------- Content ---------- */
.mu-content { flex: 1; min-width: 0; padding: 18px 22px 10px; display: flex; flex-direction: column; }
.mu-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.mu-title { font-size: 21px; font-weight: 700; margin: 2px 0 0; letter-spacing: -.2px; }
.mu-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--mu-muted); }
.mu-footer { margin-top: auto; padding: 14px 0 4px; display: flex; justify-content: space-between; font-size: 12px; color: var(--mu-muted); border-top: 1px solid var(--mu-border); flex-wrap: wrap; gap: 6px; }
.mu-powered { font-weight: 600; color: var(--mu-primary); }
[data-bs-theme="dark"] .mu-powered { color: #a9ccf3; }

/* ---------- Cards / tables / forms ---------- */
.card { border: 1px solid var(--mu-border); border-radius: var(--mu-radius); background: var(--mu-surface); box-shadow: var(--mu-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--mu-border); font-weight: 600; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-body { padding: 16px; }
.table { --bs-table-bg: transparent; margin-bottom: 0; font-size: 13.5px; }
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--mu-muted); font-weight: 600; border-bottom: 1px solid var(--mu-border); background: var(--mu-surface-2); white-space: nowrap; }
.table td { vertical-align: middle; border-color: var(--mu-border); }
.table-hover tbody tr:hover { background: var(--mu-surface-2); }
.table-wrap { overflow-x: auto; border-radius: var(--mu-radius); }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--mu-muted); margin-bottom: 4px; }
.form-control, .form-select { background: var(--mu-surface); color: var(--mu-text); border-color: var(--mu-border); border-radius: 8px; font-size: 13.5px; }
.form-control:focus, .form-select:focus { border-color: var(--mu-primary); box-shadow: 0 0 0 .2rem rgba(31,78,121,.15); }
.form-control-sm, .form-select-sm { border-radius: 7px; }
.btn { border-radius: 8px; font-weight: 500; font-size: 13.5px; }
.btn-primary { background: var(--mu-primary); border-color: var(--mu-primary); }
.btn-primary:hover { background: var(--mu-primary-700); border-color: var(--mu-primary-700); }
.btn-outline-primary { color: var(--mu-primary); border-color: var(--mu-primary); }
.btn-outline-primary:hover { background: var(--mu-primary); border-color: var(--mu-primary); color: #fff; }
.btn-accent { background: var(--mu-accent); border-color: var(--mu-accent); color: #1a1a1a; font-weight: 600; }
.btn-accent:hover { filter: brightness(.95); color: #000; }
.badge { font-weight: 600; letter-spacing: .02em; border-radius: 6px; }
.nav-tabs .nav-link { color: var(--mu-muted); border: 0; border-bottom: 2px solid transparent; font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--mu-primary); border-bottom-color: var(--mu-primary); background: transparent; }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { color: #a9ccf3; border-bottom-color: #a9ccf3; }
.dropdown-menu { border-radius: 10px; border-color: var(--mu-border); background: var(--mu-surface); }
.dropdown-item { color: var(--mu-text); font-size: 13.5px; }
.dropdown-item:hover { background: var(--mu-surface-2); }
.modal-content { border-radius: 14px; background: var(--mu-surface); border-color: var(--mu-border); }
.alert { border-radius: 10px; }
.text-muted { color: var(--mu-muted) !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--mu-muted); font-weight: 700; margin: 6px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--mu-border); }

/* ---------- Dashboard tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--mu-surface); border: 1px solid var(--mu-border); border-radius: var(--mu-radius); padding: 14px 16px; display: flex; gap: 12px; align-items: center; box-shadow: var(--mu-shadow); position: relative; overflow: hidden; }
.stat .ico { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; background: var(--mu-primary); flex: 0 0 42px; }
.stat.c-green .ico { background: #16a34a; } .stat.c-red .ico { background: #dc2626; } .stat.c-amber .ico { background: #d97706; } .stat.c-violet .ico { background: #7c3aed; } .stat.c-cyan .ico { background: #0891b2; } .stat.c-slate .ico { background: #475569; } .stat.c-pink .ico { background: #db2777; }
.stat .val { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat .lbl { font-size: 12px; color: var(--mu-muted); }
.stat a.stretched-link::after { z-index: 1; }

/* ---------- Circulation desk ---------- */
.desk-scan { font-size: 22px; padding: 14px 18px; border-radius: 12px; letter-spacing: .5px; }
.desk-result { min-height: 90px; }
.member-card-mini { display: flex; gap: 14px; align-items: center; }
.member-card-mini img, .member-card-mini .ph { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: var(--mu-surface-2); display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--mu-muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 13.5px; }
.kv dt { color: var(--mu-muted); font-weight: 500; }
.kv dd { margin: 0; }

/* ---------- Book cover ---------- */
.cover { width: 56px; height: 76px; object-fit: cover; border-radius: 6px; box-shadow: var(--mu-shadow); background: var(--mu-surface-2); }
.cover-lg { width: 150px; height: 210px; object-fit: cover; border-radius: 10px; box-shadow: var(--mu-shadow); background: var(--mu-surface-2); }

/* ---------- Member ID card (CR80 85.6 x 54 mm) ---------- */
.id-card { width: 85.6mm; height: 54mm; border-radius: 3mm; overflow: hidden; position: relative; background: #fff; color: #111; box-shadow: 0 4px 14px rgba(0,0,0,.2); font-family: Inter, Arial, sans-serif; break-inside: avoid; }
.id-card .band { height: 11mm; background: var(--card-color, var(--mu-primary)); color: #fff; display: flex; align-items: center; gap: 2mm; padding: 0 3mm; }
.id-card .band img { width: 8mm; height: 8mm; background: #fff; border-radius: 1.5mm; padding: .6mm; object-fit: contain; }
.id-card .band .lib { font-size: 8pt; font-weight: 700; line-height: 1.1; }
.id-card .band .lib small { display: block; font-weight: 400; font-size: 6pt; opacity: .9; }
.id-card .body { display: flex; gap: 2.5mm; padding: 2mm 3mm; }
.id-card .photo { width: 20mm; height: 25mm; border-radius: 1.5mm; object-fit: cover; background: #eee; border: .3mm solid #ddd; }
.id-card .info { flex: 1; font-size: 7pt; line-height: 1.35; }
.id-card .info .name { font-size: 9.5pt; font-weight: 700; }
.id-card .info .num { font-family: monospace; font-size: 8pt; }
.id-card .qr { width: 17mm; height: 17mm; }
.id-card .qr img, .id-card .qr canvas { width: 17mm !important; height: 17mm !important; }
.id-card .barcode { position: absolute; left: 3mm; right: 3mm; bottom: 1.5mm; height: 9mm; display: flex; justify-content: center; }
.id-card .barcode svg { height: 9mm; max-width: 100%; }
.id-card .foot { position: absolute; right: 3mm; bottom: 1mm; font-size: 5pt; color: #666; }
.id-card.back { background: #f7f7f7; padding: 3mm; font-size: 6.5pt; line-height: 1.4; }
.id-card.classic .band { background: #333; } .id-card.minimal .band { background: #fff; color: #111; border-bottom: .4mm solid var(--card-color, #333); }
.cards-sheet { display: flex; flex-wrap: wrap; gap: 6mm; }

/* ---------- Letters / receipts (print) ---------- */
.letter { background: #fff; color: #111; max-width: 210mm; margin: 0 auto; padding: 20mm 22mm; box-shadow: var(--mu-shadow); font-size: 11.5pt; line-height: 1.6; }
.letter .lh { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #1f4e79; padding-bottom: 10px; margin-bottom: 18px; }
.letter .lh img { width: 64px; height: 64px; object-fit: contain; }
.letter h2 { margin: 0; font-size: 18pt; color: #1f4e79; }
.receipt { background: #fff; color: #111; width: 80mm; padding: 6mm 5mm; font-family: "Courier New", monospace; font-size: 10.5pt; margin: 0 auto; box-shadow: var(--mu-shadow); }
.receipt .c { text-align: center; } .receipt hr { border-top: 1px dashed #333; margin: 6px 0; }
.receipt table { width: 100%; } .receipt td { padding: 1px 0; vertical-align: top; }
.receipt-a5 { background: #fff; color: #111; width: 148mm; padding: 10mm 12mm; margin: 0 auto; font-size: 10.5pt; box-shadow: var(--mu-shadow); }
@media print {
  .mu-topbar, .mu-sidebar, .mu-page-head, .mu-footer, .no-print, .alert { display: none !important; }
  .mu-content { padding: 0; } .mu-shell { display: block; } body { background: #fff; }
  .letter, .receipt, .receipt-a5 { box-shadow: none; margin: 0; }
  .card { box-shadow: none; border: 0; }
}

/* ---------- Misc ---------- */
.marc-editor { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; min-height: 420px; line-height: 1.5; white-space: pre; }
.facet a { display: flex; justify-content: space-between; padding: 3px 0; color: var(--mu-text); }
.facet a:hover { color: var(--mu-primary); }
.timeline { border-left: 2px solid var(--mu-border); margin-left: 8px; padding-left: 16px; }
.timeline .ev { position: relative; margin-bottom: 12px; }
.timeline .ev::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--mu-primary); }
.avatar-lg { width: 110px; height: 130px; object-fit: cover; border-radius: 12px; background: var(--mu-surface-2); }
.empty { text-align: center; color: var(--mu-muted); padding: 40px 10px; }
.empty i { font-size: 40px; display: block; margin-bottom: 8px; opacity: .5; }
.auth-page { background: radial-gradient(1200px 600px at 10% -10%, #1f4e79 0%, #0f2a44 45%, #0b1220 100%); min-height: 100vh; }
.auth-main { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 420px; max-width: 100%; border-radius: 18px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--mu-surface); border-top: 1px solid var(--mu-border); padding: 10px 0; z-index: 5; }
.tt { cursor: help; border-bottom: 1px dotted var(--mu-muted); }
kbd { background: var(--mu-surface-2); color: var(--mu-text); border: 1px solid var(--mu-border); }
.w-120 { width: 120px; } .w-160 { width: 160px; } .w-220 { width: 220px; }

/* ---------- Help (F1) ---------- */
.hp-panel { width: min(560px, 95vw); box-shadow: -4px 0 24px rgba(0,0,0,.18); }
.hp-panel .offcanvas-body { padding-top: 4px; }
.hp-foot { border-top: 1px solid var(--bs-border-color); }
.hp-topic-head { border-bottom: 1px solid var(--bs-border-color); margin-bottom: 10px; padding-bottom: 8px; }
.hp-body h2.hp-h, .hp-body h3.hp-h { font-size: 15px; font-weight: 600; margin: 16px 0 6px; padding: 4px 8px; border-left: 3px solid var(--mu-primary); background: var(--bs-tertiary-bg); border-radius: 0 6px 6px 0; }
.hp-body h4.hp-h { font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
.hp-body p, .hp-body li { font-size: 14px; line-height: 1.55; }
.hp-body p { margin-bottom: 8px; }
.hp-ul, .hp-ol { padding-left: 22px; margin-bottom: 8px; }
.hp-ol li { margin-bottom: 4px; }
.hp-table { font-size: 13px; margin: 6px 0 10px; }
.hp-code { background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; white-space: pre-wrap; }
.hp-call { border-radius: 8px; padding: 8px 12px; margin: 8px 0 10px; font-size: 13.5px; border: 1px solid transparent; }
.hp-note { background: rgba(13,110,253,.08); border-color: rgba(13,110,253,.25); }
.hp-tip { background: rgba(25,135,84,.08); border-color: rgba(25,135,84,.3); }
.hp-warn { background: rgba(220,53,69,.08); border-color: rgba(220,53,69,.3); }
.hp-example { background: rgba(255,193,7,.12); border-color: rgba(255,193,7,.45); }
.hp-ui { display: inline-block; padding: 0 6px; border: 1px solid var(--bs-border-color); border-radius: 4px; background: var(--bs-body-bg); font-size: 12.5px; font-weight: 600; }
.hp-term { text-decoration: underline dotted var(--mu-primary); text-underline-offset: 3px; cursor: help; }
.hp-definebox { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.5); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.hp-def { font-size: 13.5px; margin-top: 4px; }
.hp-related { border-top: 1px solid var(--bs-border-color); margin-top: 14px; padding-top: 8px; }
.hp-related-link { display: inline-block; font-size: 12.5px; margin: 2px 6px 2px 0; padding: 2px 8px; border: 1px solid var(--bs-border-color); border-radius: 12px; text-decoration: none; }
.hp-related-link:hover { background: var(--bs-tertiary-bg); }
.hp-glossary dt { margin-top: 10px; color: var(--mu-primary); }
.hp-glossary dd { margin-bottom: 4px; font-size: 14px; }
.hp-page .hp-body { max-width: 900px; }
/* diagrams */
.hp-flow { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; padding: 10px; background: var(--bs-tertiary-bg); border: 1px dashed var(--bs-border-color); border-radius: 8px; overflow-x: auto; }
.hp-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.hp-lane { font-size: 11.5px; font-weight: 600; color: var(--bs-secondary-color); min-width: 90px; margin-right: 4px; }
.hp-node { display: inline-block; padding: 5px 10px; border-radius: 6px; background: var(--bs-body-bg); border: 1.5px solid var(--mu-primary); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.hp-decision { border-color: #f59e0b; background: rgba(245,158,11,.14); border-radius: 14px; }
.hp-terminal { border-color: #198754; background: rgba(25,135,84,.12); border-radius: 20px; }
.hp-alert { border-color: #dc3545; background: rgba(220,53,69,.1); }
.hp-arrow { color: var(--bs-secondary-color); font-size: 14px; padding: 0 2px; }
@media print { .hp-panel { display: none !important; } }
