/* =========================================================
   BANKING MITRA - LOAN TYPE PAGE
   Scoped classes: bm-loan-*, bm-sidebar-*, bm-topbar-*
   ========================================================= */

:root {
  --bm-primary: #000d33;
  --bm-primary-container: #002060;
  --bm-secondary: #115cb9;
  --bm-secondary-container: #659dfe;
  --bm-on-primary: #ffffff;
  --bm-bg: #f8f9ff;
  --bm-surface: #f8f9ff;
  --bm-surface-low: #eff4ff;
  --bm-surface-high: #dce9ff;
  --bm-surface-variant: #d3e4fe;
  --bm-border: #c5c6d2;
  --bm-text: #0b1c30;
  --bm-muted: #444650;
  --bm-outline: #757681;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body.loan-type-page {
  background: var(--bm-bg);
  color: var(--bm-text);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Material Icons */
.loan-type-page .material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.bm-sidebar {
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  color: var(--bm-on-primary);
  background: var(--bm-primary);
  border-right: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 1px 8px rgba(11,28,48,.10);
}

.bm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
  margin-bottom: 4px;
}

.bm-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bm-secondary);
}

.bm-brand-mark .material-symbols-outlined { font-size: 21px; }

.bm-sidebar-brand h1 {
  margin: 0;
  font: 700 20px/1.2 "Hanken Grotesk", sans-serif;
}

.bm-sidebar-brand p {
  margin: 3px 0 0;
  color: rgba(255,255,255,.68);
  font-size: 11px;
}

.bm-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.bm-nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.70);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: .18s ease;
}

.bm-nav-item .material-symbols-outlined { font-size: 21px; }

.bm-nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,.09);
}

.bm-nav-item.bm-active {
  color: #003370;
  background: var(--bm-secondary-container);
  font-weight: 700;
}

.bm-sidebar-bottom {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.16);
}

.bm-quick-btn {
  width: 100%;
  min-height: 42px;
  margin: 12px 0;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--bm-secondary);
  font: 600 13px "Inter", sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.bm-quick-btn:hover { background: #0d4e9f; }

/* Main / Topbar */
.bm-dashboard-wrapper {
  min-height: 100vh;
  margin-left: 260px;
}

.bm-topbar {
  position: sticky;
  z-index: 80;
  top: 0;
  height: 64px;
  padding: 0 32px;
  background: rgba(248,249,255,.98);
  border-bottom: 1px solid var(--bm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bm-topbar-left, .bm-topbar-right {
  display: flex;
  align-items: center;
}

.bm-topbar-left { gap: 14px; }
.bm-topbar-right { gap: 12px; }

.bm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--bm-muted);
  font-size: 13px;
}

.bm-breadcrumb .material-symbols-outlined { font-size: 17px; }
.bm-breadcrumb strong { color: var(--bm-primary); }

.bm-icon-btn, .bm-menu-btn {
  border: 0;
  background: transparent;
  color: var(--bm-muted);
  cursor: pointer;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
}

.bm-icon-btn:hover, .bm-menu-btn:hover {
  background: var(--bm-surface-high);
  color: var(--bm-primary);
}

.bm-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bm-primary-container);
  color: #fff;
  display: grid;
  place-items: center;
}

.bm-avatar .material-symbols-outlined { font-size: 19px; }
.bm-menu-btn { display: none; }

/* Page */
.bm-loan-main {
  min-height: calc(100vh - 64px);
  padding: 40px;
  background: linear-gradient(180deg, rgba(211,228,254,.42) 0, rgba(248,249,255,.8) 270px, var(--bm-bg) 500px);
}

.bm-loan-container {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.bm-loan-heading {
  margin-bottom: 24px;
}

.bm-loan-heading h2 {
  margin: 0 0 4px;
  font: 600 32px/40px "Hanken Grotesk", sans-serif;
  letter-spacing: -.01em;
  color: var(--bm-text);
}

.bm-loan-heading p {
  margin: 0;
  color: var(--bm-muted);
  font-size: 14px;
}

/* Card / toolbar */
.bm-loan-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--bm-border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(11,28,48,.05);
}

.bm-loan-toolbar {
  min-height: 86px;
  padding: 20px 24px;
  background: var(--bm-surface);
  border-bottom: 1px solid var(--bm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bm-page-size {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.bm-page-size select,
.bm-search-box input,
.bm-date-box input {
  height: 40px;
  border: 1px solid var(--bm-border);
  border-radius: 8px;
  background: #fff;
  color: var(--bm-text);
  font: 400 13px "Inter", sans-serif;
  outline: none;
}

.bm-page-size select {
  width: 72px;
  padding: 0 10px;
}

.bm-page-size span { color: var(--bm-muted); }

.bm-loan-toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.bm-search-box {
  position: relative;
  width: 250px;
}

.bm-search-box input {
  width: 100%;
  padding: 0 38px 0 12px;
}

.bm-search-box .material-symbols-outlined {
  position: absolute;
  right: 11px;
  top: 10px;
  font-size: 19px;
  color: var(--bm-outline);
}

.bm-date-box {
  position: relative;
  width: 145px;
}

.bm-date-box .material-symbols-outlined {
  position: absolute;
  left: 10px;
  top: 11px;
  font-size: 17px;
  color: var(--bm-outline);
  pointer-events: none;
}

.bm-date-box input {
  width: 100%;
  padding: 0 8px 0 32px;
}

.bm-search-box input:focus,
.bm-date-box input:focus,
.bm-page-size select:focus,
.bm-form-grid input:focus {
  border-color: var(--bm-secondary);
  box-shadow: 0 0 0 3px rgba(17,92,185,.10);
}

.bm-loan-btn {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 8px;
  border: 1px solid var(--bm-border);
  font: 600 13px "Inter", sans-serif;
  cursor: pointer;
  transition: .18s ease;
}

.bm-loan-btn.bm-primary {
  color: #fff;
  background: var(--bm-primary-container);
  border-color: var(--bm-primary-container);
}

.bm-loan-btn.bm-primary:hover { background: var(--bm-primary); }

.bm-loan-btn.bm-secondary {
  color: var(--bm-text);
  background: var(--bm-surface-variant);
}

.bm-loan-btn.bm-secondary:hover { background: var(--bm-surface-high); }

.bm-toolbar-divider {
  width: 1px;
  height: 28px;
  margin: 0 5px;
  background: var(--bm-border);
}

/* Table */
.bm-loan-table-wrap { overflow-x: auto; }

.bm-loan-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  text-align: left;
}

.bm-loan-table thead tr {
  background: var(--bm-surface-low);
  border-bottom: 1px solid var(--bm-border);
}

.bm-loan-table th {
  padding: 12px 24px;
  color: var(--bm-primary-container);
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.bm-loan-table td {
  padding: 13px 24px;
  border-bottom: 1px solid rgba(197,198,210,.55);
  color: var(--bm-text);
  font-size: 13px;
  line-height: 20px;
}

.bm-loan-table tbody tr { transition: background .15s ease; }
.bm-loan-table tbody tr:hover { background: rgba(239,244,255,.65); }
.bm-loan-table td:first-child { color: var(--bm-muted); width: 75px; }
.bm-loan-table td.bm-rate-cell { text-align: right; font-weight: 600; }
.bm-loan-table th.bm-rate-col { text-align: right; }
.bm-loan-table th.bm-action-col,
.bm-loan-table td.bm-action-cell { text-align: center; width: 100px; }

.bm-edit-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--bm-secondary);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.bm-edit-btn:hover { background: var(--bm-surface-high); color: var(--bm-primary); }
.bm-edit-btn .material-symbols-outlined { font-size: 19px; }

.bm-loan-empty {
  padding: 40px;
  text-align: center;
  color: var(--bm-muted);
}

.bm-loan-pagination {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bm-surface);
}

.bm-loan-pagination > span {
  color: var(--bm-muted);
  font-size: 13px;
}

.bm-pages {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bm-page-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--bm-border);
  border-radius: 6px;
  background: #fff;
  color: var(--bm-text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font: 500 12px "Inter", sans-serif;
}

.bm-page-btn:hover:not(:disabled) { background: var(--bm-surface-high); }
.bm-page-btn.bm-current {
  color: #fff;
  background: var(--bm-primary-container);
  border-color: var(--bm-primary-container);
}
.bm-page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Modal */
.bm-loan-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  padding: 20px;
  background: rgba(0,13,51,.38);
  display: grid;
  place-items: center;
}

.bm-loan-modal[hidden] { display: none; }

.bm-loan-modal-box {
  width: min(600px, 100%);
  background: #fff;
  border: 1px solid var(--bm-border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,13,51,.22);
}

.bm-modal-head {
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--bm-border);
}

.bm-modal-head h3 {
  margin: 0;
  font: 600 22px/30px "Hanken Grotesk", sans-serif;
}

.bm-modal-head p {
  margin: 3px 0 0;
  color: var(--bm-muted);
  font-size: 12px;
}

.bm-modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--bm-muted);
  font-size: 25px;
  cursor: pointer;
}

.bm-modal-close:hover { background: var(--bm-surface-low); }

#bmLoanForm { padding: 24px; }

.bm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.bm-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--bm-text);
  font-size: 13px;
  font-weight: 600;
}

.bm-form-grid label:first-child { grid-column: 1 / -1; }

.bm-form-grid input {
  height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--bm-border);
  border-radius: 8px;
  outline: none;
  font: 400 13px "Inter", sans-serif;
}

.bm-modal-actions {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--bm-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Mobile sidebar */
.bm-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0,13,51,.38);
}

@media (max-width: 1100px) {
  .bm-loan-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .bm-loan-toolbar-right { width: 100%; justify-content: flex-start; }
}

@media (max-width: 820px) {
  .bm-sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .bm-sidebar.bm-open { transform: translateX(0); }
  .bm-sidebar-overlay.bm-open { display: block; }
  .bm-dashboard-wrapper { margin-left: 0; }
  .bm-menu-btn { display: grid; }
  .bm-topbar { padding: 0 16px; }
  .bm-topbar-right .bm-icon-btn:nth-child(2),
  .bm-topbar-right .bm-icon-btn:nth-child(3) { display: none; }
  .bm-loan-main { padding: 24px 16px; }
  .bm-loan-heading h2 { font-size: 28px; line-height: 36px; }
  .bm-loan-toolbar-right { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .bm-search-box { width: 100%; grid-column: 1 / -1; }
  .bm-date-box { width: 100%; }
  .bm-toolbar-divider { display: none; }
  .bm-loan-pagination { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .bm-loan-toolbar-right { grid-template-columns: 1fr; }
  .bm-search-box { grid-column: auto; }
  .bm-loan-btn { width: 100%; }
  .bm-form-grid { grid-template-columns: 1fr; }
  .bm-form-grid label:first-child { grid-column: auto; }
  .bm-modal-actions { flex-direction: column-reverse; }
  .bm-modal-actions .bm-loan-btn { width: 100%; }
  .bm-topbar-right { gap: 4px; }
}
