/* PB Finance — Gold Loan Management · design tokens + components */
:root {
  --navy-900: #0a1c35;
  --navy-800: #0f2747;
  --navy-700: #183764;
  --navy-600: #24497f;
  --navy-100: #e7edf6;
  --orange-600: #e07a14;
  --orange-500: #f28c28;
  --orange-100: #fdeedd;
  --gold-300: #f9c27c;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #16243a;
  --text-2: #4b5b73;
  --muted: #6b7a90;
  --line: #dfe5ee;
  --line-2: #eef2f7;

  --success: #18794e;   --success-bg: #e6f4ec;
  --warning: #9a5b00;   --warning-bg: #fff3dc;
  --danger: #b42318;    --danger-bg: #fdecea;
  --info: #1d4ed8;      --info-bg: #e8effd;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(15, 39, 71, .06), 0 4px 14px rgba(15, 39, 71, .06);
  --shadow-lg: 0 12px 40px rgba(10, 28, 53, .22);
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Tamil", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.is-busy { cursor: progress; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--navy-800); }
a { color: var(--navy-600); }
code, pre { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
.num, .stat-value, .table td.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--orange-500); outline-offset: 2px; }
.ic { flex: none; display: block; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: calc(100vh / var(--zf, 1)); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  color: #c9d5e8; display: flex; flex-direction: column;
  transition: width .2s ease, transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { border-radius: 8px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { color: #fff; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { color: var(--gold-300); font-size: 11.5px; letter-spacing: .02em; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 10px 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin: 1px 0;
  border-radius: var(--radius-sm); color: #c9d5e8; text-decoration: none; white-space: nowrap;
  position: relative; font-size: 13.5px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(242,140,40,.16); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--orange-500); }
.nav-item.active .nav-ic { color: var(--orange-500); }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-num { font-size: 10.5px; opacity: .35; }
.sidebar-foot { padding: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.collapse-btn { width: 100%; display: flex; justify-content: center; padding: 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: #c9d5e8; cursor: pointer; }
.collapse-btn:hover { background: rgba(255,255,255,.07); color: #fff; }

body.nav-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.nav-collapsed .brand-text, body.nav-collapsed .nav-label, body.nav-collapsed .nav-num { display: none; }
body.nav-collapsed .nav-item { justify-content: center; padding: 10px; }
body.nav-collapsed .brand { justify-content: center; padding: 14px 8px; }
body.nav-collapsed .collapse-btn .ic { transform: rotate(180deg); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left .2s ease; display: flex; flex-direction: column; }
body.nav-collapsed .main { margin-left: var(--sidebar-w-collapsed); }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-title { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.topbar .hamburger { display: none; }

.branch-chip, .user-chip {
  display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text);
  cursor: pointer; font: inherit; font-size: 13px;
}
.branch-chip { border-color: #f6cfa5; background: var(--orange-100); color: var(--navy-800); font-weight: 600; }
.branch-chip:hover, .user-chip:hover { filter: brightness(.97); }
.branch-code { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--navy-800); color: #fff; letter-spacing: .03em; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-700); color: #fff; font-weight: 700; font-size: 12px; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--text-2); }
.pill-ok { background: var(--success-bg); color: var(--success); }
.pill-warn { background: var(--warning-bg); color: var(--warning); }
.sync-btn { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--navy-700); cursor: pointer; }
.sync-btn:hover { background: var(--surface-2); }
.sync-btn.spinning .ic { animation: spin 1s linear infinite; }
.sync-btn .count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--orange-500); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }

.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; max-height: calc(60vh / var(--zf, 1)); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.menu-right { left: auto; right: 0; }
.menu-head { padding: 6px 10px 8px; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-head strong { color: var(--text); font-size: 13.5px; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; text-decoration: none; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.active { background: var(--orange-100); font-weight: 600; }

.offline-bar { display: flex; align-items: center; gap: 8px; padding: 8px 20px; background: var(--warning-bg); color: var(--warning); font-size: 13px; border-bottom: 1px solid #f3dcb0; }
.content { flex: 1; padding: 22px 24px 40px; outline: none; }
.page { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.scrim { display: none; }

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { font-size: 15px; }
.card-body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--info-bg); color: #1e3a8a; font-size: 13px; }
.notice-danger { background: var(--danger-bg); color: var(--danger); }
.sub-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.sub-block h3 { font-size: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat { display: flex; gap: 12px; align-items: flex-start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-ic { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--navy-100); color: var(--navy-700); flex: none; }
.stat-success .stat-ic { background: var(--success-bg); color: var(--success); }
.stat-warning .stat-ic { background: var(--warning-bg); color: var(--warning); }
.stat-danger .stat-ic { background: var(--danger-bg); color: var(--danger); }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 700; color: var(--navy-800); }
.stat-sub { font-size: 12px; color: var(--muted); }
.count-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 28px; }
.count-row, .kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kv:last-of-type { border-bottom: 0; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }

.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty-ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--orange-100); color: var(--orange-600); }
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty p { max-width: 560px; margin: 0 auto; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--text-2); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-accent { background: var(--orange-100); color: var(--orange-600); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--orange-500); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--orange-600); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--navy-800); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-block { width: 100%; height: 42px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-2); cursor: pointer; }
.icon-btn:hover:not(:disabled) { background: var(--line-2); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.link-btn { border: 0; background: none; padding: 0; color: var(--orange-600); font: inherit; font-weight: 600; cursor: pointer; }

.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; color: var(--text); }
.input:focus { outline: none; border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(242,140,40,.18); }
.input.invalid, .has-err .input { border-color: var(--danger); }
.input-sm { height: 32px; width: auto; font-size: 12.5px; }
select.input { padding-right: 28px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-err { font-size: 12px; color: var(--danger); min-height: 0; }
.field-err:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
fieldset { border: 0; margin: 0 0 6px; padding: 0; }
legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--orange-600); margin-bottom: 8px; }

.date-input { position: relative; display: flex; }
.date-input .input { padding-right: 38px; font-variant-numeric: tabular-nums; }
.date-btn { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 34px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: var(--radius-sm); }
.date-btn:hover { color: var(--navy-700); }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); width: 170px; }

/* ---------- data table ---------- */
.dt-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dt-tools-r { display: flex; gap: 8px; align-items: center; }
.search { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); min-width: 240px; }
.search:focus-within { border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(242,140,40,.18); }
.search input { border: 0; outline: none; font: inherit; flex: 1; background: none; color: var(--text); }
.dt-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; }
.table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover td { background: #fbfcfe; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.dt-empty { text-align: center; color: var(--muted); padding: 28px !important; }
.dt-error { padding: 14px; color: var(--danger); }
.dt-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 10px; font-size: 12.5px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 6px; }

/* ---------- feedback ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px; color: var(--muted); }
.spin { width: 20px; height: 20px; border: 2.5px solid var(--line); border-top-color: var(--orange-500); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spin.sm { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc((100vw / var(--zf, 1)) - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: var(--radius); background: var(--navy-800); color: #fff; box-shadow: var(--shadow-lg); animation: toastIn .2s ease; transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(6px); }
.toast-success .toast-ic { color: #6ee7a8; }
.toast-error { background: #7a1810; }
.toast-warning .toast-ic { color: var(--gold-300); }
.toast-msg { flex: 1; font-size: 13px; }
.toast-x { border: 0; background: none; color: rgba(255,255,255,.7); cursor: pointer; padding: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(10, 28, 53, .45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-height: calc((100vh / var(--zf, 1)) - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); outline: none; }
.modal-sm { max-width: 420px; } .modal-md { max-width: 560px; } .modal-lg { max-width: 880px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.confirm-msg { margin: 0; color: var(--text-2); }
.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; font-size: 12px; overflow: auto; max-height: calc(50vh / var(--zf, 1)); }

/* ---------- auth & boot ---------- */
.auth { min-height: calc(100vh / var(--zf, 1)); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, var(--navy-700), transparent), linear-gradient(160deg, var(--navy-800), var(--navy-900)); }
.auth-card { width: 100%; max-width: 480px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 28px; }
.auth-card > h1 { font-size: 20px; margin-top: 18px; }
.auth-card > p { margin: 6px 0 0; }
.auth-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 3px solid var(--orange-500); }
.auth-brand img { border-radius: 12px; }
.auth-brand div { display: flex; flex-direction: column; }
.auth-brand strong { font-size: 18px; color: var(--navy-800); }
.auth-brand span { font-size: 12.5px; color: var(--orange-600); font-weight: 600; }
.auth-form { margin-top: 18px; display: flex; flex-direction: column; gap: 4px; }
.auth-form .notice { margin-bottom: 10px; }
.auth-foot { color: #9fb0c9; margin-top: 16px; }
.boot, .boot-static { min-height: calc(100vh / var(--zf, 1)); display: grid; place-content: center; text-align: center; padding: 16px; color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .user-name, .top-date { display: none; }
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar, body.nav-collapsed .sidebar { width: var(--sidebar-w); transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-collapsed .brand-text, body.nav-collapsed .nav-label, body.nav-collapsed .nav-num { display: revert; }
  body.nav-collapsed .nav-item { justify-content: flex-start; padding: 8px 10px; }
  .sidebar-foot { display: none; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10,28,53,.4); }
  .main, body.nav-collapsed .main { margin-left: 0; }
  .topbar .hamburger { display: grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 16px 16px 32px; }
  .branch-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 560px) {
  .pill-txt, .branch-chip .branch-name, .top-title { display: none; }
  .top-title { font-size: 15px; }
  .search { min-width: 0; flex: 1; }
  .dt-tools { flex-direction: column; align-items: stretch; }
  .dt-tools-r { justify-content: flex-end; }
  .page-head h1 { font-size: 19px; }
  .filter { width: calc(50% - 6px); }
  .auth-card { padding: 22px 18px; }
  /* tables become stacked cards */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .table td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 5px 12px; text-align: right; }
  .table td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; }
  .table td[data-label=""]::before { content: none; }
  .table td.dt-empty { justify-content: center; }
  .table td.dt-empty::before { content: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .sidebar, .topbar, .offline-bar, .toasts { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
}

/* =====================================================================
   Stage 2–6 components
   ===================================================================== */
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mono, .input.mono { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; letter-spacing: .02em; }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
textarea.input { height: auto; min-height: 38px; padding: 8px 11px; resize: vertical; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); }
.small { font-size: 12.5px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .input { flex: 1; }

.money-wrap { display: flex; flex-direction: column; gap: 3px; }
.money-box { position: relative; }
.money-box .cur { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.money-box .input { padding-left: 26px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.words { font-size: 11.5px; color: var(--orange-600); min-height: 0; line-height: 1.35; }
.words:empty { display: none; }

.stat-link { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.stat-link:hover { border-color: var(--orange-500); transform: translateY(-1px); }
.stat-txt { min-width: 0; }
.stat-value { overflow-wrap: anywhere; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tab { border: 0; background: none; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--navy-800); }
.tab.active { color: var(--navy-800); border-bottom-color: var(--orange-500); }
.tab-count { margin-left: 6px; font-size: 11px; background: var(--line-2); padding: 1px 6px; border-radius: 999px; }

.kv-grid { display: grid; gap: 10px 22px; margin: 0 0 6px; }
.kv-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv-item { min-width: 0; }
.kv-item dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv-item dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }

.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn-danger-ghost { background: var(--surface); border-color: #f1c4bf; color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-bg); }
.notice-warn { background: var(--warning-bg); color: var(--warning); }

.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line); }
.table-compact td, .table-compact th { padding: 7px 10px; font-size: 13px; }
.row-overdue td { background: #fff7f5; }
.row-reversed td { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.row-reversed td .badge { text-decoration: none; }
.row-highlight td { background: #fff4e8; }
.row-opening td { background: var(--navy-100); }

/* forms in sections */
.form-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.form-section-head h2 { font-size: 15px; }
.form-section > div:last-child { padding: 14px 18px; }
.loan-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.entry-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.bal-panel { position: sticky; top: calc(var(--topbar-h) + 14px); display: flex; flex-direction: column; gap: 12px; }
.bal-card { background: linear-gradient(160deg, var(--navy-800), var(--navy-700)); color: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.bal-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-300); }
.bal-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.bal-value.neg { color: #ffb3a8; }
.bal-sub { font-size: 12.5px; color: #c9d5e8; }
.bal-sum { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.bal-sum > div { display: flex; justify-content: space-between; gap: 10px; }
.bal-sum span { color: var(--muted); font-size: 13px; }
.bal-sum strong { font-variant-numeric: tabular-nums; }
.items-table td { padding: 6px; vertical-align: top; }
.items-table .input { height: 34px; }
.items-table td.sno { width: 46px; text-align: center; color: var(--muted); padding-top: 13px; }
.items-table th:nth-child(5), .items-table th:nth-child(6) { width: 120px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; margin: 0; border-top: 1px solid var(--line); z-index: 5; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.photo-slot { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.photo-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.photo-preview { aspect-ratio: 4 / 3; max-width: 100%; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-fig { margin: 0; } .photo-fig img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); } .photo-fig figcaption { font-size: 12px; color: var(--muted); }
.camera-video { width: 100%; max-height: calc(60vh / var(--zf, 1)); background: #000; border-radius: var(--radius-sm); }

.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; max-height: 280px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 4px; }
.combo-opt { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 9px; border-radius: 6px; font: inherit; cursor: pointer; color: var(--text); }
.combo-opt:hover, .combo-opt.active { background: var(--orange-100); }
.combo-empty { padding: 8px; }

.calc-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.link-box { margin-bottom: 12px; }
.link-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow: auto; margin-top: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.dialog-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sub-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 16px 0 8px; }
.sub-head h3, .sub-title { font-size: 14px; margin: 16px 0 8px; }
.view-top { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.receipt-preview { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: #fff; color: #111; max-height: calc(50vh / var(--zf, 1)); overflow: auto; }
.filter-wide { width: 230px; }

.dash-status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-grid .span-2 { grid-column: 1 / -1; }
.formulas summary { padding: 14px 18px; cursor: pointer; font-weight: 600; color: var(--navy-800); }
.formulas .card-body { padding-top: 0; }

/* export & print */
.export-stage { position: fixed; left: -10000px; top: 0; background: #fff; padding: 16px; }
#print-root { display: none; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  body.printing { background: #fff; }
  html:has(body.printing) { zoom: 1 !important; } /* v1.38: screen-size zoom never changes a print */
}

@media (max-width: 1100px) {
  .entry-layout { grid-template-columns: 1fr; }
  .bal-panel { position: static; order: -1; }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
  .kv-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4, .dialog-form .form-grid { grid-template-columns: 1fr; }
  .kv-grid.cols-2, .kv-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: 1fr; }
  .items-table td.sno { text-align: right; padding-top: 5px; }
  .items-table th:nth-child(5), .items-table th:nth-child(6) { width: auto; }
  .row-actions { justify-content: flex-end; }
  .filter-wide { width: 100%; }
}
.pop-menu { position: fixed; left: 0; top: 0; z-index: 95; min-width: 170px; }
.menu-item.danger { color: var(--danger); }
.row-actions { flex-wrap: nowrap; }
.dash-tiles .stat-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.items-table select.input { min-width: 104px; }
.items-table td:nth-child(2) .input { min-width: 130px; }
@media (max-width: 560px) { .row-actions { flex-wrap: wrap; } }

/* =====================================================================
   Financial Analyser
   Colours: blue = balances, green = increases, red = decreases/expenses,
   orange = unreconciled, purple = interest, grey = historical/supporting
   ===================================================================== */
:root { --fa-blue: #2563c9; --fa-blue-bg: #e8effb; --fa-green: #15803d; --fa-green-bg: #e6f4ec; --fa-red: #b91c1c; --fa-red-bg: #fdecea;
  --fa-orange: #c2410c; --fa-orange-bg: #fff1e6; --fa-purple: #7c3aed; --fa-purple-bg: #f1ebfe; --fa-grey: #5b6678; --fa-grey-bg: #eef1f5; }
.fa-controls .filters { margin-bottom: 0; align-items: flex-end; }
.fa-export { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.btn-row.tight { margin-top: 0; gap: 6px; }
.fa-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.fa-card { text-align: left; font: inherit; color: inherit; border: 1px solid var(--line); border-left: 4px solid var(--fa-grey); background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
button.fa-card { cursor: pointer; }
button.fa-card:hover { border-color: var(--orange-500); }
.fa-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.fa-value { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--navy-800); overflow-wrap: anywhere; }
.fa-sub { font-size: 11.5px; color: var(--muted); }
.fa-blue { border-left-color: var(--fa-blue); background: linear-gradient(90deg, var(--fa-blue-bg), var(--surface) 70%); } .fa-blue .fa-value { color: var(--fa-blue); }
.fa-green { border-left-color: var(--fa-green); } .fa-green .fa-value { color: var(--fa-green); }
.fa-red { border-left-color: var(--fa-red); } .fa-red .fa-value { color: var(--fa-red); }
.fa-purple { border-left-color: var(--fa-purple); } .fa-purple .fa-value { color: var(--fa-purple); }
.fa-grey { border-left-color: var(--fa-grey); background: var(--fa-grey-bg); }
.fa-navy { border-left-color: var(--navy-700); }
.fa-oca { border-left-color: var(--orange-500); background: var(--navy-800); }
.fa-oca .fa-label, .fa-oca .fa-sub { color: #c9d5e8; } .fa-oca .fa-value { color: #fff; font-size: 21px; }
.fa-break { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.fa-formula { display: flex; flex-direction: column; gap: 6px; }
.fa-formula > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.fa-formula .fa-total { border-bottom: 0; border-top: 2px solid var(--navy-800); font-weight: 700; }
.fa-side { background: var(--fa-grey-bg); border-radius: var(--radius-sm); padding: 10px 14px; }
.fa-side-head { font-size: 12px; font-weight: 700; color: var(--fa-grey); text-transform: uppercase; letter-spacing: .04em; border: 0 !important; }
.fa-recon { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.fa-recon-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.fa-recon-item.pos .fa-value { color: var(--fa-green); } .fa-recon-item.neg .fa-value { color: var(--fa-red); }
.fa-recon-item.warn { border-color: #f3b98e; background: var(--fa-orange-bg); } .fa-recon-item.warn .fa-value { color: var(--fa-orange); }
.pos { color: var(--fa-green); } .neg { color: var(--fa-red); } .warn-text { color: var(--fa-orange); } .purple-text { color: var(--fa-purple); }
.badge-orange { background: var(--fa-orange-bg); color: var(--fa-orange); }
.notice-orange { background: var(--fa-orange-bg); color: var(--fa-orange); }
.row-unexplained td { background: #fff6ef; }
.fa-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: center; margin-bottom: 10px; }

/* charts */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 8px; box-shadow: var(--shadow); min-width: 0; }
.chart-title { font-size: 13.5px; font-weight: 700; color: var(--navy-800); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-legend { display: flex; gap: 12px; font-weight: 500; color: var(--text-2); font-size: 12px; }
.chart-key { display: inline-flex; align-items: center; gap: 5px; }
.chart-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-area { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid line, .chart-grid-line { }
.chart-svg .chart-grid { stroke: #e8ecf2; stroke-width: 1; }
.chart-svg .chart-zero { stroke: #b9c2cf; stroke-width: 1; }
.chart-svg .chart-axis { fill: #6b7a90; font-size: 11px; font-family: var(--font); }
.chart-svg .chart-cross { stroke: #94a3b8; stroke-width: 1; }
.chart-svg .chart-hit:focus { outline: none; fill: rgba(37, 99, 201, .06); }
.chart-tip { position: absolute; z-index: 5; min-width: 160px; background: var(--navy-900); color: #fff; border-radius: 8px; padding: 7px 9px; font-size: 12px; pointer-events: none; box-shadow: var(--shadow-lg); }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.chart-tip small { display: block; color: #9fb0c9; margin-top: 3px; }
.hbars { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.hbar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto; gap: 10px; align-items: center; font-size: 12.5px; }
.hbar-track { height: 12px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.hbar-val { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 860px) {
  .fa-break, .fa-split, .chart-grid { grid-template-columns: 1fr; }
  .fa-export { margin-left: 0; align-items: flex-start; }
}
.table td.num strong, .table td.num span, .fa-value { white-space: nowrap; }
.fa-value { white-space: normal; }

/* Jewel Rate Crossed Market Rate */
.nav-label { white-space: normal; line-height: 1.25; }
.jr-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.jr-rate-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.jr-rate-form .field { margin: 0; min-width: 260px; }
.jr-label { font-size: 13px; font-weight: 700; color: var(--navy-800); }
.jr-applied { text-align: right; }
.jr-rate { font-size: 24px; font-weight: 800; color: var(--fa-blue); font-variant-numeric: tabular-nums; }
.jr-rate span { font-size: 13px; font-weight: 600; color: var(--muted); }
.filter-xwide { width: 320px; }
.jr-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-left: auto; }
.jr-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.jr-legend i.jr-above { background: var(--fa-green); } .jr-legend i.jr-below { background: var(--fa-red); } .jr-legend i.jr-review { background: var(--fa-orange); }
tr.jr-row { cursor: pointer; }
tr.jr-row td:first-child { border-left: 4px solid transparent; }
tr.jr-above td:first-child { border-left-color: var(--fa-green); }
tr.jr-below td:first-child { border-left-color: var(--fa-red); }
tr.jr-review td { background: var(--fa-orange-bg); } tr.jr-review td:first-child { border-left-color: var(--fa-orange); }
.jr-diff.above { color: var(--fa-green); } .jr-diff.below { color: var(--fa-red); } .jr-diff.review { color: var(--fa-orange); }
.jr-items summary { cursor: pointer; font-size: 13px; }
.mini-table { border-collapse: collapse; margin-top: 6px; font-size: 12px; }
.mini-table th, .mini-table td { padding: 3px 6px; border-bottom: 1px solid var(--line-2); text-align: left; }
.mini-table .num { text-align: right; }
@media (max-width: 560px) { .jr-applied { text-align: left; } .jr-rate-form .field { min-width: 0; width: 100%; } .filter-xwide { width: 100%; } .jr-legend { margin-left: 0; } }
.jr-table .table { font-size: 13px; }
.jr-table .table th { padding: 9px 8px; font-size: 11px; white-space: normal; vertical-align: bottom; }
.jr-table .table td { padding: 8px; }
.jr-table .link-btn { white-space: nowrap; }
.jr-table td.num { white-space: nowrap; }
.jr-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.jr-colors-label { font-size: 12px; font-weight: 700; color: var(--text-2); margin-right: 2px; }
.jr-chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.jr-chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.jr-chip.jr-above i { background: var(--fa-green); } .jr-chip.jr-below i { background: var(--fa-red); } .jr-chip.jr-review i { background: var(--fa-orange); }
.jr-chip-n { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--line-2); font-size: 11.5px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.jr-chip:hover { border-color: var(--navy-600); }
.jr-chip.active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.jr-chip.active .jr-chip-n { background: rgba(255,255,255,.18); color: #fff; }
.jr-chip.jr-above.active { background: var(--fa-green); border-color: var(--fa-green); }
.jr-chip.jr-below.active { background: var(--fa-red); border-color: var(--fa-red); }
.jr-chip.jr-review.active { background: var(--fa-orange); border-color: var(--fa-orange); }
.jr-chip.active i { background: #fff; }

/* ---------- Reports & Returns ---------- */
.rr-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; align-items: start; }
.rr-aside { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; max-height: calc((100vh / var(--zf, 1)) - 96px); overflow: auto; }
.rr-nav-select { display: none; }
.rr-group + .rr-group { margin-top: 10px; }
.rr-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--orange-600); padding: 4px 8px; }
.rr-link { display: flex; gap: 8px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: var(--radius-sm); font: inherit; font-size: 13px; color: var(--text); cursor: pointer; line-height: 1.3; }
.rr-link:hover { background: var(--surface-2); }
.rr-link.active { background: var(--orange-100); font-weight: 600; color: var(--navy-800); }
.rr-no { flex: none; min-width: 20px; height: 20px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; display: grid; place-items: center; color: var(--muted); }
.rr-link.active .rr-no { background: var(--orange-500); border-color: var(--orange-500); color: #fff; }
.rr-star { margin-left: auto; color: var(--orange-500); }
.rr-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rr-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.rr-head h2 { margin: 0 0 2px; font-size: 18px; }
.rr-head p { margin: 0; }
.rr-exports { display: flex; gap: 6px; flex-wrap: wrap; }
.rr-filters { margin-bottom: 8px; }
.rr-filter-actions { display: flex; gap: 6px; margin-left: auto; }
.rr-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-2); border-top: 1px dashed var(--line); padding-top: 8px; }
.rr-output { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rr-output > .notice { margin: 0; }
.rr-needs { padding: 28px 16px; }
tr.rr-row { cursor: pointer; }
tr.rr-row:hover td { background: var(--surface-2); }
tr.rr-issue td { background: var(--fa-orange-bg, #fff4e8); }
tr.rr-issue td:first-child { box-shadow: inset 3px 0 0 var(--fa-orange, #c2410c); }
.rr-picker { position: relative; }
.rr-picker-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; }
.rr-picker-list:empty { display: none; }
.rr-picker-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; font: inherit; font-weight: 400; cursor: pointer; }
.rr-picker-item:hover, .rr-picker-item:focus { background: var(--orange-100); }
.rr-picker-empty { padding: 8px 10px; }
.rr-picked { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 400; font-size: 13px; margin-top: 4px; }
.rr-picked:empty { display: none; }
@media (max-width: 1100px) { .rr-layout { grid-template-columns: 220px minmax(0, 1fr); } }
@media (max-width: 860px) {
  .rr-layout { grid-template-columns: minmax(0, 1fr); }
  .rr-aside { position: static; padding: 0; border: 0; box-shadow: none; background: none; max-height: none; }
  .rr-nav { display: none; }
  .rr-nav-select { display: block; }
  .rr-filter-actions { margin-left: 0; }
}
.rr-table-card td[data-label="Particulars"], .rr-table-card td[data-label="Details"], .rr-table-card td[data-label="Renewal History"], .rr-table-card td[data-label="Repledge History"] { min-width: 240px; }
.rr-table-card td[data-label="Reference"], .rr-table-card td[data-label="Transaction Reference"] { white-space: nowrap; }

/* ---------- Loan Calculator ---------- */
.lc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.lc-suffix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.lc-suffix:focus-within { border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(242,140,40,.18); }
.lc-suffix .input { border: 0; box-shadow: none !important; }
.lc-suffix span { padding: 0 12px; color: var(--muted); font-size: 13px; white-space: nowrap; border-left: 1px solid var(--line); }
.lc-summary-card { margin-bottom: 16px; }
.lc-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 12px; }
.lc-card { border-radius: var(--radius); padding: 18px; border: 1px solid var(--line); background: var(--surface-2); min-width: 0; }
.lc-card-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lc-card-value { font-size: 28px; font-weight: 800; color: var(--navy-800); font-variant-numeric: tabular-nums; margin-top: 6px; overflow-wrap: anywhere; }
.lc-words { font-size: 12px; color: var(--orange-600); margin-top: 4px; }
.lc-card-sub { font-size: 12px; color: var(--muted); margin-top: 8px; }
.lc-interest { background: var(--orange-100); border-color: #f6cfa5; }
.lc-total { background: var(--navy-800); border-color: var(--navy-800); }
.lc-total .lc-card-label, .lc-total .lc-card-sub { color: rgba(255,255,255,.72); }
.lc-total .lc-card-value { color: #fff; }
.lc-total .lc-words { color: #ffd2a3; }
.lc-hist-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@media (max-width: 860px) { .lc-grid { grid-template-columns: minmax(0, 1fr); } .lc-summary { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .lc-grid .form-grid.cols-3, .lc-grid .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr); } .lc-card-value { font-size: 24px; } }

/* ---------- calendar popup (date fields) ---------- */
.cal-pop { position: fixed; z-index: 1000; width: 288px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px; font-size: 13px; }
.cal-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.cal-sel { flex: 1; height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; padding: 0 6px; color: var(--text); }
.cal-nav { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 18px; line-height: 1; cursor: pointer; color: var(--navy-800); }
.cal-nav:hover, .cal-day:hover { background: var(--orange-100); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day { height: 34px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; cursor: pointer; color: var(--text); font-variant-numeric: tabular-nums; }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--orange-500); font-weight: 700; }
.cal-day.sel { background: var(--orange-500); color: #fff; font-weight: 700; }
.cal-day:disabled { color: var(--line); cursor: not-allowed; background: none; text-decoration: line-through; } /* v1.67 backdated entry not allowed */
.cal-foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; border-top: 1px solid var(--line-2, var(--line)); padding-top: 8px; }
.lc-method { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; font-size: 13px; padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--line); }
.lc-method-label { color: var(--muted); }
.nowrap { white-space: nowrap; }
.lc-history .table th, .lc-history .table td { padding-left: 8px; padding-right: 8px; } .lc-history .table th { letter-spacing: 0; font-size: 11.5px; }
.lc-summary-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lc-rate { background: #ecfdf3; border-color: #b7e4c7; }
.lc-rate .lc-card-value { color: #166534; }
.lc-readonly { background: var(--surface-2); }
.lc-readonly .input { background: transparent; }
@media (max-width: 1200px) { .lc-summary-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .lc-summary-4 { grid-template-columns: minmax(0, 1fr); } }
.lc-history .table td:last-child, .lc-history .table th:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -6px 0 8px -6px rgba(15,39,71,.18); z-index: 1; } .lc-history .table th:last-child { background: var(--surface-2); z-index: 2; }

/* ---------- Finance company banner, pledge card serial ---------- */
.co-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--orange-500); border-radius: var(--radius); box-shadow: var(--shadow); }
.co-banner-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; flex: none; }
.co-banner-name { font-size: 22px; font-weight: 800; color: var(--navy-800); line-height: 1.15; overflow-wrap: anywhere; }
.co-banner-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.co-banner-sub:empty { display: none; }
.brand-logo-custom { object-fit: contain; background: #fff; }
.card-serial { color: #c00000; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.card-serial-input { color: #c00000 !important; font-weight: 700; letter-spacing: .08em; }
.logo-field { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 72px; height: 72px; border: 1px dashed var(--line); border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--surface-2); overflow: hidden; font-size: 11px; color: var(--muted); text-align: center; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.np-preview { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; font-weight: 700; color: var(--navy-800); letter-spacing: .04em; }
.np-preview.red { color: #c00000; }
.settings-save-bar { position: static; display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 12px 16px; margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); flex-wrap: wrap; }
.settings-save-bar .notice { flex: 1 1 260px; margin: 0; }
.notice-success { background: #ecfdf3; color: #166534; }

/* ---------- Settings: Access & Data ---------- */
.sa-grid { max-width: 520px; }
.btn-outline { border-color: var(--navy-700, #1f3b63); color: var(--navy-800); }
.danger-zone { background: #fff5f5; border: 1.5px solid #f3b4ae; margin-top: 16px; }
.danger-zone .dz-title { color: var(--danger); margin: 0 0 6px; font-size: 17px; }
.danger-zone p { color: #8f1d14; margin: 0 0 10px; }
.dz-box { border: 1px dashed #e8a29b; border-radius: var(--radius-sm); padding: 12px; background: #fff; display: grid; gap: 8px; max-width: 560px; }
.dz-box strong { color: var(--danger); }
.dz-box p { margin: 0; color: var(--text); }
.dz-box code { background: #fde8e6; color: var(--danger); padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.dz-box .btn-danger { justify-self: start; }
.dz-box .btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.danger-zone .notice { margin-top: 10px; }
.spin-dark { width: 14px; height: 14px; border-width: 2px; vertical-align: middle; }

/* ---------- New Loan Entry: full-width layout, cash balance on top ---------- */
.page[data-module="new-loan"] { max-width: none; }
.entry-wide { display: flex; flex-direction: column; gap: 16px; }
.bal-top { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2.4fr); gap: 14px; align-items: stretch; }
.bal-top .bal-card { display: flex; flex-direction: column; justify-content: center; }
.bal-top .bal-value { font-size: 30px; }
.bal-top .bal-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 18px; align-content: center; padding: 14px 18px; }
.bal-top .bal-sum > div { flex-direction: column; justify-content: flex-start; gap: 2px; }
.bal-top .bal-sum strong { font-size: 18px; }
.bal-top .bal-sum .words { grid-column: 1 / -1; order: 9; }
.bal-top > .notice { grid-column: 1 / -1; margin: 0; }
.entry-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.entry-wide .items-table { table-layout: fixed; width: 100%; min-width: 900px; }
.entry-wide .items-table th:nth-child(1) { width: 52px; }
.entry-wide .items-table th:nth-child(2) { width: auto; }
.entry-wide .items-table th:nth-child(3) { width: 150px; }
.entry-wide .items-table th:nth-child(4) { width: 12%; }
.entry-wide .items-table th:nth-child(5), .entry-wide .items-table th:nth-child(6) { width: 11%; }
.entry-wide .items-table th:nth-child(7) { width: 12%; }
.entry-wide .items-table th:nth-child(8) { width: 12%; }
.entry-wide .items-table th:nth-child(9) { width: 44px; }
.entry-wide .items-table .input, .entry-wide .items-table select.input, .entry-wide .items-table td:nth-child(2) .input { min-width: 0; width: 100%; }
.entry-wide .items-table .qty-cell { min-width: 0; }
.entry-wide .items-table .qty-cell .qty-num { width: 52px; flex: none; padding: 0 6px; }
.entry-wide .items-table .qty-cell select.input { flex: 1 1 auto; min-width: 74px; width: 74px; padding: 0 22px 0 8px; background-position: right 6px center; }
.entry-wide .sticky-actions { padding: 12px 0; }
.entry-wide .loan-form { padding-bottom: 4px; }
@media (max-width: 1100px) {
  .bal-top { grid-template-columns: 1fr; }
  .bal-top .bal-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .entry-wide .items-table { min-width: 0; table-layout: auto; }
}
@media (max-width: 560px) {
  .bal-top .bal-sum { grid-template-columns: 1fr 1fr; }
  .bal-top .bal-value { font-size: 26px; }
}
.bal-top { width: 100%; }
.entry-wide .sticky-actions { position: static; border-top: 1px solid var(--line); background: transparent; }

/* ---------- Branch & User Management (v1.0) ---------- */
.branch-off { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--warning-bg); color: var(--warning); }
tr.row-muted td { opacity: .72; }
.auth-link { background: none; border: 0; padding: 0; color: var(--navy-600); text-decoration: underline; cursor: pointer; font: inherit; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.code-input { letter-spacing: .25em; text-transform: uppercase; font-family: ui-monospace, Consolas, monospace; }

/* ---------- Bank Loans (repledging history on a gold loan) ---------- */
.bank-loans { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 6px; }
.bl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bank-loans .stat-grid { margin: 10px 0 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.bl-list { display: flex; flex-direction: column; gap: 8px; }
.bl-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.bl-item.is-active { border-left: 4px solid var(--success); }
.bl-item.is-released { border-left: 4px solid var(--line); background: var(--surface-2); }
.bl-sum { display: grid; grid-template-columns: 28px minmax(110px, 1.3fr) minmax(150px, 1.4fr) repeat(4, minmax(90px, 1fr)) auto; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; list-style: none; font-size: 13.5px; }
.bl-sum::-webkit-details-marker { display: none; }
.bl-sum .num { text-align: right; }
.bl-n { width: 24px; height: 24px; border-radius: 50%; background: var(--navy-100); color: var(--navy-700); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.bl-bank { display: flex; flex-direction: column; }
.bl-body { padding: 4px 14px 14px; border-top: 1px dashed var(--line); }
@media (max-width: 900px) {
  .bl-sum { grid-template-columns: 28px 1fr auto; }
  .bl-sum > .bl-dates, .bl-sum > .num { grid-column: 2 / 4; text-align: left; }
}
/* keep wide content (tables, tiles) inside the dialog on phones instead of widening it */
.overlay { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal, .modal-body { min-width: 0; }
@media (max-width: 560px) { .bank-loans .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .bank-loans .stat-ic { display: none; } .bl-head .btn { width: 100%; } }

/* ---------- Pending Tasks / Loan Closure Alerts ---------- */
.dash-tasks { margin-bottom: 16px; }
.tasks-card.has-open { border-left: 4px solid var(--danger); }
.tasks-table td { vertical-align: top; }
.tasks-table td:nth-child(5) { min-width: 220px; }
.tasks-table td:nth-child(6) { min-width: 200px; }
.notice[role=alert] { flex-direction: column; gap: 4px; }
.tasks-table .row-actions { flex-direction: column; align-items: stretch; min-width: 110px; }
.tasks-table td:nth-child(5) { min-width: 200px; } .tasks-table td:nth-child(6) { min-width: 180px; }

/* ---------- Loan closure summary ---------- */
.sum-table td.num { text-align: right; white-space: nowrap; }
.sum-table tr.sum-sub td { border-top: 1px solid var(--line); font-weight: 600; }
.sum-table tr.sum-total td { background: var(--navy-100); font-size: 15px; }

/* ---------- Pledge card preview ---------- */
.pc-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.pc-opt { display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.pc-stage { background: #e6eaf0; border-radius: var(--radius-sm); padding: 12px 8px; overflow: hidden; max-height: calc(64vh / var(--zf, 1)); overflow-y: auto; }
.pc-paper { background: #fff; box-shadow: 0 2px 10px rgba(10, 28, 53, .18); box-sizing: border-box; margin: 0 0 12px; transform-origin: top left; }
.pc-paper .rcpt { max-width: none; }

/* ---------- Administrator menu: Branch operations group ---------- */
.nav-group { margin-top: 8px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 6px; }
.nav-group-head { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: rgba(255,255,255,.55); font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 8px 14px; cursor: pointer; }
.nav-group-head:hover { color: #fff; }
.nav-chev { transition: transform .15s; display: inline-flex; }
.nav-group:not(.open) .nav-chev { transform: rotate(-90deg); }
.nav-group:not(.open) .nav-group-body { display: none; }
body.nav-collapsed .nav-group-head { justify-content: center; padding: 8px 4px; }
body.nav-collapsed .nav-group-head .nav-label { display: none; }
/* permission grid */
.perm-grid th, .perm-grid td { text-align: center; white-space: nowrap; }
.perm-grid th:first-child, .perm-grid td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.perm-grid input[type=checkbox] { width: 16px; height: 16px; }
.perm-grid tr.changed td { background: var(--warning-bg); }
.mod-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 12px; }
.overview-table td.num, .overview-table th.num { text-align: right; }

/* ---------- password show / hide, recovery pop-up ---------- */
.pw-wrap { position: relative; display: flex; }
.pw-wrap .input { flex: 1; padding-right: 42px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 6px; cursor: pointer; display: inline-flex; border-radius: 6px; }
.pw-eye:hover { color: var(--text); background: var(--surface-2); }
.rec-steps { display: flex; gap: 6px; margin-bottom: 12px; }
.rec-steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.rec-steps span.on { background: var(--orange-500); }
.rec-form { display: flex; flex-direction: column; gap: 10px; }
.pin-input input { letter-spacing: .4em; font-size: 18px; text-align: center; }

/* ---------- v1.9 Manual Gold Loan Number ---------- */
.gln { display: grid; gap: 8px; }
.gln-prev { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2, #f6f8fb); }
.gln-prev-label { font-size: 12px; color: var(--muted, #5b6675); font-weight: 600; letter-spacing: .02em; }
.gln-prev-value { font-size: 22px; font-weight: 700; color: #15803d; margin: 2px 0; letter-spacing: .03em; }
.gln-prev-value.none { color: var(--muted, #5b6675); font-size: 16px; }
.gln-prev-value.next { color: var(--accent, #0f2747); }
.gln-prev-sub { font-size: 12px; color: var(--muted, #5b6675); }
.gln-label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.gln-input { font-size: 18px; letter-spacing: .04em; text-transform: uppercase; }
.gln-status { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; min-height: 18px; }
.gln-status .gln-ic { flex: 0 0 auto; margin-top: 1px; }
.gln-ok { color: #15803d; font-weight: 600; } .gln-warn { color: #b45309; font-weight: 600; } .gln-error { color: #b91c1c; font-weight: 600; } .gln-info { color: var(--muted, #5b6675); }
.gln-req { font-size: 12.5px; border-radius: 8px; padding: 8px 10px; border: 1px solid #f59e0b; background: #fffbeb; }
.gln-req-approved { border-color: #16a34a; background: #f0fdf4; } .gln-req-rejected { border-color: #dc2626; background: #fef2f2; }
.gln-req .btn-row { margin-top: 6px; }
.gln-field { grid-column: span 2; }
.gln-pop { border: 1px solid #d97706; border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.gln-pop-head { color: #d97706; } .gln-pop-exp { font-weight: 700; margin: 0; } .gln-pop p { margin: 0; }
.gln-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 10px; }
@media (max-width: 720px) { .gln-field { grid-column: auto; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gln-req { background: #3a2a08; } :root:not([data-theme="light"]) .gln-req-approved { background: #0f2e1a; } :root:not([data-theme="light"]) .gln-req-rejected { background: #3a1010; } :root:not([data-theme="light"]) .gln-prev-value { color: #4ade80; } }
:root[data-theme="dark"] .gln-req { background: #3a2a08; } :root[data-theme="dark"] .gln-prev-value { color: #4ade80; }

/* ---------- Add Bank Loan: linked gold loan summary ---------- */
.bl-link { border: 2px solid #f28c28; border-radius: 12px; background: linear-gradient(180deg, #fff7ed, var(--surface, #fff)); padding: 12px 14px; margin-bottom: 10px; }
.bl-link-main { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: flex-end; padding-bottom: 10px; border-bottom: 1px dashed #f5b77a; }
.bl-link-key { display: grid; gap: 2px; }
.bl-link-key > span { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #9a4b07; }
.bl-link-key strong { font-size: 26px; line-height: 1.1; color: #0f2747; letter-spacing: .03em; }
.bl-link-amt strong { color: #15803d; font-variant-numeric: tabular-nums; }
.bl-link-key em { font-style: normal; font-size: 12px; color: var(--muted, #6b7a90); }
.bl-link-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; padding-top: 8px; }
.bl-link-item { display: grid; gap: 1px; min-width: 0; }
.bl-link-item span { font-size: 11px; color: var(--muted, #6b7a90); }
.bl-link-item b { font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .bl-link-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bl-link-key strong { font-size: 21px; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bl-link { background: #2a1a08; border-color: #c26a0d; } :root:not([data-theme="light"]) .bl-link-key strong { color: #f8fafc; } :root:not([data-theme="light"]) .bl-link-amt strong { color: #4ade80; } :root:not([data-theme="light"]) .bl-link-key > span { color: #fdba74; } }
:root[data-theme="dark"] .bl-link { background: #2a1a08; border-color: #c26a0d; } :root[data-theme="dark"] .bl-link-key strong { color: #f8fafc; } :root[data-theme="dark"] .bl-link-amt strong { color: #4ade80; } :root[data-theme="dark"] .bl-link-key > span { color: #fdba74; }
/* keep the linked loan in view while scrolling the bank loan form (wider screens) */
@media (min-width: 700px) and (min-height: 640px) { .modal-body .bl-link { position: sticky; top: -16px; z-index: 2; box-shadow: 0 6px 14px -10px rgba(15, 39, 71, .35); } }

/* ---------- v1.12.1 Loan View summary and loan profit ---------- */
.view-top .lv-no { font-size: 20px; font-weight: 800; color: var(--text, #0f2747); letter-spacing: .03em; margin-right: 4px; }
.lv-summary { display: grid; grid-template-columns: 1.35fr .8fr .8fr 1.1fr 1.35fr; gap: 10px; margin: 10px 0 14px; }
.lv-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2, #f8fafc); display: grid; gap: 3px; align-content: start; min-width: 0; }
.lv-label { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted, #6b7a90); }
.lv-value { font-size: 19px; font-variant-numeric: tabular-nums; color: var(--text, #0f2747); }
.lv-sub { font-size: 11.5px; color: var(--muted, #6b7a90); overflow-wrap: anywhere; }
.lv-key { border: 2px solid #0f2747; background: var(--surface, #fff); }
.lv-key .lv-value { font-size: 24px; }
.lv-out { border-color: #f28c28; background: #fff7ed; }
.lv-out .lv-value { color: #b45309; }
@media (max-width: 900px) { .lv-summary { grid-template-columns: 1fr 1fr; } .lv-key { grid-column: span 2; } }
.lp-wrap { display: grid; gap: 10px; }
.lp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .lp-grid { grid-template-columns: 1fr; } }
.lp-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface, #fff); border-top: 4px solid #15803d; display: grid; gap: 2px; align-content: start; }
.lp-card.lp-bank { border-top-color: #c2410c; }
.lp-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.lp-card h4 { margin: 0; font-size: 15px; color: #15803d; }
.lp-card.lp-bank h4 { color: #c2410c; }
.lp-card header span { font-size: 11.5px; color: var(--muted, #6b7a90); }
.lp-line { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.lp-line span small { display: block; font-size: 11px; color: var(--muted, #6b7a90); }
.lp-line b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lp-line.lp-sum { border-bottom: 0; border-top: 2px solid var(--line); margin-top: 4px; padding-top: 8px; font-weight: 700; font-size: 15px; }
.lp-finance .lp-sum b { color: #15803d; } .lp-bank .lp-sum b { color: #c2410c; }
.lp-note { margin: 6px 0 0; font-size: 12px; color: var(--muted, #6b7a90); }
.lp-banks { margin-top: 8px; }
.lp-result { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; border-radius: 14px; padding: 14px 18px; border: 2px solid var(--line); background: var(--surface-2, #f8fafc); }
.lp-result.gain { border-color: #16a34a; background: #f0fdf4; } .lp-result.loss { border-color: #dc2626; background: #fef2f2; }
.lp-result-calc { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lp-result-calc > div { display: grid; } .lp-result-calc span, .lp-result-val span { font-size: 11.5px; color: var(--muted, #6b7a90); text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
.lp-result-calc b { font-size: 16px; font-variant-numeric: tabular-nums; }
.lp-op { font-size: 22px; font-weight: 700; color: var(--muted, #6b7a90); }
.lp-result-val { display: grid; text-align: right; }
.lp-result-val strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.lp-result.gain .lp-result-val strong { color: #15803d; } .lp-result.loss .lp-result-val strong { color: #b91c1c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lv-out { background: #2a1a08; } :root:not([data-theme="light"]) .lv-out .lv-value { color: #fdba74; } :root:not([data-theme="light"]) .lv-key { border-color: #94a3b8; } :root:not([data-theme="light"]) .lp-result.gain { background: #0f2e1a; } :root:not([data-theme="light"]) .lp-result.loss { background: #3a1010; } :root:not([data-theme="light"]) .lp-result.gain .lp-result-val strong, :root:not([data-theme="light"]) .lp-finance .lp-sum b, :root:not([data-theme="light"]) .lp-card h4 { color: #4ade80; } :root:not([data-theme="light"]) .lp-card.lp-bank h4, :root:not([data-theme="light"]) .lp-bank .lp-sum b { color: #fb923c; } :root:not([data-theme="light"]) .lp-result.loss .lp-result-val strong { color: #f87171; } }
:root[data-theme="dark"] .lv-out { background: #2a1a08; } :root[data-theme="dark"] .lv-out .lv-value { color: #fdba74; } :root[data-theme="dark"] .lp-result.gain { background: #0f2e1a; } :root[data-theme="dark"] .lp-result.loss { background: #3a1010; }
@media (max-width: 560px) { .lp-result { display: grid; } .lp-result-calc { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; } .lp-op { display: none; } .lp-result-val { text-align: left; border-top: 1px dashed currentColor; padding-top: 8px; } .lp-result-val strong { font-size: 24px; } }
@media (max-width: 560px) { .lp-result-calc > .lp-op { display: none; } }
@media (max-width: 900px) { .lv-summary .lv-item:nth-child(4) { grid-column: span 2; } }

/* ---------- v1.13 PDF viewer (View PDF) ---------- */
.pdfv-overlay { z-index: 120; padding: 12px; }
.pdfv { width: 100%; max-width: 1180px; height: calc((100vh / var(--zf, 1)) - 24px); height: calc((100dvh / var(--zf, 1)) - 24px); display: flex; flex-direction: column; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; min-width: 0; }
.pdfv-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); min-width: 0; }
.pdfv-badge { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #fff; background: var(--danger); border-radius: 5px; padding: 3px 7px; }
.pdfv-title { flex: 1; min-width: 0; font-size: 15px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdfv-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.pdfv-grp { display: flex; align-items: center; gap: 4px; }
.pdfv-acts { gap: 6px; }
.pdfv-btn { min-width: 34px; justify-content: center; font-size: 16px; line-height: 1; }
.pdfv-btn.active { background: var(--navy-100); }
.pdfv-pageno { width: 56px; text-align: center; padding: 5px 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 13px; }
.pdfv-count, .pdfv-zoom { font-size: 13px; color: var(--text-2); min-width: 44px; text-align: center; }
.pdfv-notice { padding: 8px 14px; font-size: 13px; background: var(--warning-bg); color: var(--warning); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.pdfv-notice[hidden] { display: none; }
.pdfv-body { flex: 1; min-height: 0; overflow: auto; background: #525659; padding: 16px; outline: none; -webkit-overflow-scrolling: touch; }
.pdfv-page { position: relative; margin: 0 auto 16px; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.pdfv-page img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.pdfv-page-err img { visibility: hidden; }
.pdfv-page-errmsg { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; padding: 20px; color: var(--text-2); font-size: 14px; }
.pdfv-state { max-width: 440px; margin: calc(10vh / var(--zf, 1)) auto 0; background: var(--surface); border-radius: 12px; padding: 28px 24px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.pdfv-state-text { margin: 0; font-weight: 600; font-size: 15px; color: var(--text); }
.pdfv-state p { margin: 0; }
.pdfv-spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--navy-100); border-top-color: var(--navy-700); animation: pdfv-spin .8s linear infinite; }
@keyframes pdfv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pdfv-spinner { animation-duration: 2.4s; } }
.pdfv-progress { width: 100%; height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.pdfv-progress-fill { height: 100%; width: 0; background: var(--orange-500); transition: width .2s; }
.pdfv-error .pdfv-err-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--danger-bg); color: var(--danger); font-weight: 800; font-size: 22px; display: grid; place-items: center; }
.pdfv-state-acts { display: flex; gap: 8px; margin-top: 6px; }
.pc-pdf { display: flex; gap: 6px; align-items: flex-end; }
.pdfpol { display: grid; gap: 10px; margin: 10px 0 14px; }
.pdfpol-opt { display: flex; gap: 10px; align-items: flex-start; }
.pdfpol-opt input { margin-top: 3px; }
.pdfpol-opt > span { display: grid; gap: 2px; }
@media (max-width: 640px) {
  .pdfv-overlay { padding: 0; }
  .pdfv { height: calc(100vh / var(--zf, 1)); height: calc(100dvh / var(--zf, 1)); border-radius: 0; }
  .pdfv-body { padding: 8px; }
  .pdfv-page { margin-bottom: 8px; }
  .pdfv-bar { padding: 6px 8px; gap: 6px; justify-content: center; }
  .pdfv-acts { width: 100%; justify-content: stretch; }
  .pdfv-acts .btn { flex: 1; }
  .pdfv-zoom { min-width: 38px; }
}
@media print { .pdfv-overlay { display: none !important; } }

/* ---------- v1.14 Day Book ledgers ---------- */
.row-pending td { background: var(--warning-bg); color: var(--text-2); font-style: italic; }
.db-ledger-note { margin: 10px 0 12px; max-width: 980px; }
.db-type-note { margin: 4px 0 10px; }
.db-accrued { margin: 4px 0 14px; }
.db-accrued > summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 6px 0; color: var(--navy-700); }
.db-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 8px; }

/* ---------- v1.15 Asset & Liabilities colours (red = Finance Loan, green = Bank Loan) ---------- */
.al-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; color: var(--text-2); }
.al-key { display: inline-flex; align-items: center; gap: 8px; }
.al-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.al-swatch.al-fin { background: #b91c1c; } .al-swatch.al-bank { background: #15803d; }
.al-legend b { color: var(--text); font-weight: 600; }
.al-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.al-chip.al-fin { color: #a61b1b; background: #fdecea; }
.al-chip.al-bank { color: #11643a; background: #e6f4ec; }
/* v1.15 Day Book: debit = red, credit = green (by direction); running balance stays neutral */
.db-dr { color: #b42318; font-weight: 600; font-variant-numeric: tabular-nums; }
.db-cr { color: #18794e; font-weight: 600; font-variant-numeric: tabular-nums; }
.db-bal { color: var(--text); }

/* ---------- v1.15 Reports & Returns: report headings across the top, full width ---------- */
.rr-layout.rr-top { display: block; }
.rr-top > .rr-nav { position: sticky; top: var(--topbar-h); z-index: 5; background: var(--bg); padding: 0 0 10px; margin-bottom: 4px; }
.rr-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); scrollbar-width: thin; }
.rr-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; padding: 8px 14px; border-radius: var(--radius-sm); font: inherit; font-size: 14px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.rr-tab:hover { background: var(--surface-2); color: var(--text); }
.rr-tab.active { background: var(--orange-100); border-color: #f6c79a; color: var(--navy-800); font-weight: 600; }
.rr-tab.active .rr-no { background: var(--orange-500); border-color: var(--orange-500); color: #fff; }
.rr-top .rr-main { gap: 12px; }
.rr-summary { background: linear-gradient(0deg, #fff7ed, #fff7ed); border: 2px solid var(--orange-500); border-radius: var(--radius); padding: 14px 16px; }
.rr-summary h3 { margin: 0 0 10px; font-size: 15px; color: var(--navy-800); }
.rr-sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.rr-sum-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.rr-sum-item .k { font-size: 12.5px; color: var(--text-2); }
.rr-sum-item .v { font-size: 18px; font-weight: 700; color: var(--navy-800); font-variant-numeric: tabular-nums; margin-top: 2px; }
.rr-sum-item .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
@media (max-width: 900px) { .rr-top > .rr-nav { display: block; position: static; } .rr-tab { padding: 7px 11px; font-size: 13px; } }

/* ---------- v1.15 Global Search (header) ---------- */
.gs { position: relative; flex: 1 1 360px; max-width: 520px; min-width: 0; margin-left: 8px; }
.gs-toggle, .gs-back { display: none; }
.gs-box { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 8px 0 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 19px; }
.gs-box:focus-within { border-color: var(--navy-600); background: var(--surface); box-shadow: 0 0 0 3px rgba(36, 73, 127, .15); }
.gs-ic { color: var(--muted); display: grid; }
.gs-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 14px; color: var(--text); }
.gs-input::-webkit-search-cancel-button { display: none; }
.gs-clear { border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; padding: 4px; border-radius: 50%; }
.gs-clear:hover { background: var(--line-2); color: var(--text); }
.gs-panel { position: absolute; top: calc(100% + 6px); left: 0; width: min(720px, calc((100vw / var(--zf, 1)) - 32px)); max-height: min((70vh / var(--zf, 1)), 620px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 60; padding: 10px; }
.gs-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.gs-filter { width: auto; min-width: 150px; height: 34px; font-size: 13px; padding: 4px 8px; }
.gs-hint { margin-left: auto; }
.gs-info { padding: 4px 4px 8px; }
.gs-list { display: flex; flex-direction: column; gap: 6px; }
.gs-item { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 9px 12px; font: inherit; color: var(--text); cursor: pointer; }
.gs-item:hover, .gs-item:focus { border-color: var(--orange-500); background: #fffaf4; outline: none; }
.gs-row1, .gs-row2, .gs-row3 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.gs-row2 { margin-top: 3px; font-size: 13.5px; }
.gs-row3 { margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.gs-row3 b { color: var(--text); font-variant-numeric: tabular-nums; }
.gs-gl { font-size: 15px; color: var(--navy-800); }
.gs-branch { font-size: 12.5px; color: var(--text-2); }
.gs-why { margin-left: auto; }
.gs-banks { margin-top: 6px; display: grid; gap: 3px; font-size: 12.5px; }
.gs-bank-tag { display: inline-block; font-size: 10.5px; font-weight: 700; color: #11643a; background: #e6f4ec; border-radius: 4px; padding: 1px 6px; margin-right: 6px; }
@media (max-width: 760px) {
  .gs { flex: 0 0 auto; margin-left: auto; max-width: none; }
  .gs-toggle { display: grid; }
  .gs-box { display: none; }
  .gs.gs-expanded { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); background: var(--surface); padding: 11px 10px; z-index: 70; border-bottom: 1px solid var(--line); margin: 0; }
  .gs.gs-expanded .gs-toggle { display: none; }
  .gs.gs-expanded .gs-box { display: flex; }
  .gs.gs-expanded .gs-back { display: grid; }
  .gs-panel { position: fixed; top: var(--topbar-h); left: 8px; right: 8px; width: auto; max-height: calc((100vh / var(--zf, 1)) - var(--topbar-h) - 16px); }
  .gs-why { margin-left: 0; width: 100%; }
}
.nw { white-space: nowrap; }

/* ---------- v1.16 Daybook Difference Analyser / report ---------- */
.da-out { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.da-detail { display: flex; flex-direction: column; gap: 12px; }
.da-table tfoot td { font-weight: 700; background: var(--surface-2); }
.da-table tr.da-unexp td { background: var(--danger-bg); color: var(--danger); }
tr.da-total-row td { font-weight: 700; background: var(--surface-2); }
.da-summary { border: 2px solid var(--orange-500); background: #fff7ed; border-radius: var(--radius); padding: 14px 16px; }
.da-summary.da-reconciled { border-color: #18794e; background: #f0faf4; }
.da-summary.da-unreconciled { border-color: var(--danger); background: #fff5f4; }
.da-sum-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.da-summary h3 { margin: 0; font-size: 15px; color: var(--navy-800); }
.da-sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.da-sum-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.da-sum-item .k { font-size: 12.5px; color: var(--text-2); }
.da-sum-item .v { font-size: 18px; font-weight: 700; color: var(--navy-800); font-variant-numeric: tabular-nums; margin-top: 2px; }
.da-sum-item .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.da-entries > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--navy-700); padding: 8px 0 4px; }
.db-checks { margin: 6px 0 0 18px; padding: 0; font-size: 13px; } .db-checks li { margin: 2px 0; }

/* ---------- v1.18 Financial Analyser — six main indicators ---------- */
.fa-quick { align-self: flex-end; }
.fa6 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.fa6-card { position: relative; text-align: left; font: inherit; color: var(--text); border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: var(--radius); background: linear-gradient(0deg, var(--bg-c), var(--bg-c)); padding: 14px 16px 14px 18px; box-shadow: var(--shadow); min-height: 118px; display: flex; flex-direction: column; gap: 4px; }
button.fa6-card { cursor: pointer; } button.fa6-card:hover { box-shadow: var(--shadow-lg); }
.fa6-no { position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.fa6-label { font-size: 13px; font-weight: 600; color: var(--text-2); padding-right: 26px; }
.fa6-value { font-size: 26px; font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; line-height: 1.15; }
.fa6-sub { font-size: 12px; color: var(--muted); }
.fa6-blue { --c: #1d4ed8; --bg-c: #eef4ff; }
.fa6-green { --c: #15803d; --bg-c: #effaf3; }
.fa6-orange { --c: #c2410c; --bg-c: #fff4ea; }
.fa6-purple { --c: #7c3aed; --bg-c: #f5f0ff; }
.fa6-slate { --c: #475569; --bg-c: #f1f5f9; }
.fa6-oca { --c: #ffffff; --bg-c: #14532d; color: #fff; border-color: #14532d; border-left-color: #f59e0b; box-shadow: 0 6px 20px rgba(20, 83, 45, .35); }
.fa6-oca .fa6-label, .fa6-oca .fa6-sub { color: #d1fae5; }
.fa6-oca .fa6-no { background: #f59e0b; }
@media (max-width: 1000px) { .fa6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .fa6 { grid-template-columns: minmax(0, 1fr); } .fa6-value { font-size: 23px; } }

/* ---------- v1.19 Difference Amount Breakdown ---------- */
.da-break tfoot td { font-weight: 700; background: var(--surface-2); }
.da-break tfoot tr.da-ok td { background: #effaf3; color: #15803d; }
.da-break tfoot tr.da-unexp td { background: var(--danger-bg); color: var(--danger); }
.fa-break-one { grid-template-columns: minmax(0, 1fr) !important; max-width: 640px; }
.da-checks { margin: 6px 0 0 18px; padding: 0; font-size: 13.5px; } .da-checks li { margin: 3px 0; }

/* ---------- v1.20 Daily Financial Positions ---------- */
.dfp-table td.num, .dfp-table th.num { white-space: nowrap; }
.dfp-table tfoot td { font-weight: 700; background: var(--surface-2); }
.dfp-diff { font-weight: 700; font-variant-numeric: tabular-nums; text-decoration: underline dotted; text-underline-offset: 3px; }
.dfp-diff:hover { text-decoration-style: solid; }
.modal-dfp { max-width: 1040px !important; }
.dfp-day { display: grid; gap: 12px; }
.dfp-day .card { margin: 0; }
.dfp-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.dfp-sum strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.dfp-review { border-left: 4px solid var(--danger); }
.dfp-ok { background: #effaf3; color: #15803d; border-color: #bbe5c8; }
.dfp-void td { color: var(--muted); text-decoration: line-through; }
.dfp-void td .muted { text-decoration: none; }

/* ---------- v1.21 Reports & Returns: one branch, simple colour-coded layout ---------- */
.rr-branchbar { margin-bottom: 10px; border-left: 4px solid var(--orange-500); }
.rr-branchbar .card-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 12px 16px; }
.rr-branch { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--navy-800); }
.rr-branch select { min-width: 260px; font-weight: 600; }
.rr-branchbar p { margin: 0; }
.rr-branch .req { color: var(--danger); }
.rr-output .stat-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.rr-output .stat { border-left: 4px solid var(--line); }
.rr-output .stat-success { border-left-color: #15803d; } .rr-output .stat-success .stat-value { color: #15803d; }
.rr-output .stat-danger { border-left-color: #b91c1c; } .rr-output .stat-danger .stat-value { color: #b91c1c; }
.rr-output .stat-warning { border-left-color: #c2410c; } .rr-output .stat-warning .stat-value { color: #c2410c; }
.rr-output .stat-info { border-left-color: #1d4ed8; } .rr-output .stat-info .stat-value { color: #1d4ed8; }
.rr-table-card .table td span.pos, .rr-table-card .table td span.neg { font-weight: 600; font-variant-numeric: tabular-nums; }
.rr-table-card .table tfoot td { font-weight: 700; background: var(--surface-2); }
@media (max-width: 600px) { .rr-branch { width: 100%; flex-direction: column; align-items: stretch; gap: 4px; } .rr-branch select { min-width: 0; width: 100%; } }
.rr-branch > span { white-space: nowrap; }
.rr-table-card .table th { white-space: normal; line-height: 1.25; }
.rr-table-card .link-btn.nw, .rr-table-card td .nw { white-space: nowrap; }
.rr-table-card td .warn-text.small { display: block; min-width: 150px; max-width: 220px; }

/* ---------- v1.23 custom interest days at closure ---------- */
.field[hidden] { display: none !important; }
.ci-box { margin-top: 12px; padding: 12px 14px; border: 1px dashed #f6c79a; border-radius: var(--radius); background: var(--orange-100); display: grid; gap: 8px; }
.ci-box[hidden] { display: none; }
.ci-head strong { color: var(--navy-800); }
.ci-days { display: flex; flex-wrap: wrap; gap: 8px; }
.ci-day { min-width: 84px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-weight: 600; cursor: pointer; }
.ci-day:hover { border-color: var(--orange-500); }
.ci-day.active { background: var(--orange-500); border-color: var(--orange-500); color: #fff; }
.sum-table tr.muted td { color: var(--muted); font-size: 13px; }

/* =====================================================================================================
   v1.26 — PB FINANCE STANDARD THEME (applies to every page; visual only — no layout logic changes)
   Palette (exact values)
     Brand      Navy 900 #0A1C35 · Navy 800 #0F2747 (headings, sidebar) · Navy 700 #183764 (table headings)
                Navy 600 #24497F (links) · Navy 50 #EEF3FA (soft fills)
     Accent     Orange 600 #C96A0C (hover) · Orange 500 #E8811A (primary buttons, active marks) · Orange 50 #FDF0E1
     Neutrals   Page #F3F5F9 · Card #FFFFFF · Soft #F7F9FC · Border #DCE3ED · Divider #EDF1F6
                Text #16243A · Secondary #4B5B73 · Muted #6B7A90
     Status     Success #157347 on #E7F5EE (border #B7E1CB) · Warning #9A5B00 on #FFF4DE (#F5D9A6)
                Danger #B42318 on #FDECEA (#F3C2BD) · Info #1D4ED8 on #E8EFFD (#C3D3F8)
                Neutral #4B5B73 on #EEF1F5 (#D8DEE8) · Attention (orange) #B45309 on #FFF1E3 (#F6C79A)
     Money      Credit / income / positive #157347 · Debit / expense / negative #B42318
   ===================================================================================================== */
:root {
  --navy-900: #0a1c35; --navy-800: #0f2747; --navy-700: #183764; --navy-600: #24497f; --navy-100: #eef3fa;
  --orange-600: #c96a0c; --orange-500: #e8811a; --orange-100: #fdf0e1;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f9fc; --line: #dce3ed; --line-2: #edf1f6;
  --text: #16243a; --text-2: #4b5b73; --muted: #6b7a90;
  --success: #157347; --success-bg: #e7f5ee; --success-line: #b7e1cb;
  --warning: #9a5b00; --warning-bg: #fff4de; --warning-line: #f5d9a6;
  --danger: #b42318;  --danger-bg: #fdecea;  --danger-line: #f3c2bd;
  --info: #1d4ed8;    --info-bg: #e8effd;    --info-line: #c3d3f8;
  --neutral: #4b5b73; --neutral-bg: #eef1f5; --neutral-line: #d8dee8;
  --attn: #b45309;    --attn-bg: #fff1e3;    --attn-line: #f6c79a;
  --fa-orange: #b45309; --fa-orange-bg: #fff1e3; --fa-green: #157347; --fa-red: #b42318;
  --input-line: #c9d3e1;
  --th-bg: #183764; --th-text: #ffffff; --th-line: #0f2747;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(15, 39, 71, .05), 0 2px 10px rgba(15, 39, 71, .05);
}
body { background: var(--bg); color: var(--text); }
a { color: var(--navy-600); }

/* ---- page headers ---- */
.page-head { padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.page-head h1 { font-size: 22px; font-weight: 700; color: var(--navy-800); letter-spacing: -.01em; }
.page-head p { color: var(--text-2); }

/* ---- cards / boxes ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { background: var(--surface-2); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; padding: 12px 18px; }
.card-head h2 { font-size: 15px; font-weight: 700; color: var(--navy-800); }
.card-body { padding: 16px 18px; }
.calc-box, .closure-summary { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }

/* ---- buttons ---- */
.btn { height: 36px; padding: 0 16px; border-radius: var(--radius-sm); font-weight: 600; letter-spacing: .01em; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(232, 129, 26, .35); }
.btn-primary { background: var(--orange-500); border-color: var(--orange-500); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--orange-600); border-color: var(--orange-600); }
.btn-ghost { background: var(--surface); border-color: var(--input-line); color: var(--navy-800); }
.btn-ghost:hover:not(:disabled) { background: var(--navy-100); border-color: #b7c4d8; }
.btn-outline { background: var(--surface); border-color: var(--navy-700); color: var(--navy-800); }
.btn-outline:hover:not(:disabled) { background: var(--navy-800); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8f1b12; border-color: #8f1b12; }
.btn-danger-ghost { background: var(--surface); border-color: var(--danger-line); color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-bg); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; }
.btn:disabled { opacity: .5; }
.link-btn { color: var(--orange-600); }
.link-btn:hover { color: var(--navy-800); text-decoration: underline; }

/* ---- form fields ---- */
.input { height: 38px; border: 1px solid var(--input-line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
textarea.input { height: auto; padding: 8px 11px; }
.input:hover:not(:focus):not([readonly]):not(:disabled) { border-color: #a9b8cd; }
.input:focus { border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(232, 129, 26, .18); }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.input::placeholder { color: #9aa7b8; }
.input.invalid, .has-err .input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, .12); }
.field label, .filter > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-hint { color: var(--muted); }
.field-err { color: var(--danger); font-weight: 600; }

/* ---- tables: one heading style everywhere ---- */
.dt-scroll { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.table th { background: var(--th-bg); color: var(--th-text); border-bottom: 1px solid var(--th-line); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 10px 12px; }
.table th .th-sort, .table th .th-sort .ic { color: var(--th-text); }
.table th .th-sort:hover { color: #ffd9b0; }
.table th[aria-sort] { background: #1f4275; box-shadow: inset 0 -3px 0 var(--orange-500); }
.table thead tr:first-child th:first-child { border-top-left-radius: calc(var(--radius-sm) - 1px); }
.table thead tr:first-child th:last-child { border-top-right-radius: calc(var(--radius-sm) - 1px); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--text); }
.table tbody tr:nth-child(even) td { background: #fafbfd; }
.table tbody tr:hover td { background: var(--navy-100); }
.table tfoot td { background: var(--navy-100); color: var(--navy-800); font-weight: 700; border-top: 2px solid var(--navy-700); }
.table td.dt-empty { background: var(--surface) !important; color: var(--muted); }
/* row states keep their meaning on top of the zebra rows */
.table tbody tr.row-highlight td, .table tbody tr.rr-issue td { background: var(--attn-bg); }
.table tbody tr.row-unexplained td { background: #fff6ef; }
.table tbody tr.row-pending td { background: var(--warning-bg); }
.table tbody tr.row-reversed td { background: var(--surface-2); color: var(--muted); }
.table-compact th { padding: 7px 10px; } .table-compact td { padding: 7px 10px; }
/* summary tables inside forms (closure etc.) are key–value lists, not data grids */
.sum-table td { background: transparent !important; }
.sum-table tr.sum-total td { background: var(--navy-100) !important; color: var(--navy-800); font-weight: 700; }

/* ---- dashboard / summary tiles ---- */
.stat { border: 1px solid var(--line); border-left: 4px solid var(--navy-700); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); padding: 14px 16px; }
.stat-ic { background: var(--navy-100); color: var(--navy-700); border-radius: 9px; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.stat-value { font-size: 20px; font-weight: 700; color: var(--navy-800); }
.stat-sub { color: var(--muted); }
.stat-success { border-left-color: var(--success); } .stat-success .stat-ic { background: var(--success-bg); color: var(--success); } .stat-success .stat-value { color: var(--success); }
.stat-warning { border-left-color: var(--orange-500); } .stat-warning .stat-ic { background: var(--attn-bg); color: var(--attn); } .stat-warning .stat-value { color: var(--attn); }
.stat-danger { border-left-color: var(--danger); } .stat-danger .stat-ic { background: var(--danger-bg); color: var(--danger); } .stat-danger .stat-value { color: var(--danger); }
.stat-info, .stat-primary { border-left-color: var(--info); } .stat-info .stat-ic, .stat-primary .stat-ic { background: var(--info-bg); color: var(--info); } .stat-info .stat-value, .stat-primary .stat-value { color: var(--info); }
.stat-neutral { border-left-color: var(--navy-700); }
.stat-link:hover { border-color: var(--orange-500); box-shadow: 0 4px 16px rgba(15, 39, 71, .10); }

/* ---- status badges ---- */
.badge { border: 1px solid var(--neutral-line); background: var(--neutral-bg); color: var(--neutral); font-weight: 600; padding: 1px 9px; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge-info, .badge-primary { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-line); }
.badge-accent, .badge-orange { background: var(--attn-bg); color: var(--attn); border-color: var(--attn-line); }

/* ---- notices / messages ---- */
.notice { border: 1px solid var(--info-line); border-left: 4px solid var(--info); background: var(--info-bg); color: #1e3a8a; border-radius: var(--radius-sm); }
.notice-success { border-color: var(--success-line); border-left-color: var(--success); background: var(--success-bg); color: #14532d; }
.notice-warn { border-color: var(--warning-line); border-left-color: var(--warning); background: var(--warning-bg); color: #7a4700; }
.notice-orange { border-color: var(--attn-line); border-left-color: var(--orange-500); background: var(--attn-bg); color: #8a3d05; }
.notice-danger { border-color: var(--danger-line); border-left-color: var(--danger); background: var(--danger-bg); color: #8f1b12; }

/* ---- tabs ---- */
.tabs { border-bottom: 1px solid var(--line); gap: 2px; }
.tab { color: var(--text-2); border-bottom: 3px solid transparent; padding: 9px 14px; }
.tab:hover { color: var(--navy-800); background: var(--surface-2); }
.tab.active { color: var(--navy-800); border-bottom-color: var(--orange-500); }
.tab-count { background: var(--navy-100); color: var(--navy-700); }
.rr-tabs { border-color: var(--line); }
.rr-tab.active, .ci-day.active { background: var(--orange-500); border-color: var(--orange-500); color: #fff; }
.rr-tab.active .rr-no { background: #fff; border-color: #fff; color: var(--orange-600); }

/* ---- dialogs ---- */
.modal { border: 1px solid var(--line); }
.modal-head { background: var(--navy-800); border-radius: 12px 12px 0 0; border-bottom: 3px solid var(--orange-500); }
.modal-head h2 { color: #fff; }
.modal-head .icon-btn { color: #dbe4f2; }
.modal-head .icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); color: #fff; }
.modal-foot { background: var(--surface-2); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }

/* ---- sidebar & top bar ---- */
.sidebar { background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); }
.nav-item.active { background: rgba(232, 129, 26, .16); }
.nav-item.active::before, .nav-item.active .nav-ic { background: var(--orange-500); }
.nav-item.active .nav-ic { background: none; color: var(--orange-500); }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }

/* ---- key–value details ---- */
.kv-item dt { color: var(--muted); }
.kv-item dd { color: var(--navy-800); }

/* ---- money colours (same meaning on every page) ---- */
.pos, .db-cr { color: var(--success); } .neg, .db-dr { color: var(--danger); }
.warn-text { color: var(--attn); }
/* headings that are sticky on the side keep the standard heading colour */
.lc-history .table th:last-child, .perm-grid th:first-child { background: var(--th-bg); color: var(--th-text); }
.mini-table th { background: var(--navy-100); color: var(--navy-800); font-weight: 700; }
a.btn, a.btn:hover { text-decoration: none; }
a.btn-primary, a.btn-primary:hover { color: #fff; }

/* ---------- v1.27 Admin Dashboard ---------- */
.ad-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 12px; }
.ad-out { display: flex; flex-direction: column; gap: 16px; }
.ad-avail { display: grid; grid-template-columns: minmax(260px, 1.1fr) 2fr; gap: 14px 22px; align-items: center; padding: 18px 22px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700)); border-left: 6px solid var(--orange-500); box-shadow: var(--shadow); }
.ad-avail-label { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #ffd9b0; }
.ad-avail-value { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; margin: 4px 0; }
.ad-avail-value.neg { color: #ffb3a8; }
.ad-avail-formula { font-size: 13px; color: #dbe4f2; }
.ad-avail-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ad-avail-br { display: grid; gap: 1px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
.ad-avail-br strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.ad-avail-br .muted { color: #c9d5e8; }
.ad-code { font-weight: 800; letter-spacing: .04em; color: #ffd9b0; }
.ad-avail-note { grid-column: 1 / -1; margin: 0; color: #c9d5e8; }
.ad-table th .ad-th-sub { font-size: 10.5px; font-weight: 500; text-transform: none; letter-spacing: 0; opacity: .8; white-space: nowrap; }
.ad-table td, .ad-table th { vertical-align: top; }
.ad-table td.num { font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.ad-sno { width: 52px; color: var(--muted); font-weight: 700; }
.ad-def { font-size: 11.5px; font-weight: 400; color: var(--muted); white-space: normal; }
.ad-table td.num .ad-def { text-align: right; }
.ad-table th.ad-gt { background: var(--navy-900); }
.ad-table td.ad-gt { background: var(--navy-100) !important; color: var(--navy-800); font-weight: 800; }
.ad-row td:first-child { box-shadow: inset 4px 0 0 var(--ad-tone, var(--navy-700)); }
.ad-cash { --ad-tone: #1d4ed8; } .ad-loan { --ad-tone: #7c3aed; } .ad-al { --ad-tone: #0f766e; } .ad-profit { --ad-tone: #157347; } .ad-expense { --ad-tone: #b42318; }
.ad-group td { background: #f1f6f5 !important; }
.ad-sub td:nth-child(2) { padding-left: 26px; }
.ad-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 4px; }
.ad-key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.ad-key::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--ad-tone); }
@media (max-width: 760px) { .ad-avail { grid-template-columns: 1fr; padding: 16px; } .ad-avail-value { font-size: 26px; } }

/* ---------- v1.27 Global search bar ---------- */
.gs-box { height: 40px; padding: 0 6px 0 4px; gap: 8px; background: var(--navy-100); border: 1.5px solid #b7c4d8; border-radius: 20px; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.gs-box:hover { border-color: var(--navy-600); }
.gs-box:focus-within { background: #fff; border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(232, 129, 26, .2); }
.gs-ic { width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--orange-500); color: #fff; flex: none; box-shadow: 0 1px 3px rgba(201, 106, 12, .35); }
.gs-ic .ic { width: 15px; height: 15px; }
.gs-input { color: var(--navy-800); font-weight: 500; }
.gs-input::placeholder { color: #5b6b82; font-weight: 400; opacity: 1; }
.gs-clear { color: var(--navy-600); }
.gs-clear:hover { background: var(--line); color: var(--navy-800); }
.gs-toggle { background: var(--orange-500) !important; color: #fff !important; border-radius: 50%; }
.gs-panel { border-top: 3px solid var(--orange-500); }
.gs-item:hover, .gs-item:focus { border-color: var(--orange-500); background: var(--orange-100); }
/* money colours win over the table text colour (every table) */
.table td.pos, .table td .pos, .table td.db-cr, .table td .db-cr { color: var(--success); }
.table td.neg, .table td .neg, .table td.db-dr, .table td .db-dr { color: var(--danger); }

/* ---------- v1.28 Adjust Screen Size ---------- */
.ss-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px 0 8px; border-radius: 18px; border: 1px solid var(--input-line); background: var(--surface); color: var(--navy-800); font: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.ss-btn:hover, .ss-btn[aria-expanded="true"] { background: var(--navy-100); border-color: var(--navy-600); }
.ss-aa { display: inline-flex; align-items: baseline; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy-800); color: #fff; font-size: 13px; font-weight: 800; line-height: 24px; }
.ss-aa small { font-size: 9px; font-weight: 800; margin-left: 1px; }
.ss-pct { font-variant-numeric: tabular-nums; min-width: 34px; text-align: left; }
.ss-panel { min-width: 290px; padding: 8px; }
.ss-row { display: grid; grid-template-columns: 32px 1fr auto auto; align-items: center; gap: 6px; width: 100%; padding: 8px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.ss-row:hover:not(:disabled) { background: var(--orange-100); border-color: var(--attn-line); }
.ss-row:disabled { opacity: .45; cursor: not-allowed; }
.ss-sign { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--orange-500); color: #fff; font-size: 18px; font-weight: 800; line-height: 1; }
.ss-sign.ss-minus { background: var(--navy-700); }
.ss-reset .ss-sign { background: var(--neutral-bg); color: var(--neutral); font-size: 10.5px; border: 1px solid var(--neutral-line); }
.ss-name { font-weight: 600; }
.ss-row kbd, .ss-panel kbd { display: inline-block; min-width: 26px; padding: 2px 6px; border: 1px solid var(--input-line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--navy-800); font: 700 11.5px/1.3 Consolas, "Cascadia Mono", ui-monospace, monospace; text-align: center; }
.ss-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 4px; margin-top: 4px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--text-2); }
.ss-now { font-size: 15px; color: var(--navy-800); font-variant-numeric: tabular-nums; }
.ss-bar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 2px 8px 6px; }
.ss-bar i { height: 6px; border-radius: 3px; background: var(--line); }
.ss-bar i.on { background: var(--orange-500); }
@media (max-width: 900px) { .ss-pct { display: none; } .ss-btn { padding: 0 6px; } }

/* a form section may shrink to the screen width; its wide tables scroll inside it */
.form-section { min-width: 0; }
.entry-wide > .loan-form, .entry-wide > form { width: 100%; min-width: 0; }
@media (max-width: 560px) {
  /* phone top bar: compact screen-size button and user chip so everything fits */
  .ss-btn { padding: 0 4px; height: 34px; } .ss-aa { width: 22px; height: 22px; line-height: 22px; font-size: 12px; }
  .user-chip .user-name, .user-chip > span:last-child { display: none; }
  .top-date { display: none; }
  .top-right { gap: 6px; }
}
.ss-limit { margin: 2px 8px 6px; color: var(--attn); }
/* v1.29 owner's investment */
.ad-owner { --ad-tone: #b45309; }
.ad-link { font-weight: 700; text-decoration: underline dotted; text-underline-offset: 3px; color: var(--navy-700); }
.ad-link:hover { color: var(--orange-600); text-decoration-style: solid; }
.ad-inv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--attn-line); border-left: 4px solid var(--attn); border-radius: var(--radius-sm); background: var(--attn-bg); }
.ad-inv-total { font-size: 22px; color: var(--navy-800); font-variant-numeric: tabular-nums; }
.db-owner { margin-left: 4px; }

/* v1.33 — edit closed loan dialog */
.ce { display: grid; gap: 14px; }
.ce-sec { border: 1px solid var(--border, #d9dee5); border-radius: 8px; padding: 10px 12px 12px; margin: 0; min-width: 0; }
.ce-sec legend { font-weight: 600; padding: 0 6px; }
.ce-sec .form-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.ce-items .table select, .ce-items .table input { min-width: 90px; }
.ce-preview .sum-table { margin-bottom: 8px; }
.ce-preview .field-err { color: var(--danger, #b42318); font-size: .85rem; margin-top: 4px; }

/* v1.34 — renew loan: interest option + preview */
.form-grid > .span-all { grid-column: 1 / -1; }
.renew-opt { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border, #d9dee5); border-radius: 8px; display: grid; gap: 6px; }
.renew-opt .seg-radio { display: flex; flex-wrap: wrap; gap: 8px 20px; font-weight: 600; }
.renew-preview .sum-table { margin-bottom: 6px; max-width: 520px; }
.renew-preview .field-err { color: var(--danger, #b42318); font-size: .85rem; margin-top: 4px; }

/* v1.35 — pledge card: Show ROI toggle */
.pc-tools .pc-opt.pc-roi { flex-direction: row; align-items: center; gap: 8px; align-self: end; min-height: 40px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.pc-tools .pc-roi input { width: 18px; height: 18px; margin: 0; }

/* v1.36 — market lending value warning */
.mkt-warn { margin-top: 12px; font-size: .9rem; line-height: 1.5; }
.mkt-warn .mkt-ok { color: var(--success, #067647); font-weight: 700; }
.mkt-pop-msg { font-weight: 600; color: var(--danger, #b42318); margin: 0 0 12px; }


/* v1.44 — Install for Windows */
.install-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent, #f28c28); color: #fff; border: 1px solid transparent; border-radius: 999px; padding: 6px 12px; font-weight: 600; white-space: nowrap; }
.install-btn:hover { filter: brightness(1.05); }
.install-btn:focus-visible { outline: 2px solid var(--navy-800, #0f2747); outline-offset: 2px; }
.install-btn .install-short { display: none; }
@media (max-width: 1499px) { .install-btn .install-label { display: none; } .install-btn .install-short { display: inline; } }
@media (max-width: 1023px) { .install-btn .install-short { display: none; } .install-btn { padding: 6px 9px; } }
.inst { display: grid; gap: 14px; }
.inst-opt { border: 1px solid var(--border, #d9dee5); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; }
.inst-opt h3 { margin: 0; font-size: 15px; color: var(--navy-800, #0f2747); }
.inst-opt p { margin: 0; }
.inst-steps { margin: 0; padding-left: 20px; display: grid; gap: 2px; }

/* v1.45 Personal Loan ledger per borrower */
.modal-xl { max-width: 1120px; }
.bl-title { font-size: 15px; font-weight: 700; color: var(--navy-800, #0f2747); margin: 0 0 4px; }
.bl-h { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--navy-800, #0f2747); margin: 18px 0 8px; }
.bl-actions { margin: 10px 0 4px; flex-wrap: wrap; }
.bl-stmt-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bl-stmt-head .filters { margin: 0; align-items: flex-end; flex-wrap: wrap; }
.bl-stmt tbody td.num, .bl-stmt tfoot td.num { white-space: nowrap; }
.bl-stmt tfoot td { font-weight: 700; background: var(--surface-2, #f5f7fb); }
.bl-bf td { background: var(--surface-2, #f5f7fb); }
tr.row-reversed-soft td { color: var(--muted, #6b7686); }
tr.row-muted td { color: var(--muted, #6b7686); }
.bl-stmt td.c-dr { color: var(--danger-600, #b42318); } .bl-stmt td.c-cr { color: var(--success-600, #1e7a3c); }
/* v1.45: phones — the Windows install button is not shown (it pushed the top bar past the screen edge since v1.44),
   and the list search box + page-size select wrap instead of widening the page */
@media (max-width: 560px) {
  .install-btn { display: none !important; }
  .dt-tools-r { flex-wrap: wrap; min-width: 0; }
  .dt-tools-r .search { flex: 1 1 180px; min-width: 0; }
  .dt-tools-r .search input { min-width: 0; width: 100%; }
}
.bl-stmt .mono, .bl-ledger td.mono { white-space: nowrap; }
/* v1.47 Admin Dashboard: amounts to be received back */
.ad-recv { --ad-tone: #0f766e; }
.ad-def.ad-payable { color: var(--danger-600, #b42318); font-weight: 600; }
.ad-avail-warn { margin: 8px 0 0; }
/* v1.48 Day Book cutover */
.co-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 16px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-left: 4px solid var(--orange-500, #f28c28); border-radius: var(--radius-sm); background: var(--surface-2, #f5f7fb); }
.co-status > div { display: flex; flex-direction: column; gap: 2px; }
.co-status strong { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--navy-800, #0f2747); }
.co-status-note { grid-column: 1 / -1; margin: 0; }
.co-none p { grid-column: 1 / -1; margin: 0; }
.co-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 14px; }
.co-steps > li > p { margin: 2px 0 6px; }
.co-steps .field { max-width: 360px; }
.co-radios { display: grid; gap: 8px; max-width: 720px; }
.co-radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface, #fff); }
.co-radio.on { border-color: var(--orange-500, #f28c28); background: var(--attn-bg, #fff7ed); }
.co-radio input { margin-top: 3px; }
.co-radio > span { display: flex; flex-direction: column; gap: 2px; }
.co-q { font-weight: 700; }
.co-opts { display: grid; gap: 8px; margin: 8px 0; }
.co-opt { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.co-opt.on { border-color: var(--orange-500, #f28c28); background: var(--attn-bg, #fff7ed); }
.co-opt p { margin: 4px 0 0; }
.co-change { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 10px 0; border-radius: var(--radius-sm); background: var(--surface-2, #f5f7fb); }
.co-change > div { display: flex; flex-direction: column; }
.co-change strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.db-cut-note { margin: 6px 0 10px; border-left: 4px solid var(--orange-500, #f28c28); }

/* Session lock screen (core/session-lock.js): covers everything, above dialogs and pop-ups */
.lock-screen { position: fixed; inset: 0; z-index: 2000; overflow: auto; background: var(--navy-900, #0a1c35); }

/* v1.51 Day Book: date-wise sections, daily closing balance, colour-coded entries */
.dt-group td { padding: 0; border-left: 0; border-right: 0; text-align: left; }
.dt-group td::before { content: none !important; }
.table tbody tr.dt-group-head td { background: var(--navy-100, #e8eef7); border-top: 3px solid var(--navy-700, #1d3a63); }
.table tbody tr.dt-group-foot td { background: #fff1c2; border-bottom: 3px solid var(--navy-700, #1d3a63); }
/* pinned to the visible left edge, so the figures stay in view when the wide table scrolls sideways */
.db-day-head, .db-day-foot { position: sticky; left: 0; width: max-content; max-width: min(100%, 92vw); box-sizing: border-box; }
.db-day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 8px 12px; color: var(--navy-900, #0f2747); }
.db-day-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 9px 12px; color: #3b2a00; }
.db-day-label { font-weight: 800; letter-spacing: .02em; }
.db-day-io { color: #6b5a2a; }
.db-day-amt { font-size: 16px; font-variant-numeric: tabular-nums; background: #ffd75e; color: #2a1d00; padding: 2px 10px; border-radius: 6px; }
tr.dt-flash td { animation: dtFlash 2.4s ease-out; }
/* v1.61 Day Book ↑ / ↓ (arrange entries within a date) */
.db-move { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.db-move-btns { display: inline-flex; flex-direction: column; gap: 2px; }
.db-move-btn { width: 24px; height: 18px; padding: 0; line-height: 1; font-size: 13px; font-weight: 700; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--navy-700); cursor: pointer; }
.db-move-btn:hover:not(:disabled) { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.db-move-btn:focus-visible { outline: 2px solid var(--orange-500, #f28c28); outline-offset: 1px; }
.db-move-btn:disabled { opacity: .3; cursor: default; }
@keyframes dtFlash { 0%, 40% { box-shadow: inset 0 0 0 2px var(--orange-500, #f28c28); } 100% { box-shadow: none; } }
.db-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 6px 0 8px; color: var(--muted); }
.db-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.db-legend .btn { margin-left: auto; }
.db-sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); }
.db-sw-close { background: #ffd75e; }
.roi-input { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.roi-input select { flex: 1 1 140px; min-width: 0; }
.roi-custom-wrap { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 140px; }
.roi-custom-wrap[hidden] { display: none; }
.roi-custom { width: 90px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .table tbody tr.dt-group-head td { background: #16263f; } :root:not([data-theme="light"]) .db-day-head { color: #e2e8f0; }
  :root:not([data-theme="light"]) .table tbody tr.dt-group-foot td { background: #3a2e08; } :root:not([data-theme="light"]) .db-day-foot, :root:not([data-theme="light"]) .db-day-io { color: #fde68a; }
}
:root[data-theme="dark"] .table tbody tr.dt-group-head td { background: #16263f; } :root[data-theme="dark"] .db-day-head { color: #e2e8f0; } :root[data-theme="dark"] .table tbody tr.dt-group-foot td { background: #3a2e08; } :root[data-theme="dark"] .db-day-foot, :root[data-theme="dark"] .db-day-io { color: #fde68a; }

/* Cloudflare Access sign-in expired (js/app.js) */
.access-expired { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2100; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; max-width: min(640px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 10px; background: #fff4e8; color: #7a3d00; border: 1px solid #f28c28; box-shadow: 0 8px 24px rgba(15,39,71,.25); font-size: 14px; }

/* v1.54 Gold Loan Number: skipped / released numbers to choose (core/loan-number-field.js) */
.gln-choices { display: grid; gap: 6px; margin: 6px 0 2px; }
.gln-choice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gln-chip { font: 600 12px ui-monospace, Consolas, monospace; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--navy-900, #0f2747); cursor: pointer; }
.gln-chip:hover { border-color: var(--orange-500, #f28c28); background: var(--attn-bg, #fff7ed); }
.gln-chip-freed { border-style: dashed; }

/* v1.55 Top Up box in the loan View */
.tu-box { border: 1px solid var(--line); border-left: 4px solid var(--orange-500); border-radius: var(--radius); padding: 12px 14px; margin: 14px 0; background: var(--surface-2); }
.tu-box > .sub-title { margin-top: 0; }
.tu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; align-items: start; }
.tu-calc { margin-top: 10px; }
.tu-calc .sum-table { max-width: 560px; }
.tu-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.tu-subhead { margin: 14px 0 6px; font-size: .95rem; }

/* v1.56 Quantity (pieces + Nos / Pair) in the jewellery table */
.qty-cell { display: flex; gap: 6px; align-items: center; min-width: 132px; }
.qty-cell .qty-num { width: 64px; text-align: right; }
.qty-cell select { width: auto; min-width: 70px; }

/* v1.57 Gmail set-up help for recovery emails */
.mail-help { margin: 8px 0; }
.mail-help summary { cursor: pointer; font-weight: 600; }
.mail-help ol { margin: 6px 0 4px 18px; padding: 0; }
.mail-help li { margin: 2px 0; }

/* v1.58 Repayment adjustment method, receipt preview, edit history */
.form-grid .field:has(.adj-pick) { grid-column: 1 / -1; }
.adj-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.adj-opt { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; background: var(--surface); }
.adj-opt:has(input:checked) { border-color: var(--orange-500); background: var(--orange-100); }
.adj-opt input { margin-top: 3px; }
.adj-opt span { display: flex; flex-direction: column; gap: 2px; }
.adj-opt small { font-size: 11.5px; line-height: 1.35; }
.receipt-preview { background: #fff; color: #000; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-x: auto; }
.edit-history { margin-top: 8px; }
.edit-history ul { margin: 4px 0 0 18px; padding: 0; }
.edit-history li { margin: 3px 0; }

/* v1.59 draggable popups: the title bar is the handle (design unchanged) */
.modal-head.modal-drag { cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.modal-head.modal-drag button { cursor: pointer; }
.modal-head.modal-drag:focus-visible { outline: 2px solid var(--orange-500); outline-offset: -2px; }
.modal.modal-dragging { box-shadow: 0 18px 50px rgba(10, 28, 53, .35); }
body.is-dragging, body.is-dragging * { cursor: move !important; user-select: none !important; }

/* v1.60 disbursement details, top-up history, loan timeline */
.disb { margin: 12px 0; }
.disb-table tr.disb-pledge td, .tu-hist tr.tu-row-pledge td { font-weight: 600; background: var(--navy-100); }
.disb-table tfoot td { font-weight: 700; }
.tl-box { margin: 16px 0; }
.tl-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.tl { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.tl::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; margin: 0 0 12px; }
.tl-dot { position: absolute; left: -22px; top: 12px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--muted); box-sizing: border-box; }
.tl-pledge .tl-dot { border-color: var(--navy-700); background: var(--navy-700); }
.tl-topup .tl-dot { border-color: var(--orange-500); background: var(--orange-500); }
.tl-payment .tl-dot { border-color: var(--success); }
.tl-closed .tl-dot, .tl-renewed .tl-dot { border-color: var(--text-2); background: var(--text-2); }
.tl-card { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: var(--radius-sm); background: var(--surface); padding: 8px 12px; }
.tl-pledge .tl-card { border-left-color: var(--navy-700); }
.tl-topup .tl-card { border-left-color: var(--orange-500); }
.tl-payment .tl-card { border-left-color: var(--success); }
.tl-reversed .tl-card { opacity: .6; border-left-style: dashed; }
.tl-reversed .tl-amt { text-decoration: line-through; }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.tl-date { font-weight: 800; color: var(--navy-800); font-variant-numeric: tabular-nums; }
.tl-title { font-size: 13px; letter-spacing: .03em; }
.tl-amt { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.tl-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 16px; font-size: 12.5px; }
.tl-k { color: var(--muted); }

/* ===== v1.63 Customer Follow-Up ===== */
.fu-btn { background: var(--orange-500, #f28c28); color: #fff; border: 1px solid var(--orange-500, #f28c28); font-weight: 700; letter-spacing: .02em; }
.fu-btn:hover { filter: brightness(.94); }
.fu-btn-in { color: var(--navy-700); border: 1px solid var(--line); }
.fu-table .dt-scroll, .fu-sticky { max-height: 70vh; overflow: auto; }
.fu-table .table th, .fu-sticky .table th { position: sticky; top: 0; z-index: 2; }
.fu-table .table th { position: sticky; }
.fu-resize { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; touch-action: none; }
.fu-resize:hover { background: rgba(255,255,255,.25); }
tr.fu-row-missed td { background: #fff1f0; }
tr.fu-row-missed td:first-child { box-shadow: inset 4px 0 0 #d93025; }
tr.fu-row-today td:first-child { box-shadow: inset 4px 0 0 var(--orange-500, #f28c28); }
.fu-tel { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fu-paid { color: #137333; font-weight: 600; }
.fu-filters .filter select { min-width: 150px; }
.fu-hist-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.fu-hist-bar .btn-row { align-items: center; margin: 0; }
.fu-calls { display: grid; gap: 10px; }
.fu-call { border: 1px solid var(--line); border-left: 4px solid var(--navy-600); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.fu-call-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.fu-call-head .btn { margin-left: auto; }
.fu-pre { white-space: pre-wrap; }
.fu-edits ul { margin: 6px 0 0 18px; }
.fu-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); margin: 4px 0 8px; }
.fu-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fu-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.fu-dot.fu-k-call, .fu-tl-item.fu-k-call::before { background: var(--navy-600); }
.fu-dot.fu-k-payment, .fu-tl-item.fu-k-payment::before { background: #1e8e3e; }
.fu-dot.fu-k-system, .fu-tl-item.fu-k-system::before { background: #8a94a6; }
.fu-dot.fu-k-manual, .fu-tl-item.fu-k-manual::before { background: #d93025; }
.fu-tl { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.fu-tl-item { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 6px 0 12px 10px; }
.fu-tl-item::before { content: ''; position: absolute; left: -25px; top: 10px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.fu-tl-date { font-weight: 700; color: var(--navy-700); font-variant-numeric: tabular-nums; }
.fu-tl-item.fu-k-payment .fu-tl-body strong { color: #137333; }
.fu-tl-item.fu-k-manual .fu-tl-body strong { color: #b3261e; }
.fu-span { grid-column: 1 / -1; }
.fu-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: -4px; color: var(--text-2); }
tr.fu-grp td { background: var(--navy-100); font-weight: 700; color: var(--navy-800); }
td.fu-resp { max-width: 320px; white-space: normal; }
@media (max-width: 640px) { .fu-tl-item { grid-template-columns: 1fr; gap: 2px; } }

/* v1.67 Allow Backdated / Old Data Entry */
.bd-toggle { font-size: 15px; margin: 4px 0 10px; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.filters-inline { display: contents; }
.filters-inline[hidden] { display: none; }

/* v1.68 Pending Tasks count in the sidebar */
.nav-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #d93025; color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-left: auto; margin-right: 4px; }
.nav-count[hidden] { display: none; }

/* v1.69 Difference Amount Breakdown — Cash Flow column */
.cf-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid; }
.cf-in { color: #137333; background: #e6f4ea; border-color: #a8dab5; }
.cf-out { color: #b3261e; background: #fce8e6; border-color: #f5b5ae; }
.cf-imp { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cf-imp-in { color: #137333; }
.cf-imp-out { color: #b3261e; }
.cf-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; color: var(--text-2); }
.cf-sep { width: 14px; }

/* v1.71 PB Finance licence / support bar */
.licence-bar { padding: 9px 16px; font-size: 13.5px; font-weight: 600; line-height: 1.4; border-bottom: 1px solid transparent; }
.licence-bar[hidden] { display: none; }
.licence-bar.lb-soon { background: #fff4e5; color: #8a4b00; border-color: #f5c27a; }
.licence-bar.lb-urgent { background: #fde7e4; color: #9c2a1f; border-color: #f2a59b; }
.licence-bar.lb-expired { background: #b3261e; color: #fff; }
.licence-bar.lb-support { background: #1f4275; color: #fff; }

/* v1.73 camera help */
.camera-msg { margin-top: 8px; }
.camera-err { background: #fff4e5; color: #6b3d00; border: 1px solid #f5c27a; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.camera-err ol { margin: 6px 0 10px 18px; padding: 0; } .camera-err li { margin: 3px 0; }
