/* ================================================================
   FINDESK — Core Design System v2
   Premium offline UI: system Inter/Segoe font stack,
   rich gradient sidebar (scrollable), vibrant accent palette.
   ================================================================ */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Sidebar */
  --sb-w: 255px;
  --sb-bg-top: #0f1829;
  --sb-bg-bot: #0b1220;
  --sb-border: rgba(255,255,255,.06);
  --sb-link: #8da4c4;
  --sb-link-hover: #dde8f8;
  --sb-hover-bg: rgba(255,255,255,.07);
  --sb-active-bg: rgba(99,102,241,.22);
  --sb-active-fg: #a5b4fc;
  --sb-section: #4a617e;

  /* Brand */
  --brand-a: #818cf8;
  --brand-b: #4f46e5;

  /* App palette */
  --blue: #3b82f6;
  --blue-d: #2563eb;
  --blue-light: #eff6ff;
  --indigo: #6366f1;
  --indigo-d: #4f46e5;
  --green: #047857;
  --green-dark: #065f46;
  --red: #b91c1c;
  --red-dark: #991b1b;
  --amber: #f59e0b;
  --purple: #8b5cf6;

  /* Surfaces */
  --bg: #f1f5fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;

  /* Text */
  --text: #0f172a;
  --text-2: #1e293b;
  --text-3: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;

  /* Borders */
  --line: #e2e8f0;
  --line-2: #f0f4f8;

  /* Shadows */
  --sh-xs:  0 1px 2px rgba(15,23,42,.05);
  --sh-sm:  0 2px 6px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
  --sh-md:  0 6px 18px rgba(15,23,42,.09), 0 2px 6px rgba(15,23,42,.05);
  --sh-lg:  0 14px 36px rgba(15,23,42,.11), 0 4px 10px rgba(15,23,42,.06);
  --sh-xl:  0 24px 56px rgba(15,23,42,.14), 0 8px 20px rgba(15,23,42,.07);

  /* Radii */
  --r-xs: 5px;
  --r-sm: 8px;
  --r:    11px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --t: 160ms;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

/* ── Base Typography ────────────────────────────────────────────── */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  /* Best available system font on Windows (Segoe UI Variable → Aptos → Inter) */
  font-family:
    'Segoe UI Variable Text', 'Segoe UI Variable', 'Aptos', 'Inter',
    -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'kern' 1;
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR  — fixed, full-height, fully scrollable nav section
   ════════════════════════════════════════════════════════════════ */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sb-w);
  height: 100vh;           /* exact viewport height */
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sb-bg-top) 0%, var(--sb-bg-bot) 100%);
  border-right: 1px solid var(--sb-border);
  box-shadow: 4px 0 32px rgba(0,0,0,.25);
  z-index: 200;
  overflow: hidden;        /* clip children, not sidebar */
  transition: transform var(--t) var(--ease);
}

/* ── Brand mark ── */
.brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e8eef8;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.03em;
  padding: 20px 16px 12px;
  transition: opacity var(--t);
}
.brand:hover { opacity: .82; }

.brand-mark {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(145deg, #fcd34d, #f59e0b 55%, #c2410c);
  display: grid; place-items: center;
  color: #fffaf0;
  font-size: .8rem;
  font-weight: 700;
  font-family: 'Playfair Display', Georgia, serif;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(255,255,255,.22);
}

/* ── Workspace label ── */
.workspace {
  flex-shrink: 0;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--sb-section);
  padding: 0 18px 10px;
  border-bottom: 1px solid var(--sb-border);
  text-transform: uppercase;
}

/* ── Scrollable nav ── */
nav {
  flex: 1 1 0;             /* fills remaining height */
  overflow-y: auto;        /* scrolls when content overflows */
  overflow-x: hidden;
  padding: 6px 9px;
  /* thin custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
nav::-webkit-scrollbar       { width: 3px; }
nav::-webkit-scrollbar-track { background: transparent; }
nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.12);
  border-radius: 3px;
}
nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

/* Section headings */
nav > p {
  font-size: .585rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--sb-section);
  text-transform: uppercase;
  margin: 18px 9px 5px;
  padding: 0;
  display: block;
}

/* Nav links — slightly reduced font */
nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--sb-link);
  text-decoration: none;
  padding: 7.5px 10px;
  border-radius: var(--r-xs);
  margin: 1px 0;
  font-size: .795rem;     /* ≈12.7px — reduced as requested */
  font-weight: 500;
  letter-spacing: .01em;
  transition:
    background var(--t) var(--ease),
    color var(--t) var(--ease),
    border-color var(--t) var(--ease);
  border: 1px solid transparent;
  line-height: 1.35;
}
nav a i {
  font-style: normal;
  display: inline-grid;
  place-items: center;
  width: 15px;
  flex-shrink: 0;
  color: var(--sb-section);
  font-size: .82rem;
  transition: color var(--t) var(--ease);
}
nav a:hover {
  background: var(--sb-hover-bg);
  color: var(--sb-link-hover);
  border-color: rgba(255,255,255,.06);
}
nav a:hover i { color: #7a9abf; }
/* Active section — yellow highlight for every nav item */
nav a.active,
nav a[aria-current="page"] {
  font-weight: 800;
  letter-spacing: .01em;
  background: rgba(250, 204, 21, .14) !important;
  color: #facc15 !important;
  border-color: rgba(250, 204, 21, .4) !important;
}
nav a.active i,
nav a[aria-current="page"] i {
  color: #facc15 !important;
}
/* Entries stays yellow even when not active */
nav a.nav-entries,
nav a.nav-entries:hover {
  font-weight: 800;
  color: #facc15 !important;
}
nav a.nav-entries i,
nav a.nav-entries:hover i {
  color: #facc15 !important;
}

/* ── Bottom actions ── */
.sidebar-bottom {
  flex-shrink: 0;
  padding: 8px 9px 14px;
  border-top: 1px solid var(--sb-border);
  display: grid;
  gap: 1px;
}
.sidebar-bottom a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sb-section);
  text-decoration: none;
  font-size: .72rem;
  font-weight: 500;
  padding: 6.5px 10px;
  border-radius: var(--r-xs);
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.sidebar-bottom a:hover {
  background: var(--sb-hover-bg);
  color: var(--sb-link);
}

/* ════════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ════════════════════════════════════════════════════════════════ */
main {
  margin-left: var(--sb-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top header ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 58px;
  display: flex;
  align-items: center;
  padding: 0 26px;
  gap: 12px;
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--sh-xs);
}

#toggle {
  display: none;
  border: 0;
  background: var(--surface-3);
  border-radius: var(--r-sm);
  padding: 7px 9px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: background var(--t);
}
#toggle:hover { background: var(--line); color: var(--text); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
}
.breadcrumb span { color: var(--muted); }
.breadcrumb b { color: var(--subtle); font-weight: 400; }
.breadcrumb strong { color: var(--text-2); font-weight: 600; font-size: .84rem; }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.today {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c7d2fe, #e0e7ff);
  color: var(--indigo-d);
  display: grid; place-items: center;
  font-size: .7rem;
  font-weight: 800;
}
.user {
  font-size: .8rem;
  color: var(--text-3);
  font-weight: 500;
}

/* ── Page container ── */
.page {
  padding: 26px 30px;
  max-width: 1640px;
  width: 100%;
}

/* No top navbar — content starts at top */
body.no-topbar main.main-full { min-height: 100vh; }
body.no-topbar .page.compact-page {
  padding: 10px 14px 18px;
  max-width: none;
}
.mobile-toggle {
  display: none;
  position: sticky;
  top: 8px;
  z-index: 50;
  margin: 8px 10px 0;
  border: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.sidebar-user {
  padding: 8px 10px 6px;
  color: #cbd5e1;
  line-height: 1.3;
}
.sidebar-user strong {
  display: block;
  font-size: .82rem;
  color: #f1f5f9;
}
.sidebar-user small {
  display: block;
  font-size: .68rem;
  color: #94a3b8;
  margin-top: 2px;
}
.sidebar-user .expiry.dev { color: #86efac; }

.license-status-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  border-left: 4px solid #2563eb;
}
.license-status-card.is-warn {
  border-left-color: #d97706;
  background: #fffbeb;
}
.license-status-card.is-expired {
  border-left-color: #dc2626;
  background: #fef2f2;
}
.license-status-main h2 {
  font-size: .95rem !important;
  margin: 4px 0 0 !important;
  font-weight: 700 !important;
}
.license-status-main p {
  margin: 4px 0 0 !important;
  font-size: .75rem !important;
  color: var(--muted);
}
.license-status-date {
  text-align: right;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  min-width: 120px;
}
.license-status-date small {
  display: block;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.license-status-date strong {
  display: block;
  margin-top: 3px;
  font-size: .9rem;
  color: var(--text);
}
.nav-dropdown { margin: 1px 0; }
.nav-dropdown summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--sb-link);
  padding: 7.5px 10px;
  border-radius: var(--r-xs);
  font-size: .795rem;
  font-weight: 500;
  cursor: pointer;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown a {
  padding-left: 28px !important;
  font-size: .74rem !important;
}
.compact-hero { margin-bottom: 10px !important; padding: 10px 0 !important; }
.compact-hero h1 { font-size: 1.35rem !important; margin: 2px 0 !important; }
.compact-panel { padding: 0 !important; overflow: hidden; }
.panel-head.tight { padding: 8px 11px !important; }
.heading.tight { margin-bottom: 10px; gap: 8px; }
.heading.tight h1 { font-size: 1.25rem; margin: 0; }
.collection-history-head-left { min-width: 0; }
.collection-history-head h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.15;
}
.collection-history-title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.collection-history-date { margin: 0; }
.collection-history-date .filter-field {
  display: grid; gap: 4px; margin: 0;
  font-size: .68rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.collection-history-date .filter-date {
  min-height: 34px; min-width: 150px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: .84rem; font-weight: 600; color: var(--ink);
}
.collection-history-date .filter-date:focus {
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.collection-history-delete-cell { text-align: right; white-space: nowrap; }
.collection-history-delete-cell .ghost-button { min-height: 28px; padding: 0 8px; font-size: 11px; }
.statement-search-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 14px;
  width: min(420px, 100%);
}
.statement-search-bar input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink);
}
.statement-search-bar input[type="search"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.statement-results-hidden { display: none; }
.statement-search-form { margin-bottom: 14px; }
.statement-customer-section { display: grid; gap: 14px; }
.statement-customer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.statement-customer-identity { display: flex; gap: 14px; align-items: center; min-width: 0; }
.statement-customer-photo {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--indigo); flex-shrink: 0;
}
.statement-customer-photo.placeholder {
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg, #c7d2fe, #e0e7ff); color: var(--indigo-d);
}
.statement-customer-title-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.statement-customer-head h2,
.statement-heading-name { margin: 0; font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.statement-heading-time {
  margin: 6px 0 0; font-size: 1.1rem; font-weight: 700; color: #334155;
}
.statement-customer-meta { margin: 4px 0 0; color: var(--muted); font-size: .86rem; }
.entry-search-table { font-size: .9rem; table-layout: auto; }
.entry-search-table th,
.entry-search-table td {
  padding: 5px 6px !important;
  font-size: .9rem !important;
}
.entry-search-table th {
  font-size: .62rem !important;
  letter-spacing: .03em;
  padding: 4px 6px !important;
  line-height: 1.2;
}
.entry-search-name { font-size: 1rem !important; }
.entry-search-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 5px;
  align-items: flex-start;
}
.entry-search-actions .primary.sm {
  width: auto;
  white-space: nowrap;
  font-size: .82rem !important;
  padding: 5px 10px !important;
}
.entry-search-loan { white-space: nowrap; font-size: .9rem; }
.entry-customer-link {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 800;
  font-size: .95rem;
}
.entry-customer-link:hover { text-decoration: underline; color: #1e40af; }
.statement-status-badge {
  font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: .04em; border: 1px solid;
}
.statement-status-badge.status-green { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.statement-status-badge.status-red { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.statement-status-badge.status-gray { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.statement-stats { margin-bottom: 0 !important; }
.statement-alert { margin: 0; }
.statement-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px;
}
.statement-panel .panel-head h3 { margin: 0; font-size: .95rem; font-weight: 700; }
.statement-panel-body { padding: 10px 12px 12px; }
.statement-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
.statement-dl div { min-width: 0; }
.statement-dl div.full { grid-column: 1 / -1; }
.statement-dl dt { margin: 0; font-size: .66rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.statement-dl dd { margin: 2px 0 0; font-size: .82rem; font-weight: 600; color: var(--text-2); }
.statement-doc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line-2);
}
.statement-doc-row:last-child { border-bottom: 0; padding-bottom: 0; }
.statement-doc-type {
  display: block; font-size: .64rem; font-weight: 800; color: var(--indigo);
  text-transform: uppercase; letter-spacing: .04em;
}
.statement-doc-row strong { display: block; font-size: .88rem; }
.statement-doc-row small { display: block; color: var(--muted); font-size: .74rem; margin-top: 2px; }
.empty-inline { margin: 0; color: var(--muted); font-size: .84rem; }
.compact-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.compact-table th, .compact-table td { padding: 4px 7px !important; border-bottom: 1px solid var(--line-2); }
.compact-table th {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .03em;
  background: var(--surface-2); padding: 4px 7px !important; line-height: 1.2;
}
.row-paid { background: #ecfdf5 !important; }
.row-settled { background: #ecfdf5 !important; }
.row-overdue { background: #fef2f2 !important; }
.totals-row td { background: #f1f5f9; font-weight: 700; }
.settled-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #bbf7d0;
}
.metric-row { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.metric-row .metric { padding: 10px 12px; }
.metric-row .metric strong { font-size: 1rem; }
.live-search input { min-height: 32px; padding: 5px 10px; font-size: .8rem; width: min(310px, 100%); border: 1px solid var(--line); border-radius: 8px; }
.report-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.report-filters .filter-field { display: grid; gap: 5px; font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; min-width: 0; }
.report-filters .filter-select,
.report-filters .filter-date {
  min-height: 36px;
  min-width: 158px;
  padding: 7px 34px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  transition: border-color .15s, box-shadow .15s;
}
.report-filters .filter-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px;
  cursor: pointer;
}
.report-filters .filter-select:hover,
.report-filters .filter-date:hover { border-color: #cbd5e1; }
.report-filters .filter-select:focus,
.report-filters .filter-date:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.report-filters .export-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
@media (max-width: 720px) {
  .report-filters .filter-select,
  .report-filters .filter-date { min-width: 100%; width: 100%; }
  .report-filters .export-actions { margin-left: 0; width: 100%; }
}
.table-scroll { overflow-x: auto; }
@media (max-width: 900px) {
  .mobile-toggle { display: inline-block; }
}

/* ── Global compact UI (overrides large typography.css / redesign.css) ── */
body.no-topbar { font-size: .8125rem; }
body.no-topbar .page.compact-page { padding: 8px 12px 14px; }
body.no-topbar .hero h1,
body.no-topbar .compact-hero h1,
body.no-topbar .page-head h1,
body.no-topbar .heading h1 { font-size: 1rem !important; margin: 0 !important; font-weight: 700 !important; }
body.no-topbar .heading.collection-history-head h1 {
  font-size: 1.85rem !important;
  letter-spacing: -.035em !important;
  line-height: 1.15 !important;
}
body.no-topbar .hero p,
body.no-topbar .page-head .sub,
body.no-topbar .heading p { font-size: .75rem !important; margin: 2px 0 0 !important; }
body.no-topbar .eyebrow { font-size: .58rem !important; }
body.no-topbar .metric-row .metric { padding: 6px 8px !important; transform: none !important; box-shadow: none !important; }
body.no-topbar .metric-row .metric strong,
body.no-topbar .metric strong { font-size: .85rem !important; }
body.no-topbar .metric-row .metric small { font-size: .58rem !important; }
body.no-topbar .stats strong,
body.no-topbar article h2,
body.no-topbar .panel-head h2 { font-size: .82rem !important; }
body.no-topbar .primary,
body.no-topbar a.primary,
body.no-topbar button.primary,
body.no-topbar .ghost-button,
body.no-topbar a.ghost-button,
body.no-topbar button.ghost-button,
body.no-topbar .btn-danger,
body.no-topbar button.btn-danger {
  box-shadow: none !important;
  transform: none !important;
}
body.no-topbar .primary:hover,
body.no-topbar a.primary:hover,
body.no-topbar button.primary:hover,
body.no-topbar .ghost-button:hover,
body.no-topbar a.ghost-button:hover,
body.no-topbar button.ghost-button:hover {
  box-shadow: none !important;
  transform: none !important;
  opacity: 1 !important;
}
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.page-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-head-actions .primary.sm,
.page-head-actions .ghost-button.sm {
  min-height: 36px;
  padding: 0 16px;
  font-size: .875rem;
}
.loan-summary-top .page-head-actions .primary.sm,
.loan-summary-top .page-head-actions .ghost-button.sm {
  min-height: 38px;
  padding: 0 18px;
  font-size: .9rem;
}
.loan-summary-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--sh-xs);
}
.loan-summary-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: nowrap;
}
.loan-customer { display: flex; align-items: center; gap: 8px; min-width: 0; }
.loan-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--line); flex-shrink: 0;
}
.loan-avatar.placeholder {
  display: grid; place-items: center;
  background: linear-gradient(135deg, #c7d2fe, #e0e7ff);
  color: #4338ca; font-weight: 800; font-size: .95rem;
}
.loan-customer-meta { min-width: 0; }
.loan-customer-meta h1 { font-size: 1rem !important; margin: 0; line-height: 1.15; }
.loan-heading-name {
  font-size: 1.45rem !important; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 0;
}
.loan-heading-time {
  margin: 2px 0 0; font-size: .95rem; font-weight: 700; color: #334155;
}
.loan-customer-meta .eyebrow { margin-bottom: 0; }
.loan-customer-meta .sub { margin: 2px 0 0; font-size: .78rem; color: var(--muted); }
.loan-customer-meta .loan-meta-line {
  margin: 3px 0 0;
  font-size: .95rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  color: #475569;
}
.loan-customer-meta .loan-meta-line .loan-number {
  font-size: 1.15rem !important;
  font-weight: 800;
}
.loan-customer-meta .loan-meta-line .customer-mobile-display {
  font-size: .95rem;
  font-weight: 650;
  color: #334155;
}
.loan-summary-card .loan-heading-name {
  font-size: 1.45rem !important;
}
.loan-summary-card .page-head-actions {
  flex-shrink: 0;
  gap: 6px;
}
.loan-summary-card .loan-stat {
  padding: 8px 8px !important;
}
.loan-summary-card .loan-stat small {
  font-size: .62rem !important;
  margin-bottom: 3px !important;
}
.loan-summary-card .loan-stat b {
  font-size: .95rem !important;
}
.customer-name-display {
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.02em;
}
.cp-sub-sep { color: #94a3b8; font-weight: 600; }
.loan-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.loan-stat {
  padding: 8px 6px;
  text-align: center;
  border-right: 1px solid var(--line-2);
  background: #fafbfc;
}
.loan-stat:last-child { border-right: none; }
.loan-stat small {
  display: block;
  color: var(--muted);
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 3px;
  line-height: 1.2;
}
.loan-stat b { display: block; font-size: .82rem; font-weight: 700; color: var(--text); }
.loan-summary-card .loan-customer-meta h1.loan-heading-name {
  font-size: 1.45rem !important;
}
.loan-schedule-panel .compact-table,
.loan-schedule-panel .loan-schedule-table {
  font-size: .88rem;
}
.loan-schedule-panel .compact-table th,
.loan-schedule-panel .loan-schedule-table th {
  font-size: .62rem !important;
  padding: 4px 7px !important;
  letter-spacing: .03em;
  line-height: 1.2;
}
.loan-schedule-panel .compact-table td,
.loan-schedule-panel .loan-schedule-table td {
  font-size: .78rem !important;
  padding: 4px 7px !important;
}
.loan-schedule-panel .compact-table td small,
.loan-schedule-panel .loan-schedule-table td small {
  font-size: .7rem !important;
}
.loan-schedule-panel .panel-head.tight {
  padding: 6px 10px !important;
}
.loan-schedule-panel .panel-head h2 {
  font-size: .85rem;
  margin: 0;
}
.loan-schedule-panel .panel-head p {
  font-size: .68rem;
  margin: 2px 0 0;
}
.loan-stat.highlight { background: #f0fdf4; }
.loan-stat.highlight b { color: #065f46; }
.loan-stat.warn { background: #fffbeb; }
.loan-stat.warn b { color: #92400e; }
.loan-stat.overdue-stat { background: #fef2f2; }
.loan-stat.overdue-stat b { color: #b91c1c; }
@media (max-width: 900px) {
  .loan-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .loan-stat { border-bottom: 1px solid var(--line-2); }
  .loan-stat:nth-child(3n) { border-right: none; }
}
@media (max-width: 520px) {
  .loan-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loan-stat:nth-child(3n) { border-right: 1px solid var(--line-2); }
  .loan-stat:nth-child(2n) { border-right: none; }
}
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stat-strip span { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px; background: #fff; border-radius: 6px; border: 1px solid var(--line-2); }
.stat-strip small { color: var(--muted); font-size: .62rem; font-weight: 700; text-transform: uppercase; }
.stat-strip b { font-size: .8rem; font-weight: 700; color: var(--text); }
/* ════════════════════════════════════════════════════════════════
   BUTTONS — professional, flat, consistent sizing
   ════════════════════════════════════════════════════════════════ */
button,
input[type="submit"],
input[type="button"] {
  font-family: inherit;
}

.primary,
a.primary,
button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid #1e40af;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.primary:hover,
a.primary:hover,
button.primary:hover {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #fff;
  opacity: 1;
  transform: none;
  box-shadow: 0 2px 4px rgba(15, 23, 42, .08);
}

.primary:active,
a.primary:active,
button.primary:active {
  background: #1e3a8a;
  transform: none;
  box-shadow: none;
}

.primary:focus-visible,
a.primary:focus-visible,
button.primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .28);
}

.primary.sm,
a.primary.sm {
  min-height: 34px;
  padding: 0 14px;
  font-size: .8125rem;
}

.ghost-button,
a.ghost-button,
button.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.ghost-button:hover,
a.ghost-button:hover,
button.ghost-button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
  transform: none;
  box-shadow: 0 2px 4px rgba(15, 23, 42, .06);
}

.ghost-button:focus-visible,
a.ghost-button:focus-visible,
button.ghost-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, .35);
}

.ghost-button.sm,
a.ghost-button.sm {
  min-height: 34px;
  padding: 0 14px;
  font-size: .8125rem;
}

.btn-danger,
button.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  background: #fff;
  color: #dc2626;
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: background .15s ease, border-color .15s ease;
}

.btn-danger:hover,
button.btn-danger:hover {
  background: #fef2f2;
  border-color: #f87171;
  transform: none;
  box-shadow: none;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-table a.primary,
.compact-table a.ghost-button {
  min-height: 30px;
  padding: 0 12px;
  font-size: .78rem;
  font-weight: 600;
}

.export-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.export-actions .ghost-button {
  min-height: 38px;
  padding: 0 16px;
  font-size: .8125rem;
}
.inline-delete { display: inline; margin: 0; }
.operator-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.operator-password-card { border: 1px solid #bfdbfe; background: #f8fbff; }
.compact-table tr.row-active { background: #eff6ff; }
.muted { color: var(--muted); font-size: .72rem; }

/* ════════════════════════════════════════════════════════════════
   TYPOGRAPHY & HEADINGS
   ════════════════════════════════════════════════════════════════ */
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.heading.tight { margin-bottom: 8px; }
.heading h1, .form-card h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.035em;
  color: var(--text);
  line-height: 1.2;
}
.heading p {
  color: var(--muted);
  margin: 5px 0 0;
  font-size: .875rem;
}

/* ════════════════════════════════════════════════════════════════
   STAT CARDS
   ════════════════════════════════════════════════════════════════ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}
.stats > div, article, .form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.stats > div:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.stats small {
  display: block;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.stats strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.04em;
  margin-top: 7px;
  color: var(--text);
}
.danger strong { color: var(--red); }

/* ════════════════════════════════════════════════════════════════
   GRID & ARTICLE
   ════════════════════════════════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
article h2 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0;
  letter-spacing: -.01em;
}

/* ════════════════════════════════════════════════════════════════
   TABLE
   ════════════════════════════════════════════════════════════════ */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--sh-xs);
}
th {
  text-align: left;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.2;
  white-space: nowrap;
}
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line-2); }
thead th { padding: 5px 8px !important; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbff; }
td { font-size: .85rem; color: var(--text-3); }
td a { color: var(--blue-d); font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════════════════════
   BADGE
   ════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.past-due { color: #991b1b; }
.credit-cell { color: #065f46; font-weight: 600; }
.debit-cell { color: #991b1b; }
.balance-cell { color: #1e3a5f; }
.ledger-table th.num,
.ledger-table td.num { text-align: right; white-space: nowrap; }
.ledger-table .totals-row td { border-top: 2px solid var(--line); }

/* ════════════════════════════════════════════════════════════════
   SEARCH & FORMS
   ════════════════════════════════════════════════════════════════ */
.search { display: flex; gap: 9px; margin-bottom: 14px; }
.search input { max-width: 360px; }

label {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-2);
}
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid #d0d9e8;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  box-shadow: var(--sh-xs);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-d);
  box-shadow: 0 0 0 3px rgba(59,130,246,.14);
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--subtle); }

/* ── Form card ── */
.form-card { max-width: 700px; margin: auto; border-radius: var(--r-md); }
.form-card p { display: grid; grid-template-columns: 175px 1fr; gap: 13px; align-items: center; }

/* ════════════════════════════════════════════════════════════════
   ALERTS & ERRORS
   ════════════════════════════════════════════════════════════════ */
.error { color: var(--red); font-size: .8rem; }
.alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: #f0fdf4; color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  font-size: .85rem; font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════
   AUTH PAGE
   ════════════════════════════════════════════════════════════════ */
.auth {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(145deg, #0f1829 0%, #1a2e58 45%, #2563eb 100%);
}
body:has(.auth) .page { padding: 0; max-width: none; }
.auth-card {
  width: min(430px, 94vw);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 36px;
  box-shadow: var(--sh-xl);
  border: 1px solid rgba(255,255,255,.08);
}
.auth-card h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.03em; margin-bottom: 4px; }
.auth-card p { display: grid; gap: 5px; }
.auth-card p:last-child { display: block; color: var(--muted); font-size: .875rem; }
.auth-card a { color: var(--blue-d); font-weight: 500; }
.auth-pro { grid-template-columns: minmax(280px, 480px) minmax(340px, 430px); gap: clamp(40px, 9vw, 150px); padding: 28px; }
.auth-panel { color: #e8eef8; max-width: 460px; }
.auth-brand { display:flex; align-items:center; gap:12px; margin-bottom:48px; }
.auth-mark {
  width:38px; height:38px; display:grid; place-items:center; border-radius:11px;
  font-family:'Playfair Display', Georgia, serif; font-weight:700; font-size:1rem; color:#fffaf0;
  background:linear-gradient(145deg,#fcd34d,#f59e0b 55%,#c2410c);
  box-shadow:0 8px 22px rgba(245,158,11,.4), inset 0 1px 0 rgba(255,255,255,.22);
}
.auth-kicker { display:block; color:#fbbf24; font-size:.67rem; letter-spacing:.15em; font-weight:800; }
.auth-panel h1 { font-size:clamp(2rem,4vw,3.15rem); line-height:1.08; letter-spacing:-.05em; margin:12px 0 17px; }
.auth-panel > p { color:#b7c7df; max-width:390px; font-size:1rem; }
.auth-points { display:grid; gap:10px; margin-top:34px; color:#dce7f8; font-size:.86rem; }
.auth-points span { display:flex; gap:9px; align-items:center; }
.auth-login-card { padding:36px; width:min(430px,94vw); }
.auth-card-head h2 { font-size:1.55rem; letter-spacing:-.04em; margin:5px 0; }
.auth-card-head p { color:var(--muted); font-size:.87rem; margin-bottom:26px; }
.auth-field { margin:0 0 17px; }.auth-field label { display:block; margin-bottom:6px; font-size:.78rem; }.auth-field input { padding:10px 12px; }
.auth-submit { width:100%; justify-content:center; margin-top:6px; padding:11px 16px; }.auth-footer { margin:22px 0 0; text-align:center; color:var(--muted); font-size:.82rem; }.auth-error { color:#b91c1c; background:#fef2f2; border:1px solid #fecaca; padding:9px 11px; border-radius:7px; margin-bottom:16px; font-size:.8rem; }
.auth-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 13px; }
.auth-field-full { grid-column:1 / -1; }.auth-help { display:block; color:var(--muted); font-size:.7rem; line-height:1.45; margin-top:5px; }
.auth-help ul { margin:4px 0 0 17px; padding:0; }.auth-help li { margin:2px 0; }
.auth-register { grid-template-columns:minmax(280px,480px) minmax(390px,510px); align-items:center; }.auth-register-card { width:min(510px,94vw); padding:32px 36px 26px; }.auth-register-card .auth-card-head p { margin-bottom:20px; }.auth-register-card .auth-field { margin-bottom:12px; }.auth-register-card .auth-field input { padding:9px 11px; }.auth-register-card .auth-submit { margin-top:4px; }.auth-register-card .auth-footer { margin-top:17px; }
.auth-status-page { grid-template-columns:minmax(280px,480px) minmax(350px,450px); }.auth-status-card { width:min(450px,94vw); }.approval-state { display:flex; gap:12px; align-items:flex-start; padding:14px; border-radius:10px; margin:22px 0 16px; }.approval-state.pending { background:#fffbeb; color:#92400e; }.approval-state.active { background:#f0fdf4; color:#166534; }.approval-state.blocked { background:#fef2f2; color:#991b1b; }.approval-dot { width:10px; height:10px; margin-top:6px; border-radius:50%; background:currentColor; box-shadow:0 0 0 4px rgba(255,255,255,.55); }.approval-state b,.approval-state small { display:block; }.approval-state small { margin-top:2px; font-size:.77rem; line-height:1.45; }.approval-details { display:grid; grid-template-columns:1fr auto; gap:8px 20px; padding:14px 0; border-top:1px solid var(--line-2); border-bottom:1px solid var(--line-2); font-size:.8rem; }.approval-details span { color:var(--muted); }.approval-details strong,.approval-details code { color:var(--text); font-weight:700; }.approval-details code { background:var(--surface-3); border-radius:5px; padding:2px 5px; }.approval-note { margin:15px 0; padding:11px 13px; background:var(--surface-2); border:1px solid var(--line-2); border-radius:8px; font-size:.78rem; }.approval-note b { color:var(--text-2); }.approval-note p { margin:3px 0 0; color:var(--muted); }.approval-refresh,.auth-status-message { color:var(--muted); font-size:.8rem; margin:17px 0; text-align:center; }
@media (max-width: 780px) { .auth-pro { grid-template-columns:1fr; gap:30px; padding:26px 18px; align-content:center; }.auth-panel { display:none; }.auth-login-card,.auth-register-card { margin:auto; }.auth-register-card { padding:28px 23px 22px; } }
@media (max-width: 460px) { .auth-form-grid { grid-template-columns:1fr; }.auth-field-half { grid-column:1 / -1; } }

/* ════════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════════ */
.help, .subtle {
  color: var(--muted); font-size: .73rem; margin-top: 4px; display: block;
}
.payment-guide {
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  padding: 11px 14px; margin: 14px 0;
  line-height: 1.6; font-size: .875rem;
}
.charts article { min-height: 270px; }
.charts canvas { width: 100%; height: 225px; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: var(--sh-xl); }
  #toggle { display: flex; }
  main { margin-left: 0; }
  .page { padding: 15px; }
  .grid { grid-template-columns: 1fr; }
  .heading { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  table { display: block; overflow-x: auto; }
  .form-card p { display: block; }
  .form-card label { display: block; margin-bottom: 5px; }
}

/* ── Demo trial badge ──────────────────────────────────────────── */
.sidebar-user .expiry.demo-badge {
  color: #fbbf24;
  font-weight: 600;
  background: rgba(251,191,36,.13);
  border-radius: 4px;
  padding: 1px 6px;
  display: inline-block;
  margin-top: 4px;
}

/* ── Loan preview: fee note / deducted / remaining ─────────────── */
.prev-fee-note {
  font-size: .66rem;
  font-weight: 400;
  opacity: .65;
  margin-left: 2px;
}
.prev-deduct-val { color: #d97706; }
.prev-remaining-val { color: #2563eb; font-weight: 700; }
.loan-stat.deduct-stat b { color: #d97706; }
.loan-stat.remaining-stat b { color: #2563eb; }

/* ── Full-screen activation overlay ───────────────────────────── */
.activation-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Inter', system-ui, sans-serif;
  pointer-events: auto;
}
body.activation-locked main,
body.activation-locked #sidebar,
body.activation-locked .mobile-toggle {
  pointer-events: none;
  user-select: none;
}
body.activation-locked main {
  filter: blur(3px);
}
.activation-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 28, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.activation-card {
  position: relative;
  width: min(480px, 96vw);
  background: linear-gradient(145deg, #1e2a45 0%, #141c30 100%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  padding: 40px 36px 32px;
  box-shadow: 0 40px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06) inset;
  text-align: center;
  animation: slideUpFade .4s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(30px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}
.activation-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 12px;
}
.activation-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 99px;
  background: linear-gradient(90deg, #ef4444, #dc2626);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.activation-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0 0 8px;
  line-height: 1.15;
}
.activation-subtitle {
  color: #94a3b8;
  font-size: .875rem;
  margin: 0 0 22px;
  line-height: 1.55;
}
.activation-price-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(37,99,235,.25), rgba(139,92,246,.2));
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 14px;
  padding: 16px 24px;
  margin-bottom: 20px;
}
.activation-price-label {
  font-size: .78rem;
  color: #94a3b8;
  font-weight: 500;
  text-align: left;
}
.activation-price {
  font-size: 2rem;
  font-weight: 900;
  color: #a78bfa;
  letter-spacing: -.02em;
}
.activation-info-grid {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
  text-align: left;
}
.activation-info-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.activation-info-row:last-child { border-bottom: none; }
.activation-info-label {
  font-size: .7rem;
  font-weight: 600;
  color: #64748b;
  min-width: 110px;
  flex-shrink: 0;
}
.activation-info-value {
  font-size: .8rem;
  color: #cbd5e1;
  font-weight: 500;
}
.activation-info-code {
  font-size: .7rem;
  color: #818cf8;
  background: rgba(99,102,241,.1);
  border-radius: 4px;
  padding: 2px 6px;
  word-break: break-all;
  font-family: monospace;
}
.activation-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
  text-align: left;
}
.activation-steps span {
  font-size: .78rem;
  color: #94a3b8;
  padding: 5px 10px;
  background: rgba(255,255,255,.03);
  border-radius: 6px;
  border-left: 3px solid #6366f1;
}
.activation-steps span b { color: #a5b4fc; }
.activation-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.activation-btn-primary {
  display: block;
  padding: 14px 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff !important;
  font-weight: 700;
  font-size: .9rem;
  border-radius: 12px;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 8px 24px rgba(99,102,241,.35);
}
.activation-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(99,102,241,.45);
}
.activation-btn-secondary {
  display: block;
  padding: 11px 20px;
  background: rgba(255,255,255,.07);
  color: #94a3b8 !important;
  font-weight: 500;
  font-size: .85rem;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.1);
  transition: background .15s, color .15s;
}
.activation-btn-secondary:hover {
  background: rgba(255,255,255,.12);
  color: #e2e8f0 !important;
}

/* ── Global emphasis colors (dark green / red) ── */
.text-success-dark { color: var(--green-dark) !important; font-weight: 700; }
.text-danger-dark { color: var(--red-dark) !important; font-weight: 700; }
.text-danger { color: var(--red) !important; font-weight: 650; }
.text-success { color: var(--green) !important; font-weight: 650; }
.text-muted { color: var(--muted); }

/* ── Loan number styling ── */
.loan-number,
.loan-number-link,
a.loan-number-link {
  color: #1e3a8a !important;
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
}
.loan-number-link:hover,
a.loan-number-link:hover {
  color: #1e40af !important;
  text-decoration: underline;
}
.loan-number.loan-number-pending,
.loan-number-link.loan-number-pending,
a.loan-number-link.loan-number-pending {
  color: #991b1b !important;
}
.loan-number.loan-number-pending:hover,
.loan-number-link.loan-number-pending:hover,
a.loan-number-link.loan-number-pending:hover {
  color: #7f1d1d !important;
}

.loan-customer-meta h1.loan-number {
  color: #1e3a8a;
  font-size: inherit;
}
.loan-customer-meta h1.loan-number.loan-number-pending {
  color: #991b1b;
}
.cp-sub .loan-number {
  font-size: 1.35rem;
  font-weight: 800;
}
.cp-sub .loan-number.loan-number-pending {
  color: #991b1b !important;
}
.row-pending { background: #fef2f2 !important; }
.row-pending:hover { background: #fee2e2 !important; }
.highlight-col { background: rgba(254, 243, 199, .25); }
.collect-total { color: var(--red-dark); font-size: 1rem; }
.collect-breakdown {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}
.pending-alert-panel { border-color: #fecaca; background: #fff5f5; }
.pending-alert-panel h2 { color: var(--red-dark); }
.view-tabs { display: flex; gap: 8px; }
.view-tabs a,
.view-tab-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-3);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.view-tabs a.active,
.view-tabs a:hover,
.view-tab-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}
.delete-loan-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delete-password-input {
  max-width: 110px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: .82rem;
}

/* ── Overview P&L report ── */
.report-date-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.report-date-form label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.report-date-form input[type="date"] {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: .875rem;
}

/* Date inputs: show DD/MM/YYYY while keeping native picker + Y-m-d value */
.date-ddmmyyyy-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.date-ddmmyyyy-wrap input[type="date"] {
  color: transparent;
  caret-color: transparent;
}
.date-ddmmyyyy-wrap input[type="date"]::-webkit-datetime-edit,
.date-ddmmyyyy-wrap input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.date-ddmmyyyy-wrap input[type="date"]::-webkit-datetime-edit-text,
.date-ddmmyyyy-wrap input[type="date"]::-webkit-datetime-edit-month-field,
.date-ddmmyyyy-wrap input[type="date"]::-webkit-datetime-edit-day-field,
.date-ddmmyyyy-wrap input[type="date"]::-webkit-datetime-edit-year-field {
  color: transparent;
}
.date-ddmmyyyy-display {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: inherit;
  color: var(--text, #172033);
  white-space: nowrap;
}
.date-ddmmyyyy-wrap input[type="date"]::-webkit-calendar-picker-indicator {
  position: relative;
  z-index: 1;
  cursor: pointer;
}
.pnl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px 18px 20px;
}
.pnl-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface-2);
}
.pnl-item small {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.pnl-item strong {
  display: block;
  margin-top: 6px;
  font-size: 1.15rem;
  font-weight: 750;
}
.pnl-item .pnl-net-hint {
  display: block;
  margin-top: 6px;
  font-size: .68rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}
.pnl-item.income { border-left: 4px solid var(--green-dark); }
.pnl-item.expense { border-left: 4px solid var(--red-dark); }
.pnl-item.net { background: #f8fafc; }
.profit-metric {
  background: linear-gradient(160deg, #064e3b 0%, #065f46 100%) !important;
  border-color: #047857 !important;
}
.profit-metric::after {
  background: linear-gradient(90deg, #10b981, #34d399) !important;
}
.profit-metric small,
.profit-metric span {
  color: #a7f3d0 !important;
}
.profit-metric strong {
  color: #ecfdf5 !important;
  font-size: 1.65rem !important;
}

/* ── Delete loan modal ── */
.delete-loan-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.delete-loan-modal[hidden] { display: none !important; }
.delete-loan-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .5);
}
.delete-loan-modal-dialog {
  position: relative;
  width: min(420px, 94vw);
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: var(--sh-xl);
  border: 1px solid var(--line);
}
.delete-loan-modal-dialog h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--red-dark);
}
.delete-loan-modal-dialog p {
  margin: 0 0 16px;
  font-size: .9rem;
  color: var(--text-3);
}
.delete-loan-modal-dialog label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}
.delete-loan-modal-dialog input[type="password"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .95rem;
  margin-bottom: 16px;
}
.delete-loan-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.all-print-meta,
.pending-print-meta,
.all-print-totals,
.pending-print-totals {
  display: none;
}

/* Address / guarantor columns: screen table unchanged; shown in print/PDF reports */
.print-only-col {
  display: none !important;
}

/* Used when Pending-only view is active — row stays available for Print all */
.screen-hide-row {
  display: none !important;
}

@media print {
  body.print-pending-loans #sidebar,
  body.print-pending-loans .mobile-toggle,
  body.print-pending-loans .page-head-actions,
  body.print-pending-loans .pending-alert-panel,
  body.print-pending-loans .live-search,
  body.print-pending-loans .dashboard-top-search,
  body.print-pending-loans .view-tabs,
  body.print-pending-loans .no-print-col,
  body.print-pending-loans .all-print-totals,
  body.print-pending-loans .screen-totals-row,
  body.print-pending-loans #deleteLoanModal,
  body.print-pending-loans .alert,
  body.print-all-loans #sidebar,
  body.print-all-loans .mobile-toggle,
  body.print-all-loans .page-head-actions,
  body.print-all-loans .pending-alert-panel,
  body.print-all-loans .live-search,
  body.print-all-loans .dashboard-top-search,
  body.print-all-loans .view-tabs,
  body.print-all-loans .no-print-col,
  body.print-all-loans .pending-print-totals,
  body.print-all-loans .screen-totals-row,
  body.print-all-loans #deleteLoanModal,
  body.print-all-loans .alert {
    display: none !important;
  }

  body.print-pending-loans .main-full,
  body.print-pending-loans .page,
  body.print-pending-loans .dashboard-entries-panel,
  body.print-all-loans .main-full,
  body.print-all-loans .page,
  body.print-all-loans .dashboard-entries-panel {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  body.print-pending-loans .page-head h1,
  body.print-all-loans .page-head h1 {
    font-size: 1.25rem;
    margin: 0 0 8px;
  }

  body.print-pending-loans .pending-print-meta,
  body.print-all-loans .all-print-meta {
    display: block;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
  }

  body.print-pending-loans .pending-print-meta .eyebrow,
  body.print-all-loans .all-print-meta .eyebrow {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
  }

  body.print-pending-loans .pending-print-meta h2,
  body.print-all-loans .all-print-meta h2 {
    margin: 6px 0 4px;
    font-size: 1.2rem;
  }

  body.print-pending-loans .pending-print-meta p,
  body.print-all-loans .all-print-meta p {
    margin: 0;
    color: #64748b;
    font-size: .85rem;
  }

  body.print-pending-loans .dashboard-entries-panel .panel-head,
  body.print-all-loans .dashboard-entries-panel .panel-head {
    display: none !important;
  }

  body.print-pending-loans .dashboard-entries-panel,
  body.print-pending-loans .table-scroll,
  body.print-all-loans .dashboard-entries-panel,
  body.print-all-loans .table-scroll {
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  /* Mobile block-table layout draws a scrollbar in saved PDFs — restore normal tables */
  body.print-pending-loans table,
  body.print-all-loans table {
    display: table !important;
    overflow: visible !important;
    width: 100% !important;
  }

  body.print-pending-loans .loan-register-table thead,
  body.print-pending-loans .loan-register-table tbody,
  body.print-pending-loans .loan-register-table tfoot,
  body.print-all-loans .loan-register-table thead,
  body.print-all-loans .loan-register-table tbody,
  body.print-all-loans .loan-register-table tfoot {
    display: table-row-group !important;
  }

  body.print-pending-loans .loan-register-table tr,
  body.print-all-loans .loan-register-table tr {
    display: table-row !important;
  }

  /* Hide only non-pending data rows (not the header row) */
  body.print-pending-loans tbody tr:not(.row-pending) {
    display: none !important;
  }

  body.print-all-loans .screen-hide-row {
    display: table-row !important;
  }

  body.print-all-loans .all-print-totals,
  body.print-pending-loans .pending-print-totals {
    display: table-footer-group !important;
  }

  body.print-pending-loans .loan-register-table,
  body.print-all-loans .loan-register-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 11px;
  }

  /* Keep Entry/Delete columns hidden in both header and body so columns stay aligned */
  body.print-pending-loans .no-print-col,
  body.print-all-loans .no-print-col {
    display: none !important;
  }

  /* Show Address / Guarantor columns in both header and body */
  body.print-pending-loans th.print-only-col,
  body.print-pending-loans td.print-only-col,
  body.print-all-loans th.print-only-col,
  body.print-all-loans td.print-only-col {
    display: table-cell !important;
  }

  body.print-pending-loans .loan-register-table th,
  body.print-pending-loans .loan-register-table td,
  body.print-all-loans .loan-register-table th,
  body.print-all-loans .loan-register-table td {
    border: 1px solid #cbd5e1;
    padding: 5px 6px;
    vertical-align: top;
    white-space: normal;
  }

  body.print-pending-loans .loan-number-link,
  body.print-all-loans .loan-number-link.loan-number-pending {
    color: #991b1b !important;
    text-decoration: none !important;
  }

  body.print-all-loans .loan-number-link {
    color: #0f172a !important;
    text-decoration: none !important;
  }

  body.print-pending-loans .print-address-cell,
  body.print-all-loans .print-address-cell {
    min-width: 110px;
    max-width: 160px;
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 10px;
    line-height: 1.25;
  }

  body.print-pending-loans .loan-register-table thead th,
  body.print-all-loans .loan-register-table thead th {
    background: #f1f5f9 !important;
    color: #334155 !important;
    font-size: 9px !important;
    text-transform: uppercase;
    letter-spacing: .02em;
    white-space: nowrap;
  }

  body.print-pending-loans .loan-register-table .text-danger,
  body.print-all-loans .loan-register-table .text-danger,
  body.print-pending-loans .status-pill.status-overdue,
  body.print-all-loans .status-pill.status-overdue {
    color: #991b1b !important;
  }

  body.print-pending-loans .dashboard-page-head .dashboard-top-search,
  body.print-all-loans .dashboard-page-head .dashboard-top-search {
    display: none !important;
  }

  body.print-pending-loans tfoot.screen-totals-row,
  body.print-pending-loans tfoot.all-print-totals,
  body.print-all-loans tfoot.screen-totals-row,
  body.print-all-loans tfoot.pending-print-totals {
    display: none !important;
  }

  @page {
    margin: 10mm;
    size: A4 portrait;
  }
}
