/* ============================================================
   Corporate Panel Records — Life Line Hospital
   Ledger-style UI: navy brand, green = money in, red = money owed
   ============================================================ */
:root {
  --navy: #1c3f8f;
  --navy-dark: #142c66;
  --navy-soft: #e8eef9;
  --ink: #13213d;
  --ink-2: #3b4a66;
  --muted: #6a7790;
  --paper: #f3f5f9;
  --surface: #ffffff;
  --line: #dfe4ec;
  --line-2: #edf0f5;
  --green: #17803f;
  --green-soft: #e4f4ea;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #a45a06;
  --amber-soft: #fdf1e1;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(19, 33, 61, .05);
  --font: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--navy-soft); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--navy-dark);
  color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,.55); margin-top: 2px; }
.nav { padding: 6px 12px; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 11.5px; color: rgba(255,255,255,.42); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.72); font-size: 14px; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: #fff; color: var(--navy-dark); }
.sidebar-foot { padding: 14px 20px 20px; font-size: 12px; color: rgba(255,255,255,.5); border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-foot strong { color: #fff; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 28px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px; cursor: pointer; color: var(--ink); }
.top-search { flex: 1; max-width: 480px; position: relative; }
.top-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-search input {
  width: 100%; padding: 9px 12px 9px 36px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); font: inherit; color: var(--ink);
}
.top-search input:focus { outline: none; border-color: var(--navy); background: #fff; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: #fff; font-weight: 600;
  display: flex; align-items: center; justify-content: center; font-size: 13.5px;
}
.content { padding: 26px 28px 40px; flex: 1; max-width: 1600px; width: 100%; }
.app-foot { padding: 14px 28px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.overlay { display: none; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 23px; font-weight: 700; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 3px 0 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.h1-amt { font-weight: 600; color: var(--green); }
.h2 { font-size: 15px; font-weight: 700; margin: 0 0 14px; }
.head-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-filters input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head.wrap { flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.card-title-row { margin-bottom: 4px; }
.mt { margin-top: 20px; }
.mt-sm { margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; margin-top: 20px; align-items: start; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow);
}
.stat-alert { border-left: 3px solid var(--red); }
.stat-ico { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-ico svg { width: 19px; height: 19px; }
.ico-navy { background: var(--navy-soft); color: var(--navy); }
.ico-blue { background: #e6f0fb; color: #1d5fa8; }
.ico-green { background: var(--green-soft); color: var(--green); }
.ico-red { background: var(--red-soft); color: var(--red); }
.ico-amber { background: var(--amber-soft); color: var(--amber); }
.stat-val { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.stat-lbl { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.progress-card { margin-bottom: 0; }
.progress-top { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; }
.progress { height: 10px; background: var(--red-soft); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); border-radius: 99px; transition: width .4s ease; }
.progress-lg { height: 14px; margin: 16px 18px 0; }
.progress-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.dot-green { background: var(--green); } .dot-red { background: var(--red); } .dot-amber { background: var(--amber); } .dot-navy { background: var(--navy); }

/* ---------- Summary strip ---------- */
.summary-strip {
  display: flex; flex-wrap: wrap; gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 14px; overflow: hidden;
}
.summary-strip > div { flex: 1; min-width: 140px; padding: 11px 16px; border-right: 1px solid var(--line-2); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span { display: block; font-size: 12px; color: var(--muted); }
.summary-strip strong { font-size: 16px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap.tall { max-height: calc(100vh - 290px); min-height: 260px; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-2);
  background: #f7f9fc; 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: #f8fafd; }
.table tfoot td { background: #f2f5fb; font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.table-dense td { padding: 8px 10px; }
.table-dense th { padding: 9px 10px; }
.sticky-head thead th { position: sticky; top: 0; z-index: 2; }
.table .num { text-align: right; white-space: nowrap; }
.table .empty td { text-align: center; color: var(--muted); padding: 36px 16px; }
.row-link { cursor: pointer; }
.row-muted td { opacity: .55; }
.th-sort { color: inherit; }
.th-sort:hover { color: var(--navy); }
.nowrap { white-space: nowrap; }
.remarks { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.actions { text-align: right; }
.actions .inline, .actions form { display: inline; }
.chk { width: 36px; text-align: center; }
.w-amt { width: 116px; }

/* ---------- Text helpers ---------- */
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.center { text-align: center; justify-content: center; }
.right { text-align: right; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.link { color: var(--navy); font-weight: 500; }
.link:hover { text-decoration: underline; }
.link-plain:hover { color: var(--navy); text-decoration: underline; }
.code { font-family: var(--mono); font-size: 11.5px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; margin-left: 6px; color: var(--ink-2); }
.hint { font-size: 13px; color: var(--muted); margin: 10px 2px 0; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-cleared { background: var(--green-soft); color: var(--green); }
.badge-partial { background: var(--amber-soft); color: var(--amber); }
.badge-outstanding { background: var(--red-soft); color: var(--red); }
.badge-unbilled { background: #eef0f4; color: var(--muted); }
.badge-file { background: var(--navy-soft); color: var(--navy); }
.mini-pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-red { background: var(--red-soft); color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; line-height: 1.2;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-outline.is-on { background: var(--navy-soft); border-color: var(--navy); color: var(--navy); }
.btn-danger-ghost { background: #fff; border-color: #f3c7c2; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-xs { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 12px; }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg a, .seg label { padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.seg a:last-child, .seg label:last-child { border-right: 0; }
.seg a.on, .seg label.on { background: var(--navy); color: #fff; }
.seg input[type=radio] { display: none; }
.seg-lg label { padding: 9px 16px; font-size: 13.5px; flex: 1; justify-content: center; }
.seg-lg { display: flex; }

/* ---------- Forms ---------- */
.field label, .lbl { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea,
.filters input, .filters select, .input-sm, .month-tabs input {
  width: 100%; font: inherit; color: var(--ink);
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
.filters input:focus, .filters select:focus, .input-sm:focus, .amount:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(28, 63, 143, .12);
}
.field select:disabled { background: var(--paper); color: var(--muted); }
.form-grid { display: grid; gap: 14px 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.form-section { padding: 4px 0 18px; border-bottom: 1px solid var(--line-2); margin-bottom: 18px; }
.form-section:last-of-type { border-bottom: 0; margin-bottom: 0; }
.form-section h3 { font-size: 13.5px; font-weight: 700; color: var(--navy); margin: 0 0 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.form-actions.between { justify-content: space-between; align-items: center; }
.form-narrow { max-width: 440px; display: flex; flex-direction: column; gap: 14px; }
.amount { text-align: right; font-variant-numeric: tabular-nums; }
.amount-lg { font-size: 20px !important; font-weight: 700; padding: 12px 14px !important; }
.calc { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--paper); border: 1px dashed var(--line); text-align: right; font-weight: 700; min-height: 40px; }
.calc.neg { color: var(--red); background: var(--red-soft); border-color: #f3c7c2; }
.calc.pos { color: var(--green); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.inline { display: inline; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { max-width: 150px; }
.input-sm { padding: 7px 10px; font-size: 13px; width: auto; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; margin-bottom: 14px; align-items: center; }
.filters input, .filters select { width: auto; padding: 8px 10px; font-size: 13.5px; }
.filters .f-grow { flex: 1; min-width: 220px; }
.f-lbl { font-size: 13px; color: var(--muted); }
.quick { display: flex; gap: 12px; margin-left: auto; font-size: 13px; }
.quick a { color: var(--navy); font-weight: 500; }
.quick a:hover { text-decoration: underline; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: #0f5c2d; border-color: #bfe3cc; }
.alert-error { background: var(--red-soft); color: #8e1b12; border-color: #f3c7c2; }
.alert-warn { background: var(--amber-soft); color: #7a4204; border-color: #f2d6ae; }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---------- Lists ---------- */
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #f8fafd; }
.empty-box { padding: 30px 18px; text-align: center; color: var(--muted); }

/* ---------- Key/value ---------- */
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin: 0; }
.kv dt { font-size: 12.5px; color: var(--muted); }
.kv dd { margin: 2px 0 0; font-weight: 500; }
.remarks-box { margin-top: 16px; padding: 12px 14px; background: var(--paper); border-radius: var(--radius-sm); font-size: 13.5px; color: var(--ink-2); }

/* ---------- Company month tabs ---------- */
.month-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.month-tabs input { width: auto; padding: 6px 10px; font-size: 13px; }
.tab { padding: 6px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { border-color: var(--navy); color: var(--navy); }
.tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab-n { font-size: 11.5px; opacity: .7; }
.tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.tab.on .tab-dot { background: #ffb4ab; }

/* ---------- Cheque pages ---------- */
.steps { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.step { display: flex; align-items: center; gap: 8px; }
.step span { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: #fff; }
.step.on { color: var(--navy); }
.step.on span { background: var(--navy); border-color: var(--navy); color: #fff; }
.step.done span { background: var(--green); border-color: var(--green); color: #fff; }
.step-line { width: 40px; height: 2px; background: var(--line); }
.step-line.on { background: var(--green); }

.cheque-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.dropzone { border: 1.5px dashed #c6cfdd; border-radius: var(--radius); padding: 16px; background: #fafbfd; transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--navy); background: var(--navy-soft); }
.preview-box { min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); text-align: center; margin-bottom: 12px; }
.preview-box img { max-height: 280px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.pdf-chip { padding: 16px 20px; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 600; }

.alloc-bar {
  position: sticky; top: 58px; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0;
  margin-bottom: 14px; overflow: hidden;
}
.alloc-bar > div { flex: 1; min-width: 130px; padding: 11px 16px; border-right: 1px solid var(--line-2); }
.alloc-bar span { display: block; font-size: 12px; color: var(--muted); }
.alloc-bar strong { font-size: 17px; }
.alloc-bar .btn { margin: 0 14px; }
.alloc-bar.over { border-color: var(--red); box-shadow: 0 0 0 3px rgba(180, 35, 24, .1); }
.alloc-row input.amount { width: 104px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; font: inherit; font-size: 13.5px; }
.alloc-row input.amount:disabled { background: transparent; border-color: transparent; color: var(--muted); }
.alloc-row.is-sel td { background: #f1f7f3; }
.alloc-row.is-sel:hover td { background: #e9f3ec; }
.alloc-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--green); cursor: pointer; }
.alloc-row .bal.zero { color: var(--green); font-weight: 600; }
.alloc-row .bal.left { color: var(--amber); font-weight: 600; }
.alloc-row .bal.bad { color: var(--red); font-weight: 700; }
.alloc-row.hide { display: none; }

.cheque-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; margin-bottom: 20px; }
.cheque-file { padding: 12px; display: flex; flex-direction: column; }
.cheque-file img { width: 100%; max-height: 340px; object-fit: contain; border-radius: var(--radius-sm); background: #fafbfd; }
.cheque-file iframe { width: 100%; height: 340px; border: 0; border-radius: var(--radius-sm); }
.file-actions { display: flex; gap: 16px; justify-content: center; margin-top: 8px; }
.no-file { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.sum-rows > div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.sum-rows > div:last-child { border-bottom: 0; }
.sum-rows span { color: var(--ink-2); }

/* The one-click company position */
.position-card { padding-bottom: 16px; border-top: 3px solid var(--navy); }
.position-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.pos { padding: 18px; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 2px; }
.pos:last-child { border-right: 0; }
.pos-n { font-size: 34px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.pos-l { font-size: 13px; color: var(--ink-2); }
.pos-blue .pos-n { color: var(--navy); }
.pos-green .pos-n { color: var(--green); }
.pos-red .pos-n { color: var(--red); }
.position-amounts { display: flex; flex-wrap: wrap; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); background: #fafbfd; }
.position-amounts > div { flex: 1; min-width: 150px; padding: 10px 18px; }
.position-amounts span { display: block; font-size: 12px; color: var(--muted); }
.position-amounts strong { font-size: 15px; }

/* ---------- Reports ---------- */
.aging-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.age { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.age span { font-size: 12.5px; color: var(--muted); grid-column: 1 / -1; }
.age strong { font-size: 17px; grid-column: 1 / -1; }
.age-bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.age-bar div { height: 100%; border-radius: 99px; }
.age em { font-style: normal; font-size: 12px; color: var(--muted); }
.age-a30 .age-bar div { background: #4f7bd0; }
.age-a60 .age-bar div { background: var(--amber); }
.age-a90 .age-bar div { background: #d06a2c; }
.age-a90p .age-bar div { background: var(--red); }
.age-a90p strong { color: var(--red); }
.mini-progress { display: inline-block; width: 70px; height: 6px; background: var(--red-soft); border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.mini-progress div { height: 100%; background: var(--green); }
.print-title { display: none; }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* ---------- Login ---------- */
.login-page { background: var(--navy-dark); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-wrap { display: grid; grid-template-columns: 1fr 1fr; max-width: 880px; width: 100%; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.login-side { background: var(--navy); color: #fff; padding: 40px 36px; display: flex; flex-direction: column; }
.login-side .brand { padding: 0; margin-bottom: auto; }
.login-side h2 { font-size: 26px; line-height: 1.25; margin: 48px 0 12px; letter-spacing: -.01em; }
.login-side p { color: rgba(255,255,255,.72); margin: 0; max-width: 34ch; }
.login-box { padding: 44px 40px; display: flex; flex-direction: column; gap: 16px; }
.login-box h1 { margin: 0; font-size: 22px; }
.login-box .muted { margin: -10px 0 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .cheque-top { grid-template-columns: 1fr; }
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; transform: translateX(-100%); transition: transform .22s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 10px 0 40px rgba(0,0,0,.3); }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(19,33,61,.45); z-index: 50; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; }
  .top-right .btn { display: none; }
  .content { padding: 18px 14px 32px; }
  .cheque-grid, .cols-3 { grid-template-columns: 1fr; }
  .position-grid { grid-template-columns: repeat(2, 1fr); }
  .pos:nth-child(2) { border-right: 0; }
  .pos:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
  .aging-grid { grid-template-columns: repeat(2, 1fr); }
  .quick { margin-left: 0; width: 100%; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { padding: 28px; }
  .login-side h2 { margin-top: 24px; font-size: 21px; }
  .alloc-bar { top: 56px; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-ico { display: none; }
  .stat-val { font-size: 17px; }
  .cols-2, .cols-4, .kv-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .page-head h1 { font-size: 20px; }
  .filters input, .filters select { flex: 1 1 100%; }
  .field input, .field select, .field textarea, .filters input, .filters select, .top-search input { font-size: 16px; }
  .alloc-bar > div { min-width: 50%; }
  .alloc-bar .btn { margin: 10px 14px; flex: 1; }
  .pos-n { font-size: 26px; }
  .card-pad { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .app-foot, .no-print, .filters, .btn { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .content { padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  .table-wrap, .table-wrap.tall { max-height: none; overflow: visible; }
  .print-title { display: block; margin-bottom: 12px; font-size: 12px; }
  .grid-2, .cheque-top { grid-template-columns: 1fr 1fr; }
}
.alloc-row input.amount:disabled::placeholder { color: transparent; }
.alloc-row td { white-space: nowrap; }
