/* ==========================================================================
   TrustLedger design system — "Trust Navy + Emerald"
   A token-driven layer over Bootstrap 5. No external fonts/CDNs (on-prem IIS).
   ========================================================================== */

:root {
  /* Brand */
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-50: #ecfdf5;

  /* Neutrals */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;

  /* Semantic */
  --good: #059669;
  --good-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eff6ff;

  /* Surfaces */
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e7ecf3;

  /* Shape */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 6px 18px rgba(15, 23, 42, .07);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, .14);
  --sidebar-w: 268px;

  /* Bootstrap bridge — make any stock component adopt the brand */
  --bs-primary: var(--emerald-600);
  --bs-primary-rgb: 5, 150, 105;
  --bs-link-color: var(--emerald-700);
  --bs-link-color-rgb: 4, 120, 87;
  --bs-link-hover-color: var(--emerald-600);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
}

/* ----------------------------------------------------------------- Base -- */

html { position: relative; min-height: 100%; font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 { color: var(--navy-900); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
a { color: var(--emerald-700); text-decoration: none; }
a:hover { color: var(--emerald-600); text-decoration: underline; }
.text-muted { color: var(--muted) !important; }
hr { border-color: var(--border); opacity: 1; }

::selection { background: var(--emerald-500); color: #fff; }

/* Tame the default focus ring → brand emerald */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .25);
  border-color: var(--emerald-500);
}

/* --------------------------------------------------------------- Buttons -- */

.btn {
  --bs-btn-padding-y: .55rem;
  --bs-btn-padding-x: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  letter-spacing: -0.01em;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-lg { --bs-btn-padding-y: .8rem; --bs-btn-padding-x: 1.4rem; font-size: 1.05rem; }
.btn-sm { --bs-btn-padding-y: .35rem; --bs-btn-padding-x: .7rem; }

.btn-primary {
  --bs-btn-bg: var(--emerald-600);
  --bs-btn-border-color: var(--emerald-600);
  --bs-btn-hover-bg: var(--emerald-700);
  --bs-btn-hover-border-color: var(--emerald-700);
  --bs-btn-active-bg: var(--emerald-700);
  --bs-btn-active-border-color: var(--emerald-700);
  --bs-btn-disabled-bg: var(--emerald-500);
  --bs-btn-disabled-border-color: var(--emerald-500);
  box-shadow: 0 1px 2px rgba(5, 150, 105, .25);
}
.btn-outline-secondary {
  --bs-btn-color: var(--navy-800);
  --bs-btn-border-color: var(--slate-300);
  --bs-btn-hover-bg: var(--navy-900);
  --bs-btn-hover-border-color: var(--navy-900);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--navy-900);
}
.btn-outline-primary {
  --bs-btn-color: var(--emerald-700);
  --bs-btn-border-color: var(--emerald-600);
  --bs-btn-hover-bg: var(--emerald-600);
  --bs-btn-hover-border-color: var(--emerald-600);
}
.btn-link { color: var(--emerald-700); font-weight: 600; text-decoration: none; }

/* ----------------------------------------------------------------- Cards -- */

.card {
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius);
  --bs-card-bg: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-body { padding: 1.35rem; }

/* ---------------------------------------------------------------- Tables -- */

.table {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border);
  margin-bottom: 0;
}
.table > thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--slate-500);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding: .65rem .75rem;
}
.table > tbody td { padding: .7rem .75rem; border-color: var(--border); vertical-align: middle; }
.table > tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: var(--slate-50); }

/* Table wrapped in a card-like panel */
.tl-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tl-table-card .table > tbody td,
.tl-table-card .table > thead th { padding-left: 1.2rem; padding-right: 1.2rem; }

/* ----------------------------------------------------------------- Forms -- */

.form-label { font-weight: 600; font-size: .82rem; color: var(--slate-700); margin-bottom: .35rem; }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--slate-300);
  padding: .55rem .8rem;
  background-color: #fff;
}
.form-control::placeholder { color: var(--slate-400); }
.form-check-input { border-color: var(--slate-400); }
.form-check-input:checked { background-color: var(--emerald-600); border-color: var(--emerald-600); }
.text-danger { color: var(--danger) !important; font-size: .85rem; }

/* ---------------------------------------------------------------- Alerts -- */

.alert { border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 500; }
.alert-success { background: var(--good-bg); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; }

/* --------------------------------------------------------------- Badges --- */

.badge { font-weight: 600; letter-spacing: .01em; border-radius: var(--radius-pill); padding: .35em .7em; }
.tl-badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 600;
  padding: .25rem .6rem; border-radius: var(--radius-pill); border: 1px solid transparent; }
.tl-badge::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; opacity: .9; }
.tl-badge-good { color: var(--good); background: var(--good-bg); border-color: #a7f3d0; }
.tl-badge-warn { color: var(--warn); background: var(--warn-bg); border-color: #fde68a; }
.tl-badge-danger { color: var(--danger); background: var(--danger-bg); border-color: #fecaca; }
.tl-badge-info { color: var(--info); background: var(--info-bg); border-color: #bfdbfe; }
.tl-badge-neutral { color: var(--slate-600); background: var(--slate-100); border-color: var(--slate-200); }
.tl-badge-navy    { color: #fff; background: var(--navy-800); border-color: var(--navy-900); }

/* Styled data table (no card wrapper needed) */
.tl-table > thead > tr > th {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--slate-50); border-bottom: 1px solid var(--border);
  padding: .65rem 1rem; white-space: nowrap;
}
.tl-table > tbody > tr > td { padding: .7rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--border); }
.tl-table > tbody > tr:last-child > td { border-bottom: none; }
.tl-table > tbody > tr:hover > td { background: var(--slate-50); }

/* ====================================================== AUTHENTICATED SHELL */

.tl-shell { display: flex; min-height: 100vh; }

.tl-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--navy-900);
  color: var(--slate-300);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.tl-sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.25rem 1.35rem;
  color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em;
}
.tl-sidebar-brand .tl-logo {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 32px;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, .5);
}
.tl-nav { padding: .5rem .75rem; flex: 1 1 auto; overflow-y: auto; }
.tl-nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--slate-500); font-weight: 700; padding: 1rem .6rem .35rem; }
.tl-nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .58rem .65rem; margin-bottom: 2px;
  border-radius: 9px; color: var(--slate-300); font-weight: 500; font-size: .92rem;
  transition: background .15s ease, color .15s ease;
}
.tl-nav-link:hover { background: var(--navy-800); color: #fff; text-decoration: none; }
.tl-nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.tl-nav-link.active { background: rgba(16, 185, 129, .14); color: #fff; box-shadow: inset 3px 0 0 var(--emerald-500); }
.tl-nav-link.active svg { opacity: 1; color: var(--emerald-500); }

.tl-sidebar-footer { padding: .9rem 1rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.tl-userline { display: flex; align-items: center; gap: .6rem; }
.tl-avatar { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: var(--navy-700); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.tl-userline .tl-uname { color: #fff; font-weight: 600; font-size: .85rem; line-height: 1.1; }
.tl-userline .tl-urole { color: var(--slate-400); font-size: .72rem; }

.tl-content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.tl-topbar {
  height: 62px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.6rem; position: sticky; top: 0; z-index: 20;
}
.tl-topbar .tl-page-title { font-weight: 700; color: var(--navy-900); font-size: 1.02rem; }
.tl-topbar-actions { display: flex; align-items: center; gap: .8rem; }
.tl-logout-btn { background: none; border: 0; color: var(--slate-600); font-weight: 600; font-size: .85rem;
  display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .5rem; border-radius: 8px; }
.tl-logout-btn:hover { background: var(--slate-100); color: var(--danger); }

.tl-main { padding: 1.8rem; flex: 1 1 auto; }
.tl-main-inner { max-width: 1100px; margin: 0 auto; }

/* Page header inside main */
.tl-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.4rem; flex-wrap: wrap; }
.tl-page-head h1 { margin: 0; }
.tl-page-head .tl-sub { color: var(--muted); margin-top: .25rem; font-size: .92rem; }

/* Stat cards */
.tl-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow-sm); height: 100%; }
.tl-stat-label { font-size: .78rem; font-weight: 600; color: var(--slate-500);
  text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: .45rem; }
.tl-stat-label svg { width: 16px; height: 16px; color: var(--emerald-600); }
.tl-stat-value { font-size: 2rem; font-weight: 800; color: var(--navy-900); line-height: 1.1; margin: .35rem 0 .1rem;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tl-stat-value.sm { font-size: 1.4rem; }
.tl-stat-hint { font-size: .8rem; color: var(--muted); }

/* Quick-action cards */
.tl-action {
  display: flex; gap: .9rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; box-shadow: var(--shadow-sm); height: 100%;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
a.tl-action { color: inherit; text-decoration: none; }
a.tl-action:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--slate-300); }
.tl-action-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px;
  background: var(--emerald-50); color: var(--emerald-600); display: grid; place-items: center; }
.tl-action-icon svg { width: 22px; height: 22px; }
.tl-action h3 { font-size: 1rem; margin: 0 0 .15rem; }
.tl-action p { margin: 0; color: var(--muted); font-size: .85rem; }

/* ----------------------------------------------------- Score report gauge -- */

.tl-score-panel { display: flex; gap: 1.6rem; align-items: center; flex-wrap: wrap; }
.tl-gauge {
  --pct: 0; --band: var(--slate-300);
  width: 168px; height: 168px; flex: 0 0 168px; border-radius: 50%;
  background: conic-gradient(var(--band) calc(var(--pct) * 1%), var(--slate-200) 0);
  display: grid; place-items: center; position: relative;
}
.tl-gauge::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--surface); }
.tl-gauge-inner { position: relative; text-align: center; }
.tl-gauge-score { font-size: 2.6rem; font-weight: 800; color: var(--navy-900); line-height: 1; font-variant-numeric: tabular-nums; }
.tl-gauge-range { font-size: .72rem; color: var(--slate-400); font-weight: 600; }
.tl-band-pill { font-size: 1rem; font-weight: 700; padding: .3rem .9rem; border-radius: var(--radius-pill); }
.tl-band-good { color: var(--good); background: var(--good-bg); }
.tl-band-warn { color: var(--warn); background: var(--warn-bg); }
.tl-band-danger { color: var(--danger); background: var(--danger-bg); }
.tl-band-neutral { color: var(--slate-600); background: var(--slate-100); }

.tl-factor-list { list-style: none; padding: 0; margin: 0; }
.tl-factor-list li { display: flex; align-items: center; gap: .55rem; padding: .4rem 0; border-bottom: 1px dashed var(--border); }
.tl-factor-list li:last-child { border-bottom: 0; }
.tl-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem 1.5rem; }
.tl-summary-grid .k { color: var(--muted); font-size: .82rem; }
.tl-summary-grid .v { font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }

/* ============================================================ MARKETING ==== */

.tl-marketing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.tl-marketing-nav .tl-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700;
  font-size: 1.2rem; color: var(--navy-900); }
.tl-marketing-nav .tl-brand .tl-logo { width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700)); display: grid; place-items: center; color: #fff; }
.tl-marketing-nav .tl-links { display: flex; align-items: center; gap: 1.1rem; }
.tl-marketing-nav .tl-links a { color: var(--slate-600); font-weight: 600; }
.tl-marketing-nav .tl-links a:hover { color: var(--navy-900); text-decoration: none; }

.tl-hero {
  background:
    radial-gradient(900px 400px at 80% -10%, rgba(16, 185, 129, .22), transparent 60%),
    linear-gradient(160deg, var(--navy-900), #11203b 60%, var(--navy-800));
  color: #fff; border-radius: 22px; padding: 4rem 2rem; text-align: center; position: relative; overflow: hidden;
}
.tl-hero h1 { color: #fff; font-size: 2.9rem; letter-spacing: -0.03em; margin-bottom: 1rem; }
.tl-hero .lead { color: #cbd5e1; font-size: 1.15rem; max-width: 640px; margin: 0 auto 1.8rem; }
.tl-hero .tl-eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 600;
  color: var(--emerald-500); background: rgba(16, 185, 129, .12); border: 1px solid rgba(16, 185, 129, .3);
  padding: .35rem .85rem; border-radius: var(--radius-pill); margin-bottom: 1.3rem; }
.tl-hero .btn-outline-secondary { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.35);
  --bs-btn-hover-bg: #fff; --bs-btn-hover-color: var(--navy-900); --bs-btn-hover-border-color: #fff; }

.tl-feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem; height: 100%; box-shadow: var(--shadow-sm); }
.tl-feature-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--emerald-50);
  color: var(--emerald-600); display: grid; place-items: center; margin-bottom: 1rem; }
.tl-feature-icon svg { width: 24px; height: 24px; }
.tl-feature h3 { font-size: 1.1rem; margin-bottom: .4rem; }
.tl-feature p { color: var(--muted); margin: 0; font-size: .92rem; }

/* Auth (login/register) split card */
.tl-auth-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 2.5rem 1rem; }
.tl-auth-card { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2.2rem; }
.tl-auth-card.wide { max-width: 620px; }
.tl-auth-head { text-align: center; margin-bottom: 1.6rem; }
.tl-auth-head .tl-logo { width: 46px; height: 46px; border-radius: 12px; margin: 0 auto .9rem;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700)); display: grid; place-items: center; color: #fff; }
.tl-auth-head h1 { font-size: 1.5rem; margin-bottom: .3rem; }
.tl-auth-head p { color: var(--muted); margin: 0; font-size: .92rem; }

footer.tl-marketing-footer { border-top: 1px solid var(--border); color: var(--muted);
  padding: 1.5rem; text-align: center; font-size: .85rem; margin-top: 3rem; }

/* --------------------------------------------------------- Responsive --- */

@media (max-width: 991.98px) {
  .tl-shell { flex-direction: column; }
  .tl-sidebar { width: 100%; flex-basis: auto; height: auto; position: static; flex-direction: column; }
  .tl-nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .tl-nav-section { width: 100%; padding-top: .5rem; }
  .tl-nav-link { margin-bottom: 0; }
  .tl-sidebar-footer { display: none; }
  .tl-hero h1 { font-size: 2.1rem; }
  .tl-summary-grid { grid-template-columns: 1fr; }
}

/* ======================================================== Credit Report -- */

/* ── Hero (identity + gauge) ─────────────────────────── */
.cr-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.cr-hero-name { font-size: 1.25rem; font-weight: 800; color: var(--navy-900); letter-spacing: -.02em; margin-bottom: 2px; }
.cr-hero-sub  { font-size: .82rem; color: var(--muted); margin-bottom: 14px; }
.cr-id-grid   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 18px; }
.cr-id-item label { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 1px; }
.cr-id-item span  { font-size: .82rem; font-weight: 600; color: var(--navy-800); }

/* ── Gauge ───────────────────────────────────────────── */
.cr-gauge-wrap { position: relative; width: 148px; height: 148px; flex-shrink: 0; }
.cr-gauge-wrap svg { overflow: visible; }
.cr-gauge-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center; line-height: 1.1;
  pointer-events: none;
}
.cr-gauge-num { font-size: 2.4rem; font-weight: 900; color: var(--navy-900); letter-spacing: -2px; }
.cr-gauge-max { font-size: .75rem; color: var(--muted); }
.cr-score-card { display: flex; flex-direction: column; align-items: center;
  justify-content: center; border-left: 1px solid var(--border); padding-left: 18px; }
.cr-score-label { font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-top: 6px; }
.cr-score-rating { display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; margin-top: 3px;
  background: var(--emerald-50); color: var(--emerald-700); }
.cr-score-factors { font-size: .72rem; color: var(--muted); text-align: center; margin-top: 6px; line-height: 1.4; }

/* ── Summary strip (dark navy) ───────────────────────── */
.cr-summary-strip {
  background: var(--navy-900);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.cr-sum-item { text-align: center; }
.cr-sum-val { font-size: 1.15rem; font-weight: 800; color: var(--emerald-500); }
.cr-sum-lbl { font-size: .7rem; color: rgba(255,255,255,.55); text-transform: uppercase;
  letter-spacing: .05em; margin-top: 2px; }

/* ── KPI cards ───────────────────────────────────────── */
.cr-kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 12px; }
.cr-kpi-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow-sm); }
.cr-kpi-lbl { font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.cr-kpi-val { font-size: 1.4rem; font-weight: 800; color: var(--navy-900); line-height: 1; }
.cr-kpi-val.green { color: var(--emerald-600); }
.cr-kpi-val.blue  { color: var(--info); }
.cr-kpi-val.amber { color: var(--warn); }
.cr-kpi-sub { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.cr-kpi-bar  { height: 4px; background: var(--border); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.cr-kpi-fill { height: 100%; border-radius: 99px; }

/* ── Utilization bar ─────────────────────────────────── */
.cr-util-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 18px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.cr-util-row  { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.cr-util-bg   { flex: 1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.cr-util-fill { height: 100%; border-radius: 99px; background: var(--emerald-600); }
.cr-util-pct  { font-size: .8rem; font-weight: 700; min-width: 36px; text-align: right; }

/* ── Section title ───────────────────────────────────── */
.cr-section-title {
  font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: var(--navy-800);
  border-bottom: 2px solid var(--slate-100);
  padding-bottom: 7px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 7px;
}
.cr-section-title .cr-count {
  background: var(--slate-100); color: var(--navy-700);
  font-size: .68rem; padding: 1px 7px; border-radius: 99px; font-weight: 700;
}

/* ── Account card ────────────────────────────────────── */
.cr-acc-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.cr-acc-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.cr-acc-card.closed { opacity: .88; }

.cr-acc-header {
  display: grid;
  grid-template-columns: 36px 1fr repeat(3, auto);
  align-items: center;
  gap: 10px 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background .12s;
}
.cr-acc-header:hover { background: var(--slate-50); }

.cr-acc-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; letter-spacing: -.5px;
  flex-shrink: 0;
}
.cr-acc-main .inst { font-size: .82rem; font-weight: 700; color: var(--navy-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.cr-acc-main .type { font-size: .72rem; color: var(--muted); }
.cr-acc-main .acno { font-family: monospace; font-size: .72rem; color: var(--muted); letter-spacing: .3px; }

.cr-acc-stat { text-align: right; }
.cr-acc-stat .val { font-size: .88rem; font-weight: 700; color: var(--navy-800); }
.cr-acc-stat .lbl { font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.cr-acc-status { font-size: .75rem; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.cr-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.cr-acc-body { display: none; border-top: 1px solid var(--border); padding: 12px 14px; }
.cr-acc-card.cr-acc-open .cr-acc-body { display: block; }

.cr-det-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.cr-det-item label { font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); display: block; margin-bottom: 1px; }
.cr-det-item span  { font-size: .78rem; font-weight: 600; color: var(--navy-800); }

/* ── Payment history grid ────────────────────────────── */
.cr-ph-lbl    { font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 5px; }
.cr-ph-row    { display: flex; gap: 3px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.cr-ph-col    { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
.cr-ph-cell   { width: 24px; height: 20px; border-radius: 4px; display: flex; align-items: center;
  justify-content: center; font-size: .6rem; font-weight: 800; color: #fff; }
.cr-ph-mkey   { font-size: .6rem; color: var(--muted); text-align: center; white-space: nowrap; }

.cr-ph-000    { background: var(--emerald-600); }
.cr-ph-STD    { background: var(--emerald-500); color: #fff; }
.cr-ph-NEW    { background: var(--info); }
.cr-ph-CLSD   { background: var(--slate-400); }
.cr-ph-30p    { background: var(--warn); }
.cr-ph-60p    { background: var(--danger); }
.cr-ph-90p    { background: #991b1b; }          /* 90+ days — deep red */
.cr-ph-woff   { background: #3b0764; color: #e9d5ff; } /* Written-off / Loss — dark purple */
.cr-ph-nodata { background: var(--slate-200); color: var(--muted); }

.cr-ph-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.cr-ph-legend-item { display: flex; align-items: center; gap: 3px; font-size: .7rem; color: var(--muted); }
.cr-ph-legend-dot  { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ── Late-payment notice ─────────────────────────────── */
.cr-notice {
  border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
  font-size: .78rem; display: flex; gap: 8px; align-items: flex-start;
}
.cr-notice.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #fcd34d; }
.cr-notice.info { background: var(--info-bg); color: var(--info); border: 1px solid #93c5fd; }

/* ── Enquiry table ───────────────────────────────────── */
.cr-enquiry-wrap { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.cr-enq-head { display: grid; grid-template-columns: 1fr auto auto;
  background: var(--slate-50); border-bottom: 1px solid var(--border);
  padding: 8px 14px; gap: 12px; }
.cr-enq-head span { font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
.cr-enq-head span:last-child { text-align: right; }
.cr-enq-row { display: grid; grid-template-columns: 1fr auto auto;
  padding: 9px 14px; border-bottom: 1px solid var(--border); gap: 12px; align-items: center; }
.cr-enq-row:last-of-type { border-bottom: none; }
.cr-enq-row:hover { background: var(--slate-50); }
.cr-enq-row .inst { font-size: .82rem; font-weight: 600; color: var(--navy-800); }
.cr-enq-row .date { font-size: .78rem; color: var(--muted); }
.cr-enq-row .amt  { font-size: .82rem; font-weight: 700; color: var(--navy-800); text-align: right; }
.cr-enq-foot { background: var(--slate-50); border-top: 1px solid var(--border);
  padding: 7px 14px; font-size: .72rem; color: var(--muted);
  display: flex; justify-content: space-between; }

/* ── Address cards ───────────────────────────────────── */
.cr-addr-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 18px; }
.cr-addr-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.cr-addr-type { font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
.cr-addr-text { font-size: .82rem; font-weight: 500; color: var(--navy-800); line-height: 1.4; }
.cr-addr-pin  { font-size: .72rem; color: var(--muted); margin-top: 2px; }

/* ── Score info badge row ────────────────────────────── */
.cr-score-info-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.cr-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.cr-badge-navy    { background: var(--slate-100); color: var(--navy-800); }
.cr-badge-emerald { background: var(--emerald-50); color: var(--emerald-700); }
.cr-badge-info    { background: var(--info-bg); color: var(--info); }

/* ── Print ───────────────────────────────────────────── */
@media print {
  .cr-acc-body { display: block !important; }
  .cr-summary-strip { background: var(--navy-900) !important; }
  .cr-acc-card { break-inside: avoid; }
  #cr-print-btn { display: none !important; }
}
