/* LMS design system: AUFLUENCE-CORE's (and the CRM's) tokens, shell and components, so staff moving
   between the apps find the same look. Rules: AUFLUENCE-CORE uiux-rules.md (principles.md §5).
   Every colour is a token below; components use var(--...) only. */

/* ── 0. Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Brand = gold/amber: identity only (logo, hero accents, gold figures). Never on controls. */
  --color-brand:         #d97706;
  --color-brand-light:   #f59e0b;
  --color-brand-lighter: #fcd34d;  /* the shine on the Aura ring */
  --color-brand-rgb:     217, 119, 6;
  /* Action = indigo: every interactive element. */
  --color-action:        #4f46e5;
  --color-action-dark:   #4338ca;
  --color-action-light:  #6366f1;
  --color-action-rgb:    79, 70, 229;
  /* Indigo tints for text on dark surfaces (WCAG AA). */
  --color-action-lighter:  #818cf8;
  --color-action-lighter-rgb: 129, 140, 248;
  --color-action-lightest: #a5b4fc;
  --color-action-lightest-rgb: 165, 180, 252;
  /* Semantic: dark enough for text on white and for white text on them (4.5:1). */
  --color-success:       #047857;
  --color-success-rgb:   4, 120, 87;
  --color-success-light: #34d399;
  --color-warning:       #f59e0b;
  --color-warning-rgb:   245, 158, 11;
  --color-danger:        #dc2626;
  --color-danger-rgb:    220, 38, 38;
  --color-danger-light:  #f87171;
  /* Neutrals (Slate) */
  --color-n950: #0f172a;
  --color-n900: #111827;
  --color-n700: #334155;
  --color-n500: #64748b;
  --color-n400: #94a3b8;
  --color-n300: #cbd5e1;
  --color-n100: #f1f5f9;
  --color-n50:  #f8fafc;
  --color-white: #ffffff;
  --color-black-rgb: 0, 0, 0;
  --color-white-rgb: 255, 255, 255;
  --color-border: rgba(var(--color-black-rgb), .09);

  /* Bootstrap kept in step with the system */
  --bs-primary:          var(--color-action);
  --bs-primary-rgb:      var(--color-action-rgb);
  --bs-link-color:       var(--color-action);
  --bs-link-color-rgb:   var(--color-action-rgb);
  --bs-link-hover-color: var(--color-action-dark);
  --bs-success:          var(--color-success);
  --bs-success-rgb:      var(--color-success-rgb);
  --bs-warning:          var(--color-warning);
  --bs-warning-rgb:      var(--color-warning-rgb);
  --bs-danger:           var(--color-danger);
  --bs-danger-rgb:       var(--color-danger-rgb);
  --bs-body-font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading:        "Sora", "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:           "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Spacing (multiples of 4px) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px;
  /* Radius */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-xl: 20px; --radius-circle: 50%;
  /* Elevation */
  --shadow-elevation-1: 0 1px 3px rgba(var(--color-black-rgb), .08);
  --shadow-elevation-2: 0 4px 12px rgba(var(--color-black-rgb), .12);
  --shadow-elevation-3: 0 4px 20px rgba(var(--color-black-rgb), .20);
  --shadow-elevation-4: 0 8px 32px rgba(var(--color-black-rgb), .24);
  /* Timing */
  --t-micro: 100ms ease-out;
  --dur-standard: 200ms;
  --dur-slide: 250ms;
  --t-standard: var(--dur-standard) ease-in-out;
  --t-slide: var(--dur-slide) cubic-bezier(.4, 0, .2, 1);
  /* Micro-interactions */
  --press-scale: .98;       /* a card or tile pressed, a touch less than a button's .97 */
  --hover-lift: -2px;       /* a card lifting under the mouse */
  --rise-distance: 8px;     /* how far a row rises as it fades in */
  --stagger-step: 35ms;     /* the gap between one row's entrance and the next */
  /* Z stack */
  --z-sticky: 100; --z-sidebar: 1020; --z-navbar: 1025; --z-bottom-nav: 1030; --z-fab: 1035;
  --z-action-bar: 1031; --z-dropdown: 1050; --z-modal: 1060; --z-toast: 1070; --z-tooltip: 1080;
  /* Shell sizes (the same as the CRM and AUFLUENCE-CORE) */
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --navbar-height: 57px;
  --bottom-nav-height: 64px;
  --fab-size: 52px;
  --content-max-width: 1280px;

  /* The four gradients: use no others. */
  --gradient-hero:    linear-gradient(135deg, var(--color-action), #6f42c1);
  --gradient-danger:  linear-gradient(135deg, #dc3545, #fd7e14);
  --gradient-success: linear-gradient(135deg, #198754, #20c997);
  --gradient-gold:    linear-gradient(135deg, var(--color-brand-light), var(--color-brand));

  /* Status pill pairs (tinted: safe in light and dark) */
  --pill-open-bg:   rgba(var(--color-action-rgb), .12);  --pill-open-fg:   var(--color-action-dark);
  --pill-active-bg: rgba(var(--color-warning-rgb), .16); --pill-active-fg: #92400e;
  --pill-done-bg:   rgba(var(--color-success-rgb), .14); --pill-done-fg:   #065f46;
  --pill-lost-bg:   rgba(var(--color-danger-rgb), .12);  --pill-lost-fg:   #b91c1c;
  --pill-hold-bg:   rgba(100, 116, 139, .14);            --pill-hold-fg:   var(--color-n700);

  --surface-page: var(--color-n50);
  --surface-sidebar: var(--color-n950);
  --bottom-nav-bg: rgba(var(--color-white-rgb), .9);

  /* Modals: the CRM's glass panel */
  --modal-glass-bg: rgba(var(--color-white-rgb), .85);
  --modal-border: rgba(var(--color-white-rgb), .5);
  --modal-shadow: 0 25px 50px -12px rgba(var(--color-black-rgb), .25);
  --modal-backdrop-overlay: rgba(var(--color-white-rgb), .7);
  --modal-backdrop-blur: 12px;
  --modal-title-color: var(--color-action);
}

[data-bs-theme="dark"] {
  --color-border: rgba(var(--color-white-rgb), .09);
  --surface-page: #0b1120;
  --surface-sidebar: #060a14;
  --bottom-nav-bg: rgba(5, 9, 18, .9);
  --pill-open-fg: #a5b4fc; --pill-active-fg: #fcd34d; --pill-done-fg: #6ee7b7;
  --pill-lost-fg: #fca5a5; --pill-hold-fg: var(--color-n300);
  --bs-link-color: var(--color-action-lightest);
  --bs-link-color-rgb: var(--color-action-lightest-rgb);
  --bs-link-hover-color: var(--color-white);
  --bs-link-hover-color-rgb: var(--color-action-lighter-rgb);
  --modal-glass-bg: rgba(15, 23, 42, .92);
  --modal-border: rgba(var(--color-white-rgb), .08);
  --modal-shadow: 0 25px 50px -12px rgba(var(--color-black-rgb), .5);
  --modal-backdrop-overlay: rgba(var(--color-black-rgb), .5);
  --modal-title-color: var(--color-action-light);
}
/* Text in the action and state colours, lifted to tints that pass on dark surfaces. */
[data-bs-theme="dark"] .text-primary { color: var(--color-action-lighter) !important; }
[data-bs-theme="dark"] .text-success { color: var(--color-success-light) !important; }
[data-bs-theme="dark"] .text-danger { color: var(--color-danger-light) !important; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: var(--color-action-lighter);
  --bs-btn-border-color: var(--color-action-lighter); --bs-btn-hover-color: var(--color-white); }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: var(--color-n300); --bs-btn-border-color: var(--color-n500);
  --bs-btn-hover-color: var(--color-n950); --bs-btn-hover-bg: var(--color-n300); --bs-btn-hover-border-color: var(--color-n300);
  --bs-btn-active-color: var(--color-n950); --bs-btn-active-bg: var(--color-n300); }
[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color: var(--color-danger-light); --bs-btn-border-color: var(--color-danger-light); }
[data-bs-theme="dark"] .initials, [data-bs-theme="dark"] .nav-tile .nt-icon,
[data-bs-theme="dark"] .page-icon, [data-bs-theme="dark"] .card-head .bi:first-child { color: var(--color-action-lighter); }

/* ── 1. Base ───────────────────────────────────────────────────────────── */
body {
  background: var(--surface-page);
  font-family: var(--bs-body-font-family);
  font-size: .9375rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, .h1, .h2, .h3, .h4, .page-title { font-family: var(--font-heading); letter-spacing: -.01em; }
.num, .font-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--color-action); outline-offset: 2px; }
.btn:active { transform: scale(.97); transition: transform var(--t-micro); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--color-action); --bs-btn-border-color: var(--color-action);
  --bs-btn-hover-bg: var(--color-action-dark); --bs-btn-hover-border-color: var(--color-action-dark);
  --bs-btn-active-bg: var(--color-action-dark); --bs-btn-disabled-bg: var(--color-action);
  --bs-btn-disabled-border-color: var(--color-action); font-weight: 600; }
.btn-outline-primary { --bs-btn-color: var(--color-action); --bs-btn-border-color: var(--color-action);
  --bs-btn-hover-bg: var(--color-action); --bs-btn-hover-border-color: var(--color-action);
  --bs-btn-active-bg: var(--color-action-dark); }
.btn-outline-danger { --bs-btn-color: var(--color-danger); --bs-btn-border-color: var(--color-danger);
  --bs-btn-hover-bg: var(--color-danger); --bs-btn-hover-border-color: var(--color-danger);
  --bs-btn-active-bg: var(--color-danger); --bs-btn-active-border-color: var(--color-danger); }
/* Bootstrap's grey (#6c757d) is just under 4.5:1 on the page surface. */
.btn-outline-secondary { --bs-btn-color: var(--color-n700); }
/* `hidden` always wins over Bootstrap's !important display utilities. */
[hidden][hidden] { display: none !important; }
.form-control, .form-select { border-radius: var(--radius-sm); }
.form-label, .field-label { font-weight: 600; font-size: .85rem; margin-bottom: var(--space-1); }
.form-text { font-size: .8rem; }
/* A mandatory field's label ends in a red asterisk; app.js sets the class from `required`. */
.label-required::after { content: " *"; color: var(--color-danger); }
[data-bs-theme="dark"] .label-required::after { color: var(--color-danger-light); }
.card { border-radius: var(--radius-lg); border-color: var(--color-border); box-shadow: var(--shadow-elevation-1); }
.alert { border-radius: var(--radius-md); }
.table { --bs-table-bg: transparent; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color);
  font-weight: 700; }
/* Small-caps group label, 12px: the floor for any text in the app. */
.section-label { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--bs-secondary-color); margin-bottom: var(--space-2); }
.min-w-0 { min-width: 0; }

@media (max-width: 991.98px) {
  .btn, .form-control, .form-select { min-height: 44px; }
  .btn { min-width: 44px; }
  .btn-lg, .form-control-lg, .form-select-lg { min-height: 48px; }
  .form-control, .form-select { font-size: 1rem; } /* no iOS zoom on focus */
  .form-check-label { padding-block: 11px; min-width: 44px; display: inline-block; }
  .back-link { min-height: 44px; margin-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ── 2. Shell ──────────────────────────────────────────────────────────── */
#wrapper { display: flex; min-height: 100vh; min-height: 100dvh; }

#sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface-sidebar); color: var(--color-white); z-index: var(--z-sidebar);
  transition: width var(--t-slide), transform var(--t-slide);
  display: flex; flex-direction: column; scrollbar-width: thin;
}
#sidebar .sidebar-brand {
  display: flex; align-items: center; gap: var(--space-3); min-height: 64px;
  padding: var(--space-3) var(--space-4); color: var(--color-white); text-decoration: none;
  border-bottom: 1px solid rgba(var(--color-white-rgb), .08);
}
/* The Aura logo (ui.brand_logo): a gold ring in an amber halo. The halo is its own glow, so no tile. */
.brand-mark { width: 38px; height: 38px; flex-shrink: 0; display: inline-block; }
.brand-mark-lg { width: 64px; height: 64px; }
.aura-logo .aura-halo-core { stop-color: var(--color-brand-light); stop-opacity: .5; }
.aura-logo .aura-halo-edge { stop-color: var(--color-brand-light); stop-opacity: 0; }
.aura-logo .aura-ring-shine { stop-color: var(--color-brand-lighter); }
.aura-logo .aura-ring-deep { stop-color: var(--color-brand); }
.aura-logo .aura-halo-line { fill: none; stroke: var(--color-brand-light); stroke-width: .75; opacity: .55; }
.aura-logo .aura-glint { fill: none; stroke: var(--color-white); stroke-width: 1.4; stroke-linecap: round; opacity: .75; }
.aura-logo .aura-spark { fill: var(--color-white); }
/* On a light surface the white glint and spark would vanish: tint them gold. */
[data-bs-theme="light"] .pp-header .aura-spark, [data-bs-theme="light"] .pp-footer .aura-spark,
[data-bs-theme="light"] .login-shell .aura-spark { fill: var(--color-brand); }
.brand-name { font-family: var(--font-heading); font-weight: 700; font-size: 1rem; white-space: nowrap; line-height: 1.2; }
.brand-name small { display: block; font-family: var(--bs-body-font-family); font-weight: 500;
  font-size: .68rem; color: rgba(var(--color-white-rgb), .55); letter-spacing: .04em; }
.sidebar-group {
  padding: var(--space-4) var(--space-5) var(--space-1); font-size: .65rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: rgba(var(--color-white-rgb), .55); white-space: nowrap;
}
#sidebar .nav-link {
  display: flex; align-items: center; gap: 10px; height: 40px; margin: 2px var(--space-2);
  padding: 0 var(--space-3); border-radius: var(--radius-sm);
  color: rgba(var(--color-white-rgb), .78); font-size: .875rem; white-space: nowrap; overflow: hidden;
  transition: background var(--t-micro), color var(--t-micro);
}
#sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
#sidebar .nav-link:hover { background: rgba(var(--color-white-rgb), .07); color: var(--color-white); }
#sidebar .nav-link.active { background: rgba(var(--color-white-rgb), .12); color: var(--color-white); font-weight: 600; }
#sidebar .nav-link.active i { color: var(--color-brand-light); }
.sidebar-user {
  margin-top: auto; padding: var(--space-3) var(--space-4); border-top: 1px solid rgba(var(--color-white-rgb), .08);
  display: flex; align-items: center; gap: var(--space-2); font-size: .8rem;
}
.avatar {
  width: 32px; height: 32px; border-radius: var(--radius-circle); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-action); color: var(--color-white); font-weight: 700; font-size: .8rem;
}
.sidebar-user .who { min-width: 0; }
.sidebar-user .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .who .sub { color: rgba(var(--color-white-rgb), .55); font-size: .72rem; }
#sidebar .sidebar-icon-btn { background: rgba(var(--color-white-rgb), .08); border-color: rgba(var(--color-white-rgb), .12);
  color: var(--color-white); }
#sidebar .sidebar-icon-btn:hover { background: rgba(var(--color-white-rgb), .16); color: var(--color-white); }
.sidebar-collapse-btn {
  background: none; border: 0; color: rgba(var(--color-white-rgb), .6); width: 40px; height: 40px;
  border-radius: var(--radius-sm); margin: var(--space-2) auto;
}
.sidebar-collapse-btn:hover { background: rgba(var(--color-white-rgb), .07); color: var(--color-white); }
@media (min-width: 992px) {
  .sidebar-collapsed #sidebar { width: var(--sidebar-collapsed-width); }
  .sidebar-collapsed #sidebar .nav-label, .sidebar-collapsed #sidebar .brand-name,
  .sidebar-collapsed #sidebar .sidebar-group, .sidebar-collapsed #sidebar .who { display: none; }
  .sidebar-collapsed #sidebar .nav-link { justify-content: center; padding: 0; }
  .sidebar-collapsed #sidebar .sidebar-brand { justify-content: center; padding-inline: 0; }
  .sidebar-collapsed #sidebar .sidebar-collapse-btn i { transform: rotate(180deg); }
}

#page-content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }

#topNavbar {
  position: sticky; top: 0; z-index: var(--z-navbar); min-height: var(--navbar-height);
  background: rgba(var(--bs-body-bg-rgb), .92); border-bottom: 1px solid var(--color-border);
  -webkit-backdrop-filter: blur(12px) saturate(180%); backdrop-filter: blur(12px) saturate(180%);
  display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-4);
}
#topNavbar .page-crumb { font-size: .85rem; color: var(--bs-secondary-color); }
#topNavbar .page-crumb a { color: inherit; text-decoration: none; }
#topNavbar .page-crumb a:hover { color: var(--color-action); }
#topNavbar .page-crumb .current { color: var(--bs-body-color); font-weight: 600; }
#topNavbar .mobile-title { font-family: var(--font-heading); font-weight: 600; font-size: 1rem; min-width: 0;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  background: var(--bs-body-bg); color: var(--bs-body-color); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
@media (max-width: 991.98px) { .icon-btn { width: 44px; height: 44px; } }
/* The Apps switcher: each sibling app with the job it does. */
.apps-menu { min-width: 280px; padding: var(--space-2); }
.apps-menu .dropdown-item { display: flex; align-items: center; gap: var(--space-3); border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3); white-space: normal; min-height: 52px; }
/* The sibling-app badge, in the Apps menu and on the product page. */
.apps-menu .app-icon, .pp-app .app-icon { width: 36px; height: 36px; border-radius: var(--radius-md); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .75rem;
  background: rgba(var(--color-action-rgb), .1); color: var(--color-action); font-family: var(--font-heading); }
[data-bs-theme="dark"] .apps-menu .app-icon, [data-bs-theme="dark"] .pp-app .app-icon { color: var(--color-action-lighter); }

main.page { flex: 1 1 auto; padding: var(--space-4); width: 100%; max-width: var(--content-max-width); margin: 0 auto; }
@media (min-width: 768px) { main.page { padding: var(--space-6); } }

#bottomNav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom-nav-height);
  background: var(--bottom-nav-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--color-border); box-shadow: 0 -8px 24px rgba(var(--color-black-rgb), .06);
  z-index: var(--z-bottom-nav); padding: 0 var(--space-1) env(safe-area-inset-bottom);
}
#bottomNav .bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--color-n500); font-size: .75rem; font-weight: 600; letter-spacing: .02em;
  transition: color var(--t-micro);
}
#bottomNav .bn-item i { font-size: 1.375rem; transition: transform var(--t-micro); }
#bottomNav .bn-item.active { color: var(--color-action); }
#bottomNav .bn-item.active i { transform: scale(1.08); }
#bottomNav .bn-item:active { opacity: .7; transform: scale(.93); }
[data-bs-theme="dark"] #bottomNav .bn-item { color: var(--color-n400); }
[data-bs-theme="dark"] #bottomNav .bn-item.active { color: var(--color-action-lighter); }

#fab {
  display: none; position: fixed; right: var(--space-4); bottom: calc(var(--bottom-nav-height) + 8px);
  width: var(--fab-size); height: var(--fab-size); border-radius: var(--radius-circle);
  background: var(--color-action); color: var(--color-white); font-size: 1.5rem;
  align-items: center; justify-content: center; text-decoration: none; border: 0; padding: 0;
  box-shadow: 0 4px 16px rgba(var(--color-action-rgb), .45); z-index: var(--z-fab);
  transition: transform var(--t-micro), box-shadow var(--t-micro);
}
#fab:active { transform: scale(.92); box-shadow: var(--shadow-elevation-2); }

#sidebarBackdrop { display: none; position: fixed; inset: 0; background: var(--modal-backdrop-overlay);
  -webkit-backdrop-filter: blur(var(--modal-backdrop-blur)) saturate(180%);
  backdrop-filter: blur(var(--modal-backdrop-blur)) saturate(180%); z-index: calc(var(--z-sidebar) - 1); }

@media (max-width: 991.98px) {
  #sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); width: var(--sidebar-width); }
  /* The open drawer covers the top bar, bottom nav and FAB, under dialogs and menus. */
  .sidebar-open #sidebar { transform: none; box-shadow: var(--shadow-elevation-4); z-index: calc(var(--z-dropdown) - 1); }
  .sidebar-open #sidebarBackdrop { display: block; animation: backdrop-in var(--t-slide); z-index: calc(var(--z-dropdown) - 2); }
  .sidebar-collapse-btn { display: none; }
  /* Who is signed in sits under the logo in the drawer. */
  #sidebar .sidebar-brand { order: -2; }
  .sidebar-user { order: -1; margin-top: 0; border-top: 0; border-bottom: 1px solid rgba(var(--color-white-rgb), .08); }
  #bottomNav { display: flex; }
  #fab { display: inline-flex; }
  main.page { padding-bottom: calc(var(--bottom-nav-height) + var(--space-8) + 56px); }
  .has-action-bar #fab { display: none; }
  .is-typing #bottomNav { display: none; }
  .is-typing .action-bar { bottom: 0; }
}
html:has(> body.has-action-bar), body.has-action-bar { overscroll-behavior-y: contain; }
@media (min-width: 992px) { main.page { padding-bottom: calc(var(--space-8) + 72px); } }
.skip-link:focus { z-index: var(--z-toast); }

/* Toasts (flash messages) */
#toastStack {
  position: fixed; top: calc(var(--navbar-height) + var(--space-3)); right: var(--space-4);
  z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2); width: min(420px, calc(100vw - 32px));
}
@media (max-width: 575.98px) { #toastStack { left: var(--space-4); right: var(--space-4); width: auto; } }
.app-toast {
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); background: var(--bs-body-bg); box-shadow: var(--shadow-elevation-3);
  border: 1px solid var(--color-border); border-left: 4px solid var(--color-action); font-size: .875rem;
  animation: toast-in var(--t-standard);
}
.app-toast.t-success { border-left-color: var(--color-success); }
.app-toast.t-danger { border-left-color: var(--color-danger); }
.app-toast.t-warning { border-left-color: var(--color-warning); }
.app-toast .t-icon { font-size: 1.1rem; line-height: 1.3; color: var(--color-action); }
.app-toast.t-success .t-icon { color: var(--color-success); }
.app-toast.t-danger .t-icon { color: var(--color-danger); }
.app-toast.t-warning .t-icon { color: var(--color-warning); }
[data-bs-theme="dark"] .app-toast.t-success .t-icon { color: var(--color-success-light); }
[data-bs-theme="dark"] .app-toast.t-danger .t-icon { color: var(--color-danger-light); }
.app-toast .t-body { flex: 1; }
.app-toast.hiding { opacity: 0; transform: translateY(-6px); transition: opacity var(--t-standard), transform var(--t-standard); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* A success toast draws its tick: the ring, then the check. */
.t-check { width: 1.25rem; height: 1.25rem; flex-shrink: 0; margin-top: 1px; fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.t-check circle { stroke-dasharray: 63; stroke-dashoffset: 63; animation: draw-stroke 420ms ease-out forwards; }
.t-check path { stroke-dasharray: 14; stroke-dashoffset: 14; animation: draw-stroke 240ms 340ms ease-out forwards; }
@keyframes draw-stroke { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .t-check circle, .t-check path { animation: none; stroke-dashoffset: 0; } }

/* Page changes cross-fade where the browser supports it; the header holds its place. */
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
.page-header { view-transition-name: page-header; }
::view-transition-old(root) { animation: page-fade-out var(--t-standard) both; }
::view-transition-new(root) { animation: page-fade-in var(--t-slide) both; }
@keyframes page-fade-out { to { opacity: 0; } }
@keyframes page-fade-in { from { opacity: 0; } }

/* ── 3. Page header ───────────────────────────────────────────────────── */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-5); }
.page-title-row { display: flex; align-items: center; gap: var(--space-3); }
.page-header .page-title { font-size: 1.5rem; font-weight: 700; margin: 0; line-height: 1.3; }
.page-header .page-sub { color: var(--bs-secondary-color); font-size: .875rem; margin-top: 2px;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
@media (max-width: 767.98px) { .page-header .page-title { font-size: 1.25rem; } }
.page-icon { width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem;
  background: rgba(var(--color-action-rgb), .1); color: var(--color-action);
  box-shadow: inset 0 0 0 1px rgba(var(--color-action-rgb), .12); animation: icon-pop var(--t-slide) backwards; }
@media (max-width: 767.98px) { .page-icon { width: 36px; height: 36px; font-size: 1.05rem; } }
[data-bs-theme="dark"] .page-icon { background: rgba(var(--color-action-lighter-rgb), .12);
  box-shadow: inset 0 0 0 1px rgba(var(--color-action-lighter-rgb), .16); }
.back-link { display: inline-flex; align-items: center; gap: var(--space-1); font-size: .82rem;
  color: var(--bs-secondary-color); text-decoration: none; margin-bottom: var(--space-1); }
.back-link:hover { color: var(--color-action); }

/* ── 4. Components ────────────────────────────────────────────────────── */
/* Status pill: open = working, active = waiting on someone, done, lost = failed/ended badly, hold = inactive. */
.status-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-xl);
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; line-height: 1.5;
  white-space: nowrap; }
.sp-open { background: var(--pill-open-bg); color: var(--pill-open-fg); }
.sp-active { background: var(--pill-active-bg); color: var(--pill-active-fg); }
.sp-done { background: var(--pill-done-bg); color: var(--pill-done-fg); }
.sp-lost { background: var(--pill-lost-bg); color: var(--pill-lost-fg); }
.sp-hold { background: var(--pill-hold-bg); color: var(--pill-hold-fg); }

/* Cards with a labelled head */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
.card-head h2 { font-family: var(--bs-body-font-family); font-size: .75rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--bs-secondary-color); margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.card-head h2 .bi:first-child { font-size: 1.1em; color: var(--color-action); }
.card-head .card-head-link { font-size: .8rem; font-weight: 600; text-decoration: none; display: inline-flex;
  align-items: center; gap: var(--space-1); min-height: 32px; }
.card-body + .card-body { border-top: 1px solid var(--color-border); }
.card > .table, .card .table-flush { margin-bottom: 0; }
.card .table-flush > :not(caption) > * > * { padding-left: var(--space-4); padding-right: var(--space-4); }

/* List card (CRM lead card pattern) */
.list-stack { display: flex; flex-direction: column; gap: var(--space-2); }
.list-card {
  display: block; border-radius: var(--radius-lg); border: 1px solid var(--color-border);
  border-left: 4px solid transparent; background: var(--bs-body-bg); box-shadow: var(--shadow-elevation-1);
  color: var(--bs-body-color); text-decoration: none; overflow: hidden;
  transition: box-shadow var(--t-micro), transform var(--t-micro);
}
a.list-card:hover { box-shadow: var(--shadow-elevation-2); color: var(--bs-body-color); }
a.list-card:active { transform: scale(var(--press-scale)); }
.list-card .lc-body { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.list-card .lc-main { flex: 1; min-width: 0; }
.list-card .lc-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.list-card .lc-title { font-weight: 700; font-size: 1rem; line-height: 1.25; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.list-card .lc-meta { font-size: .8rem; color: var(--bs-secondary-color); display: flex; flex-wrap: wrap;
  gap: var(--space-1) var(--space-3); margin-top: 2px; }
.list-card .lc-meta > span { white-space: nowrap; }
.list-card .lc-meta i { font-size: .75rem; margin-right: 2px; }
.list-card .lc-amount { font-family: var(--font-mono); font-weight: 500; white-space: nowrap; }
.list-card .lc-chevron { color: var(--color-n400); flex-shrink: 0; transition: transform var(--t-standard); }
.urgency-danger  { border-left-color: var(--color-danger) !important; }
.urgency-warning { border-left-color: var(--color-warning) !important; }
.urgency-info    { border-left-color: var(--color-action-light) !important; }
.urgency-success { border-left-color: var(--color-success) !important; }
.urgency-hold    { border-left-color: var(--color-n300) !important; }

/* Initials avatar */
.initials { width: 40px; height: 40px; border-radius: var(--radius-circle); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
  background: rgba(var(--color-action-rgb), .12); color: var(--color-action); }
.initials.initials-icon { font-size: 1.1rem; }

/* Identity hero (customer, application, loan) */
.identity-hero {
  position: relative; background: var(--gradient-hero); color: var(--color-white); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5); box-shadow: 0 4px 20px rgba(var(--color-action-rgb), .28);
  margin-bottom: var(--space-4);
}
.identity-hero > :not(.hero-backdrop) { position: relative; }
.identity-hero .ih-row { display: flex; align-items: center; gap: var(--space-3); }
.identity-hero .initials { width: 52px; height: 52px; background: rgba(var(--color-white-rgb), .18);
  color: var(--color-white); border: 2px solid rgba(var(--color-white-rgb), .4); font-size: 1rem; }
.identity-hero .ih-name { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; line-height: 1.2;
  margin: 0; overflow-wrap: anywhere; }
.identity-hero .ih-meta { font-size: .82rem; opacity: .9; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3);
  margin-top: 2px; }
.identity-hero .ih-meta a { color: inherit; }
.identity-hero .ih-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.identity-hero .ih-pill { display: inline-flex; align-items: center; gap: 4px; background: rgba(var(--color-white-rgb), .2);
  border: 1px solid rgba(var(--color-white-rgb), .4); border-radius: var(--radius-xl); padding: 3px 10px;
  font-size: .75rem; font-weight: 600; }
.identity-hero .ih-pill.ih-alert { background: rgba(var(--color-danger-rgb), .85); border-color: transparent; }
.identity-hero .ih-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3);
  margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid rgba(var(--color-white-rgb), .2); }
@media (min-width: 768px) { .identity-hero .ih-figures { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.identity-hero .ih-fig-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }
.identity-hero .ih-fig-value { font-family: var(--font-mono); font-size: 1.15rem; font-weight: 500; line-height: 1.3; }
.identity-hero .more-menu-btn { color: inherit; border-color: rgba(var(--color-white-rgb), .6); }
.identity-hero .more-menu-btn:hover { background: rgba(var(--color-white-rgb), .15); color: var(--color-white); }
.identity-hero.ended { background: var(--gradient-success); box-shadow: 0 4px 20px rgba(var(--color-success-rgb), .28); }
.identity-hero.stopped { background: linear-gradient(135deg, var(--color-n700), var(--color-n950)); box-shadow: var(--shadow-elevation-2); }
.identity-hero.alarm { background: var(--gradient-danger); box-shadow: 0 4px 20px rgba(var(--color-danger-rgb), .28); }

/* Stepper: where an application or loan is in its flow */
.stage-stepper { display: flex; gap: 3px; margin-bottom: var(--space-4); }
.stage-step { flex: 1 1 0; min-width: 0; text-align: center; font-size: .75rem; font-weight: 600;
  color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .03em; }
.stage-step .bar { height: 4px; border-radius: 2px; background: var(--bs-border-color); margin-bottom: 6px; }
.stage-step.done { color: var(--bs-body-color); }
.stage-step.done .bar { background: var(--color-success); }
.stage-step.current .bar { background: var(--color-action); }
.stage-step.current { color: var(--color-action); }
.stage-step.lost .bar { background: var(--color-danger); }
.stage-caption { margin: calc(-1 * var(--space-2)) 0 var(--space-4); font-size: .75rem; font-weight: 600;
  color: var(--color-action); text-transform: uppercase; letter-spacing: .03em; }
[data-bs-theme="dark"] .stage-step.current, [data-bs-theme="dark"] .stage-caption { color: var(--color-action-lighter); }
@media (max-width: 767.98px) {
  .stage-step .stage-label { display: none; }
  .stage-step .bar { margin-bottom: 0; }
}

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-tile { background: var(--bs-body-bg); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevation-1); padding: var(--space-3) var(--space-4); border-left: 4px solid transparent;
  color: var(--bs-body-color); text-decoration: none; display: block; min-width: 0; }
a.stat-tile:hover { box-shadow: var(--shadow-elevation-2); color: var(--bs-body-color); }
.stat-tile .st-value { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 500; line-height: 1.2;
  overflow-wrap: anywhere; }
.stat-tile .st-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--bs-secondary-color); margin-top: 2px; }
.stat-tile .st-note { font-size: .78rem; color: var(--bs-secondary-color); margin-top: 2px; }
.stat-tile.accent-primary { border-left-color: var(--color-action); }
.stat-tile.accent-success { border-left-color: var(--color-success); }
.stat-tile.accent-warning { border-left-color: var(--color-warning); }
.stat-tile.accent-danger { border-left-color: var(--color-danger); }
.stat-tile.accent-gold { border-left-color: var(--color-brand); }

/* Home tiles */
.nav-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (min-width: 768px) { .nav-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .nav-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.nav-tile { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4);
  border-radius: var(--radius-lg); background: var(--bs-body-bg); border: 1px solid var(--color-border);
  box-shadow: var(--shadow-elevation-1); color: var(--bs-body-color); text-decoration: none; min-height: 112px;
  transition: box-shadow var(--t-micro), transform var(--t-micro); }
.nav-tile:hover { box-shadow: var(--shadow-elevation-2); color: var(--bs-body-color); }
.nav-tile:active { transform: scale(var(--press-scale)); }
.nav-tile .nt-icon { width: 40px; height: 40px; border-radius: var(--radius-md); display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.2rem; transition: transform var(--t-standard);
  background: rgba(var(--color-action-rgb), .1); color: var(--color-action); }
.nav-tile .nt-label { font-weight: 700; font-size: .95rem; }
.nav-tile .nt-hint { font-size: .78rem; color: var(--bs-secondary-color); line-height: 1.3; }
.home-group + .home-group { margin-top: var(--space-6); }
/* A queue's waiting count on its home tile: gold, the brand colour, as in AUFLUENCE-CORE. */
.nav-tile { position: relative; }
.nav-tile.has-count { border-color: rgba(var(--color-brand-rgb), .45); }
.nav-count { position: absolute; top: var(--space-3); right: var(--space-3); display: inline-flex; align-items: center;
  justify-content: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: var(--radius-xl);
  background: var(--color-brand-light); color: var(--color-n950); font-family: var(--font-mono); font-size: .8rem;
  font-weight: 500; box-shadow: 0 2px 8px rgba(var(--color-brand-rgb), .35); animation: icon-pop var(--t-slide) backwards; }

/* Gold hero (home greeting) */
.welcome-hero { position: relative; background: var(--gradient-gold); color: var(--color-white); border-radius: var(--radius-lg);
  padding: var(--space-5); margin-bottom: var(--space-5); box-shadow: 0 4px 20px rgba(var(--color-brand-rgb), .28); }
.welcome-hero > :not(.hero-backdrop) { position: relative; }
.welcome-hero .wh-title { font-family: var(--font-heading); font-size: 1.35rem; font-weight: 700; margin: 0; }
.welcome-hero .wh-sub { opacity: .92; font-size: .875rem; }
.welcome-hero .wh-search { margin-top: var(--space-4); max-width: 560px; }
.welcome-hero .wh-search .form-control { border: 0; }
.welcome-hero .wh-search .btn { background: var(--color-n950); color: var(--color-white); border: 0; }
.welcome-hero .wh-action { color: var(--color-brand); font-weight: 700; border: 0; }

/* Hero backdrop: two soft glows and a large faint icon behind the content. */
.hero-backdrop { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.hb-glow { position: absolute; top: -60px; right: -40px; width: 180px; height: 180px; border-radius: var(--radius-circle);
  background: rgba(var(--color-white-rgb), .22); filter: blur(32px); }
.hb-glow-2 { top: auto; right: auto; bottom: -70px; left: 20%; width: 140px; height: 140px;
  background: rgba(var(--color-white-rgb), .14); }
.hb-mark { position: absolute; right: -12px; bottom: -28px; font-size: 7.5rem; line-height: 1;
  color: rgba(var(--color-white-rgb), .14); transform: rotate(-12deg); }
@keyframes glow-drift { to { transform: translate(-24px, 16px) scale(1.1); } }
@media (prefers-reduced-motion: no-preference) {
  .hb-glow { animation: glow-drift 12s ease-in-out infinite alternate; }
  .hb-glow-2 { animation-delay: -6s; }
}

/* Empty state */
.empty-state { text-align: center; padding: var(--space-8) var(--space-4); color: var(--bs-secondary-color); }
.empty-state .es-icon { width: 88px; height: 88px; margin: 0 auto var(--space-4); border-radius: var(--radius-circle);
  display: flex; align-items: center; justify-content: center; color: var(--color-action);
  background: rgba(var(--color-action-rgb), .08);
  box-shadow: 0 0 0 10px rgba(var(--color-action-rgb), .04), 0 0 0 20px rgba(var(--color-action-rgb), .02);
  animation: icon-pop var(--t-slide) backwards; }
.empty-state .es-icon i { font-size: 2.25rem; line-height: 1; }
.empty-state.es-danger .es-icon { color: var(--color-danger); background: rgba(var(--color-danger-rgb), .08);
  box-shadow: 0 0 0 10px rgba(var(--color-danger-rgb), .04), 0 0 0 20px rgba(var(--color-danger-rgb), .02); }
.empty-state.es-compact { padding: var(--space-5) var(--space-4); }
.empty-state.es-compact .es-icon { width: 56px; height: 56px; margin-bottom: var(--space-3);
  box-shadow: 0 0 0 8px rgba(var(--color-action-rgb), .04); }
.empty-state.es-compact .es-icon i { font-size: 1.4rem; }
[data-bs-theme="dark"] .empty-state .es-icon { color: var(--color-action-lighter); background: rgba(var(--color-action-lighter-rgb), .1);
  box-shadow: 0 0 0 10px rgba(var(--color-action-lighter-rgb), .05), 0 0 0 20px rgba(var(--color-action-lighter-rgb), .025); }
[data-bs-theme="dark"] .empty-state.es-danger .es-icon { color: var(--color-danger-light); }
.empty-state .es-title { font-weight: 700; font-size: 1rem; color: var(--bs-body-color); }
.empty-state .es-sub { font-size: .875rem; margin-top: 2px; max-width: 520px; margin-inline: auto; }

/* Section heading inside a page */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  margin: var(--space-6) 0 var(--space-3); }
.section-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }

/* Definition rows */
.kv { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--space-2) var(--space-3);
  font-size: .875rem; margin: 0; }
.kv dt { color: var(--bs-secondary-color); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.kv dd .kv-note { display: block; font-weight: 400; font-size: .8rem; color: var(--bs-secondary-color); }

/* A note in the page that explains a rule (RBI limits, how a screen works) */
.info-note { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg); border: 1px solid rgba(var(--color-action-rgb), .25);
  background: rgba(var(--color-action-rgb), .05); margin-bottom: var(--space-4); font-size: .875rem; }
.info-note > i { color: var(--color-action); font-size: 1.1rem; line-height: 1.3; }
[data-bs-theme="dark"] .info-note > i { color: var(--color-action-lighter); }
.info-note.note-warning { border-color: rgba(var(--color-warning-rgb), .45); background: rgba(var(--color-warning-rgb), .1); }
.info-note.note-warning > i { color: var(--color-warning); }
.info-note.note-danger { border-color: rgba(var(--color-danger-rgb), .35); background: rgba(var(--color-danger-rgb), .06); }
.info-note.note-danger > i { color: var(--color-danger); }

/* Waiting card: the screen's state while the person can't act (no action bar). */
.waiting-card { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4);
  border-radius: var(--radius-lg); border: 1px solid rgba(var(--color-warning-rgb), .45);
  background: rgba(var(--color-warning-rgb), .1); margin-bottom: var(--space-4); }
.waiting-card > i { color: var(--color-warning); font-size: 1.4rem; line-height: 1.2; }

/* Checklist rows (KYC, approval levels) */
.check-row { display: flex; align-items: center; gap: var(--space-2); min-height: 40px; font-size: .9rem; }
.check-row .bi { font-size: 1.05rem; flex-shrink: 0; }
.check-row.is-done .bi { color: var(--color-success); }
.check-row.is-todo .bi { color: var(--color-n400); }
.check-row.is-waiting .bi { color: var(--color-warning); }
.check-row .check-note { margin-left: auto; font-size: .78rem; color: var(--bs-secondary-color); text-align: right; }
[data-bs-theme="dark"] .check-row.is-done .bi { color: var(--color-success-light); }
.progress-slim { --bs-progress-height: 6px; --bs-progress-bar-bg: var(--color-success); --bs-progress-border-radius: var(--radius-sm); }

/* Timeline (history, receipts, notices) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--space-3) var(--space-5); font-size: .875rem; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px;
  border-radius: var(--radius-circle); background: var(--color-action); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 2px; background: var(--color-border); }
.timeline li:last-child::after { display: none; }
.timeline .tl-when { font-family: var(--font-mono); font-size: .78rem; color: var(--bs-secondary-color); }

/* Document tiles (KYC copies) */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
.doc-tile { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--bs-tertiary-bg); font-size: .82rem; min-width: 0;
  text-decoration: none; color: var(--bs-body-color); min-height: 44px; }
a.doc-tile:hover { border-color: var(--color-action); color: var(--bs-body-color); }
.doc-tile .dt-icon { font-size: 1.35rem; color: var(--color-action); }
.doc-tile .dt-name { font-weight: 700; overflow-wrap: anywhere; }
[data-bs-theme="dark"] .doc-tile .dt-icon { color: var(--color-action-lighter); }

/* Big money figure */
.money-figure { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 500; line-height: 1.2; }

/* Collapsible settings rows: a plain summary with a turning chevron. */
.setting-item > summary { list-style: none; cursor: pointer; min-height: 56px; display: flex; align-items: center; gap: var(--space-3); }
.setting-item > summary::-webkit-details-marker { display: none; }
.setting-item > summary .bi-chevron-down { transition: transform var(--t-standard); margin-left: auto; }
.setting-item[open] > summary .bi-chevron-down { transform: rotate(180deg); }
details > summary.small { display: inline-flex; align-items: center; gap: var(--space-1); list-style: none; cursor: pointer; min-height: 32px; }
details > summary.small::-webkit-details-marker { display: none; }
details > summary.small::before { font-family: "bootstrap-icons"; content: "\F285"; font-size: .75em; transition: transform var(--t-standard); }
details[open] > summary.small::before { transform: rotate(90deg); }
@media (max-width: 991.98px) { details > summary.small { min-height: 44px; } }

/* The action bar (ui.action_bar): below lg the fixed bar above the bottom nav, at lg and up the
   same buttons inline at the end of the content. Secondary left, primary right. */
.action-bar { margin-top: var(--space-5); }
.action-bar-inner { display: flex; gap: var(--space-2); justify-content: flex-end; }
.action-bar .btn { min-height: 48px; }
.page-header .action-bar { margin-top: 0; }
.page-header .action-bar .btn { min-height: 44px; }
@media (max-width: 991.98px) {
  .action-bar:not(.action-bar-desktop) { position: fixed; left: 0; right: 0; bottom: var(--bottom-nav-height); margin: 0;
    z-index: var(--z-action-bar); padding: var(--space-2) var(--space-3); background: var(--bs-body-bg);
    border-top: 1px solid var(--color-border); box-shadow: 0 -6px 18px rgba(var(--color-black-rgb), .06); }
  .action-bar .ab-secondary { flex: 1 1 0; min-width: 0; }
  .action-bar .ab-primary { flex: 2 1 0; min-width: 0; }
  .action-bar .btn { width: 100%; }
}

/* The ⋯ menu: a 44px target; its rows are full-height tap rows. */
.more-menu-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.more-menu .dropdown-menu { min-width: 240px; z-index: var(--z-dropdown); padding: var(--space-1); border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevation-3); border-color: var(--color-border); }
.more-menu .dropdown-item { min-height: 44px; white-space: normal; border-radius: var(--radius-sm); }
.more-menu .dropdown-item i { width: 18px; text-align: center; }
.more-menu .dropdown-item.text-danger:active { color: var(--color-white) !important; background: var(--color-danger); }
.dropdown-menu.show { animation: menu-in var(--t-standard); }
@keyframes menu-in { from { opacity: 0; scale: .97; translate: 0 -4px; } }

/* Search card on lists */
.search-card .input-group .form-control { border-right: 0; }
.search-card .input-group-text { background: var(--bs-body-bg); }
.filter-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.filter-chip { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 36px; padding: 0 var(--space-3);
  border-radius: var(--radius-xl); border: 1px solid var(--color-border); background: var(--bs-body-bg);
  color: var(--bs-body-color); font-size: .82rem; font-weight: 600; text-decoration: none; }
.filter-chip:hover { border-color: var(--color-action); color: var(--color-action); }
.filter-chip.active { background: var(--color-action); border-color: var(--color-action); color: var(--color-white); }
@media (max-width: 991.98px) { .filter-chip { min-height: 44px; } }

/* List views (ui.view_toggle, list_view.js): the table never shows below md, whatever was stored. */
.lv-table { display: none; }
@media (min-width: 768px) {
  [data-list-view]:not([data-view="card"]) .lv-table { display: block; }
  [data-list-view]:not([data-view="card"]) .lv-cards { display: none; }
}
/* Table view: shown from md up; below md every list has a card view instead. */
.list-table { margin-bottom: 0; --bs-table-hover-bg: var(--bs-tertiary-bg); }
.list-table thead th { position: sticky; top: var(--navbar-height); z-index: var(--z-sticky); background: var(--bs-tertiary-bg);
  white-space: nowrap; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.list-table td { vertical-align: middle; overflow-wrap: anywhere; font-size: .875rem; }
.list-table td.num, .list-table th.num { text-align: right; }
.list-table a.row-link { font-weight: 600; text-decoration: none; }
.list-table a.row-link:hover { text-decoration: underline; }
.list-table tfoot td { font-weight: 700; border-top: 2px solid var(--bs-border-color); }
.list-table tr.row-alert > td:first-child { box-shadow: inset 4px 0 0 var(--color-danger); }
.list-table tr.row-good > td:first-child { box-shadow: inset 4px 0 0 var(--color-success); }

/* Pager under a list */
.list-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-3) 0; }
.list-pager .pagination { --bs-pagination-active-bg: var(--color-action); --bs-pagination-active-border-color: var(--color-action); }
@media (max-width: 991.98px) {
  .list-pager .page-link { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
}
.filter-chips { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding-bottom: 2px; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip { white-space: nowrap; flex-shrink: 0; }
@media (min-width: 768px) { .filter-chips { flex-wrap: wrap; overflow: visible; } }

/* Offline: the banner under the top bar, and where a saved copy leaves out personal data. */
.offline-banner { position: sticky; top: var(--navbar-height); z-index: var(--z-navbar); display: flex; align-items: center;
  flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--color-warning);
  color: var(--color-n950); font-size: .85rem; font-weight: 600; }
.offline-banner[hidden] { display: none; }
.is-offline [data-offline-held] { cursor: not-allowed; }
.offline-private-note { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--space-4); border: 1px dashed var(--bs-border-color); border-radius: var(--radius-md);
  background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); font-size: .875rem; }

/* User Manual (/help), after AUFLUENCE-CORE's (and the CRM's /docs page). */
.help-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: start; }
@media (min-width: 992px) { .help-wrap { grid-template-columns: 248px minmax(0, 1fr); } }
@media (min-width: 992px) {
  .help-nav { position: sticky; top: calc(var(--navbar-height) + var(--space-4));
    max-height: calc(100dvh - var(--navbar-height) - var(--space-8)); overflow-y: auto; scrollbar-width: thin; }
}
.help-nav-group { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--bs-secondary-color); padding: var(--space-3) var(--space-2) var(--space-1); }
.help-nav a { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-2);
  border-radius: var(--radius-sm); font-size: .88rem; color: var(--bs-body-color); text-decoration: none; }
@media (min-width: 992px) { .help-nav a { min-height: 34px; } }
.help-nav a:hover { background: var(--bs-tertiary-bg); color: var(--color-action); }
.help-nav a.active { background: rgba(var(--color-action-rgb), .1); color: var(--color-action); font-weight: 600; }
.help-nav a i { opacity: .7; width: 16px; text-align: center; flex-shrink: 0; }
.help-toc summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.help-section { scroll-margin-top: calc(var(--navbar-height) + var(--space-4)); margin-bottom: var(--space-8);
  padding-bottom: var(--space-6); border-bottom: 1px solid var(--color-border); }
.help-section[hidden] { display: none; }
.help-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.help-head .help-icon { width: 44px; height: 44px; border-radius: var(--radius-md); flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.2rem; background: rgba(var(--color-action-rgb), .1); color: var(--color-action); }
.help-head h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.help-head .help-sum { font-size: .85rem; color: var(--bs-secondary-color); }
.help-body { line-height: 1.65; font-size: .93rem; }
.help-body h3 { font-size: 1rem; font-weight: 700; margin: var(--space-5) 0 var(--space-2); }
.help-body ul, .help-body ol { padding-left: var(--space-5); }
.help-body .help-steps { list-style: none; padding: 0; counter-reset: step; margin-bottom: var(--space-4); }
.help-steps > li { counter-increment: step; position: relative; margin-bottom: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-3) 52px; background: var(--bs-tertiary-bg);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.help-steps > li::before { content: counter(step); position: absolute; left: var(--space-4); top: var(--space-3);
  width: 24px; height: 24px; border-radius: var(--radius-circle); background: var(--color-action); color: var(--color-white);
  display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 800; }
.help-callout { border-left: 3px solid; border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0; font-size: .9rem; }
.help-callout .hc-title { font-weight: 700; margin-bottom: var(--space-1); }
.help-tip { background: rgba(var(--color-success-rgb), .08); border-color: var(--color-success); }
.help-info { background: rgba(var(--color-action-rgb), .07); border-color: var(--color-action); }
.help-warn { background: rgba(var(--color-warning-rgb), .12); border-color: var(--color-warning); }
.help-ui { display: inline-block; padding: 0 var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  background: var(--bs-body-bg); font-weight: 600; font-size: .86em; white-space: nowrap; }
.help-dl dt { font-weight: 700; margin-top: var(--space-3); }
.help-dl dd { margin-bottom: 0; }
.help-dl .help-avoid { display: block; font-size: .8rem; color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .help-head .help-icon, [data-bs-theme="dark"] .help-nav a.active,
[data-bs-theme="dark"] .help-nav a:hover { color: var(--color-action-lighter); }

/* ── 5. Modals (the CRM's dialog) ─────────────────────────────────────── */
.modal          { z-index: var(--z-modal); overscroll-behavior: contain; }
.modal-backdrop { z-index: calc(var(--z-modal) - 1); }
.modal-backdrop.show {
  opacity: 1; background: var(--modal-backdrop-overlay);
  -webkit-backdrop-filter: blur(var(--modal-backdrop-blur)) saturate(180%);
  backdrop-filter: blur(var(--modal-backdrop-blur)) saturate(180%);
}
.modal-content {
  background: var(--modal-glass-bg); border: 1px solid var(--modal-border); border-radius: var(--radius-xl);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--modal-shadow), 0 8px 32px rgba(var(--color-action-rgb), .12);
  animation: modal-in var(--t-slide) both;
}
.modal-header { padding: var(--space-5) var(--space-6) var(--space-4); border-bottom: 1px solid var(--bs-border-color); }
.modal-header .modal-title {
  font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em;
  display: flex; align-items: center; gap: var(--space-2); color: var(--modal-title-color);
}
.modal-header .modal-title .mt-text { background: var(--gradient-hero); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent; }
[data-bs-theme="dark"] .modal-header .modal-title .mt-text { background: none; -webkit-text-fill-color: currentColor; }
.modal-header .btn-close {
  width: 44px; height: 44px; border-radius: var(--radius-md); background-color: rgba(var(--color-black-rgb), .05);
  opacity: .6; margin: calc(var(--space-1) * -1) calc(var(--space-1) * -1) calc(var(--space-1) * -1) auto;
  transition: transform var(--t-standard), opacity var(--t-standard), background-color var(--t-standard);
}
.modal-header .btn-close:hover { background-color: rgba(var(--color-danger-rgb), .1); opacity: 1; transform: rotate(90deg); }
[data-bs-theme="dark"] .modal-header .btn-close { background-color: rgba(var(--color-white-rgb), .06); }
.modal-body { padding: var(--space-5) var(--space-6); }
.modal-footer { padding: var(--space-4) var(--space-6) var(--space-5); gap: var(--space-2); border-top: 1px solid var(--bs-border-color); }
.modal-footer > * { margin: 0; }
.modal .form-control, .modal .form-select { border-width: 1.5px; border-radius: var(--radius-md); }
.modal .form-control:focus, .modal .form-select:focus {
  border-color: var(--color-action); box-shadow: 0 0 0 3px rgba(var(--color-action-rgb), .15);
}
.modal .modal-footer .btn { border-radius: var(--radius-md); min-height: 44px; padding-inline: var(--space-5); font-weight: 600; }
.modal .modal-footer .btn-primary { background: var(--gradient-hero); border: 0; box-shadow: 0 4px 14px rgba(var(--color-action-rgb), .3); }
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down .modal-content { border-radius: 0; border: 0; }
  .modal-fullscreen-sm-down .modal-footer .btn { flex: 1 1 0; min-height: 48px; }
}
@keyframes modal-in { from { opacity: 0; transform: scale(.96) translateY(20px); } to { opacity: 1; transform: none; } }

.btn .btn-spinner { margin-right: var(--space-2); vertical-align: -.125em; }

/* ── 6. Sign-in and error pages outside the shell ─────────────────────── */
.bare-wrap { width: 100%; max-width: 520px; }
.login-shell { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; align-items: center;
  justify-content: center; padding: var(--space-4); }
.login-shell::before, .login-shell::after { content: ""; position: fixed; z-index: -1; pointer-events: none;
  width: 60vmax; height: 60vmax; border-radius: var(--radius-circle); opacity: .12; filter: blur(80px); }
.login-shell::before { top: -20vmax; right: -20vmax; background: var(--gradient-hero); }
.login-shell::after { bottom: -25vmax; left: -20vmax; background: var(--gradient-gold); }

/* ── 7. Micro-interactions ────────────────────────────────────────────── */
a.stat-tile { transition: box-shadow var(--t-micro), transform var(--t-micro); }
a.stat-tile:active, .list-group-item-action:active { transform: scale(var(--press-scale)); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  a.list-card:hover, .nav-tile:hover, a.stat-tile:hover { transform: translateY(var(--hover-lift)); }
  a.list-card:active, .nav-tile:active, a.stat-tile:active { transform: translateY(0) scale(var(--press-scale)); }
  a.list-card:hover .lc-chevron { transform: translateX(3px); }
  .nav-tile:hover .nt-icon { transform: scale(1.08) rotate(-4deg); }
}
/* Entrance: rows, tiles and cards fade and rise in; only the first eight are staggered. The
   animation fills `backwards` only, so no row keeps a transform that would trap a ⋯ menu. */
@keyframes rise-in { from { opacity: 0; transform: translateY(var(--rise-distance)); } }
@media (prefers-reduced-motion: no-preference) {
  .list-stack > *, .stat-grid > *, .nav-tiles > *, .list-table tbody > tr, .page-cards > * {
    animation: rise-in var(--t-slide) backwards; animation-delay: calc(var(--stagger-index, 0) * var(--stagger-step));
  }
  :is(.list-stack, .stat-grid, .nav-tiles, tbody, .page-cards) > :nth-child(2) { --stagger-index: 1; }
  :is(.list-stack, .stat-grid, .nav-tiles, tbody, .page-cards) > :nth-child(3) { --stagger-index: 2; }
  :is(.list-stack, .stat-grid, .nav-tiles, tbody, .page-cards) > :nth-child(4) { --stagger-index: 3; }
  :is(.list-stack, .stat-grid, .nav-tiles, tbody, .page-cards) > :nth-child(5) { --stagger-index: 4; }
  :is(.list-stack, .stat-grid, .nav-tiles, tbody, .page-cards) > :nth-child(6) { --stagger-index: 5; }
  :is(.list-stack, .stat-grid, .nav-tiles, tbody, .page-cards) > :nth-child(7) { --stagger-index: 6; }
  :is(.list-stack, .stat-grid, .nav-tiles, tbody, .page-cards) > :nth-child(n+8) { --stagger-index: 7; }
}
@keyframes icon-pop { from { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.06); } }
@keyframes backdrop-in { from { opacity: 0; } }
.invalid-feedback.d-block { animation: feedback-in var(--t-standard); }
@keyframes feedback-in { from { opacity: 0; transform: translateY(-4px); } }

/* ── 8. Printed pages (KFS, receipt, notice) ──────────────────────────── */
.print-sheet { background: var(--bs-body-bg); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevation-1); padding: var(--space-6); }
@media (max-width: 575.98px) { .print-sheet { padding: var(--space-4); } }
.print-sheet .sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3);
  padding-bottom: var(--space-4); margin-bottom: var(--space-4); border-bottom: 2px solid var(--bs-body-color); }
.print-sheet .sheet-title { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; margin: 0; }
.print-sheet .table th { font-weight: 600; color: var(--bs-secondary-color); width: 42%; }
@media print {
  #sidebar, #topNavbar, #bottomNav, #fab, #toastStack, .action-bar, .page-header, .d-print-none { display: none !important; }
  body { background: var(--color-white); font-size: 11pt; }
  main.page { padding: 0 !important; max-width: none; }
  .print-sheet { border: 0; box-shadow: none; padding: 0; }
  .card { box-shadow: none; }
}
.live-camera-video { transform: scaleX(-1); max-height: 60vh; object-fit: cover; }

/* ── 9. Landing page (public, outside the shell) ─────────────────────── */
/* Laid out as the CRM's landing page is. Brand gold is identity here too: the headline accent, the
   stats and the sample figures, never a control. The hero stays dark in both themes so the gold reads. */
.pp-container { width: 100%; max-width: var(--content-max-width); margin: 0 auto; padding: 0 var(--space-4); }
@media (min-width: 768px) { .pp-container { padding: 0 var(--space-6); } }
.pp-header { position: sticky; top: 0; z-index: var(--z-navbar); padding: var(--space-3) 0;
  background: var(--bottom-nav-bg); backdrop-filter: blur(12px); border-bottom: 1px solid var(--color-border); }
.pp-header .btn { min-height: 44px; }
.pp-brand { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; color: var(--bs-body-color); }
.pp-brand small { font-family: var(--bs-body-font-family); font-weight: 500; font-size: .8rem; color: var(--bs-secondary-color); margin-left: var(--space-1); }
.pp-navlink { color: var(--bs-secondary-color); text-decoration: none; font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; min-height: 44px; transition: color var(--t-micro); }
.pp-navlink:hover { color: var(--bs-body-color); }
.pp-gold { color: var(--color-brand-light); }

/* Hero */
.pp-hero { position: relative; overflow: hidden; background: var(--color-n950); color: var(--color-n300);
  padding: calc(var(--space-8) * 2.5) 0 calc(var(--space-8) * 2); }
.pp-hero::before, .pp-hero::after { content: ""; position: absolute; pointer-events: none; width: 50vmax; height: 50vmax;
  border-radius: var(--radius-circle); opacity: .22; filter: blur(90px); }
.pp-hero::before { top: -25vmax; right: -15vmax; background: var(--gradient-hero); }
.pp-hero::after { top: 10vmax; left: -25vmax; background: var(--gradient-gold); opacity: .14; }
.pp-hero .pp-container { position: relative; }
.pp-eyebrow { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  border: 1px solid rgba(var(--color-white-rgb), .14); border-radius: var(--radius-xl); font-size: .85rem;
  font-weight: 600; color: var(--color-n100); margin-bottom: var(--space-6); background: rgba(var(--color-white-rgb), .04); }
.pp-chip { padding: 2px var(--space-2); border-radius: var(--radius-xl); background: var(--gradient-gold); color: var(--color-n950);
  font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.pp-display { font-family: var(--font-heading); font-weight: 800; color: var(--color-white); letter-spacing: -.025em;
  line-height: 1.05; font-size: clamp(2.4rem, 6.4vw, 4.6rem); margin: 0 auto var(--space-5); max-width: 14em; }
.pp-lead { font-size: 1.12rem; line-height: 1.65; max-width: 40em; margin: 0; }
.pp-cta { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
  padding-left: var(--space-6); padding-right: var(--space-6); }
.pp-btn-ghost { color: var(--color-white); border: 1px solid rgba(var(--color-white-rgb), .28); }
.pp-btn-ghost:hover, .pp-btn-ghost:focus-visible { color: var(--color-white); background: rgba(var(--color-white-rgb), .08);
  border-color: rgba(var(--color-white-rgb), .5); }
.pp-btn-light { background: var(--color-white); color: var(--color-action-dark); border: 0; }
.pp-btn-light:hover, .pp-btn-light:focus-visible { background: var(--color-n100); color: var(--color-action-dark); }

/* The product mockup under the hero: a sample Branch screen with three cards floating around it. */
.pp-visual { position: relative; max-width: 1040px; margin: calc(var(--space-8) * 2) auto 0; text-align: start; }
@media (prefers-reduced-motion: no-preference) {
  .pp-visual { animation: rise-in var(--t-slide) backwards; animation-delay: calc(var(--stagger-step) * 4); }
}
.pp-screen { background: var(--bs-body-bg); color: var(--bs-body-color); border-radius: var(--radius-xl); overflow: hidden;
  border: 1px solid rgba(var(--color-white-rgb), .1); box-shadow: var(--shadow-elevation-4), 0 0 0 8px rgba(var(--color-white-rgb), .04); }
.pp-screen-bar { display: flex; align-items: center; gap: 6px; padding: var(--space-3) var(--space-4);
  background: var(--bs-tertiary-bg); border-bottom: 1px solid var(--color-border); }
.pp-screen-bar span { width: 10px; height: 10px; border-radius: var(--radius-circle); background: var(--color-danger-light); }
.pp-screen-bar span:nth-child(2) { background: var(--color-warning); }
.pp-screen-bar span:nth-child(3) { background: var(--color-success-light); }
.pp-screen-bar em { margin-left: var(--space-3); font-style: normal; font-size: .75rem; color: var(--bs-secondary-color); }
.pp-screen-body { display: flex; }
.pp-screen-side { display: none; flex-direction: column; gap: var(--space-4); padding: var(--space-4) var(--space-3);
  background: var(--surface-sidebar); color: var(--color-n400); font-size: 1.1rem; }
.pp-screen-side .active { color: var(--color-brand-light); }
@media (min-width: 768px) { .pp-screen-side { display: flex; } }
.pp-screen-main { flex: 1; min-width: 0; padding: var(--space-4); display: grid; gap: var(--space-4); background: var(--surface-page); }
@media (min-width: 768px) { .pp-screen-main { padding: var(--space-5); } }
.pp-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (min-width: 992px) { .pp-kpis { grid-template-columns: repeat(4, 1fr); } }
.pp-kpis > div { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); border-radius: var(--radius-md);
  background: var(--bs-body-bg); border: 1px solid var(--color-border); }
.pp-kpis small { font-size: .72rem; font-weight: 600; color: var(--bs-secondary-color); }
.pp-kpis strong { font-size: 1.15rem; font-weight: 500; }
.pp-kpis em { font-style: normal; font-size: .7rem; color: var(--bs-secondary-color); }
.pp-screen-row { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 768px) { .pp-screen-row { grid-template-columns: 1.2fr 1fr; } }

.pp-sample { --pp-sample-ltv: 71.4%; /* the sample loan's LTV, as printed on the card */
  --pp-sample-cap: 75%;               /* its Scheme's LTV cap, marked on the bar */
  background: var(--bs-body-bg); border-radius: var(--radius-lg); padding: var(--space-5); border: 1px solid var(--color-border); }
.pp-sample-label { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-secondary-color); }
.pp-sample-title { font-family: var(--font-heading); font-weight: 700; font-size: 1.05rem; }
.pp-figures { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin: 0 0 var(--space-4); }
.pp-figures dt { font-size: .75rem; font-weight: 600; color: var(--bs-secondary-color); }
.pp-figures dd { margin: 0; font-size: 1.05rem; font-weight: 500; }
.pp-figures dd small { font-size: .72rem; color: var(--bs-secondary-color); }
.pp-ltv { position: relative; height: 8px; border-radius: var(--radius-sm); background: var(--bs-tertiary-bg); }
.pp-ltv span { position: absolute; inset: 0 auto 0 0; width: var(--pp-sample-ltv); border-radius: inherit; background: var(--gradient-gold); }
.pp-ltv::after { content: ""; position: absolute; top: calc(var(--space-1) * -1); bottom: calc(var(--space-1) * -1);
  left: var(--pp-sample-cap); width: 2px; background: var(--bs-body-color); opacity: .5; }

.pp-dpd { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-lg);
  background: var(--bs-body-bg); border: 1px solid var(--color-border); }
.pp-dpd > small { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-secondary-color); }
.pp-dpd-row { display: grid; grid-template-columns: 3.2em 1fr 3.2em; align-items: center; gap: var(--space-3); font-size: .78rem; }
.pp-dpd-row b { font-weight: 500; text-align: end; }
.pp-dpd-track { height: 8px; border-radius: var(--radius-sm); background: var(--bs-tertiary-bg); overflow: hidden; }
.pp-dpd-fill { height: 100%; border-radius: inherit; background: var(--color-success); }
.pp-dpd-row:nth-of-type(n+3) .pp-dpd-fill { background: var(--color-warning); }
.pp-dpd-row:nth-of-type(n+5) .pp-dpd-fill { background: var(--color-danger); }
/* Bar lengths of the sample book by days past due: each bucket's share, scaled for show. */
.pp-w-94 { width: 94%; } .pp-w-40 { width: 40%; } .pp-w-20 { width: 20%; } .pp-w-12 { width: 12%; } .pp-w-6 { width: 6%; }

.pp-float { position: absolute; z-index: 1; display: none; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg); background: var(--bs-body-bg); color: var(--bs-body-color);
  border: 1px solid var(--color-border); box-shadow: var(--shadow-elevation-3); }
.pp-float strong { display: block; font-size: .85rem; }
.pp-float small { display: block; font-size: .74rem; color: var(--bs-secondary-color); }
.pp-float-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--radius-md); display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.05rem; }
.pp-tone-success { background: var(--pill-done-bg); color: var(--pill-done-fg); }
.pp-tone-brand { background: rgba(var(--color-brand-rgb), .14); color: var(--color-brand); }
.pp-tone-action { background: var(--pill-open-bg); color: var(--pill-open-fg); }
@media (min-width: 1200px) {
  .pp-float { display: flex; }
  /* On the screen's top and bottom edges, clear of its figures. */
  .pp-float-a { top: calc(var(--space-6) * -1); right: 6%; }
  .pp-float-b { bottom: calc(var(--space-6) * -1); right: 10%; }
  .pp-float-c { bottom: calc(var(--space-6) * -1); left: 10%; }
}
@keyframes pp-bob { 50% { transform: translateY(calc(var(--rise-distance) * -1)); } }
@media (prefers-reduced-motion: no-preference) {
  .pp-float { animation: pp-bob 6s ease-in-out infinite; }
  .pp-float-b { animation-delay: -2s; }
  .pp-float-c { animation-delay: -4s; }
}

/* Stats strip: product facts */
.pp-stats { padding: calc(var(--space-8) * 1.5) 0; background: var(--bs-body-bg); border-bottom: 1px solid var(--color-border); }
.pp-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); margin: 0; }
@media (min-width: 992px) { .pp-stats-grid { grid-template-columns: repeat(4, 1fr); } }
.pp-stats-grid > div { text-align: center; }
.pp-stats-grid dt { font-family: var(--font-heading); font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 800; line-height: 1;
  color: var(--color-brand); margin-bottom: var(--space-2); }
[data-bs-theme="dark"] .pp-stats-grid dt { color: var(--color-brand-light); }
.pp-stats-grid dd { margin: 0 auto; max-width: 16em; font-size: .9rem; color: var(--bs-secondary-color); }

/* Sections */
.pp-section { padding: calc(var(--space-8) * 2.5) 0; background: var(--bs-body-bg); }
.pp-section-alt { background: var(--surface-page); }
.pp-section-head { max-width: 720px; margin-bottom: calc(var(--space-8) * 1.5); }
.pp-h2 { font-family: var(--font-heading); font-weight: 700; letter-spacing: -.015em; line-height: 1.2;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem); margin-bottom: var(--space-3); }
.pp-h3 { font-family: var(--font-heading); font-weight: 700; font-size: 1.08rem; margin-bottom: var(--space-2); }
.pp-sub { font-size: 1.05rem; line-height: 1.6; color: var(--bs-secondary-color); max-width: 40em; margin: 0; }

/* Features: bento grid. The wide card spans two columns; the rest fill three even rows. */
.pp-bento { display: grid; gap: var(--space-4); grid-template-columns: 1fr; grid-auto-flow: dense; }
@media (min-width: 768px) { .pp-bento { grid-template-columns: repeat(2, 1fr); } .pp-bento-wide { grid-column: span 2; } }
@media (min-width: 1200px) { .pp-bento { grid-template-columns: repeat(3, 1fr); } }
.pp-card { padding: var(--space-6); border-radius: var(--radius-lg); background: var(--bs-body-bg);
  border: 1px solid var(--color-border); box-shadow: var(--shadow-elevation-1);
  transition: box-shadow var(--t-standard), transform var(--t-standard); }
.pp-card p { color: var(--bs-secondary-color); line-height: 1.6; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .pp-card:hover { transform: translateY(var(--hover-lift)); box-shadow: var(--shadow-elevation-2); }
}
.pp-card-icon { width: 44px; height: 44px; border-radius: var(--radius-md); display: inline-flex; align-items: center;
  justify-content: center; font-size: 1.25rem; margin-bottom: var(--space-4);
  background: rgba(var(--color-action-rgb), .1); color: var(--color-action); }
[data-bs-theme="dark"] .pp-card-icon { color: var(--color-action-lighter); }

/* The loan lifecycle inside the wide card */
.pp-steps { list-style: none; counter-reset: pp-step; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-3);
  grid-template-columns: 1fr; }
@media (min-width: 576px) { .pp-steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .pp-steps { grid-template-columns: repeat(4, 1fr); } }
.pp-steps li { counter-increment: pp-step; position: relative; display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-page); border: 1px solid var(--color-border); }
.pp-steps li::before { content: counter(pp-step, decimal-leading-zero); position: absolute; top: var(--space-4); right: var(--space-4);
  font-family: var(--font-mono); font-size: .75rem; color: var(--bs-secondary-color); }
.pp-steps .bi { font-size: 1.2rem; color: var(--color-action); }
[data-bs-theme="dark"] .pp-steps .bi { color: var(--color-action-lighter); }
.pp-steps strong { font-family: var(--font-heading); font-size: .95rem; }
.pp-steps span { font-size: .82rem; line-height: 1.5; color: var(--bs-secondary-color); }

.pp-slabs { width: 100%; margin-top: var(--space-4); font-size: .88rem; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.pp-slabs caption { caption-side: top; padding: 0 0 var(--space-2); font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--bs-secondary-color); }
.pp-slabs th, .pp-slabs td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); }
.pp-slabs tr:last-child td { border-bottom: 0; }
.pp-slabs th { background: var(--surface-page); font-weight: 600; color: var(--bs-secondary-color); }
.pp-slabs td:last-child, .pp-slabs th:last-child { text-align: end; }

/* How it works */
.pp-how { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-6); grid-template-columns: 1fr; }
@media (min-width: 768px) { .pp-how { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .pp-how { grid-template-columns: repeat(4, 1fr); } }
.pp-how li { text-align: center; }
.pp-how p { color: var(--bs-secondary-color); line-height: 1.6; margin: 0; }
.pp-how-num { width: 52px; height: 52px; border-radius: var(--radius-circle); display: inline-flex; align-items: center;
  justify-content: center; margin-bottom: var(--space-4); font-family: var(--font-heading); font-weight: 800; font-size: 1.2rem;
  background: var(--gradient-hero); color: var(--color-white); box-shadow: 0 4px 14px rgba(var(--color-action-rgb), .3); }

/* Integrations: a looping strip of chips, still and wrapped for anyone who prefers less motion. */
.pp-integrations { padding: calc(var(--space-8) * 1.5) 0; background: var(--bs-body-bg); border-bottom: 1px solid var(--color-border); overflow: hidden; }
.pp-marquee { -webkit-mask-image: linear-gradient(90deg, transparent, var(--color-n950) 10%, var(--color-n950) 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, var(--color-n950) 10%, var(--color-n950) 90%, transparent); }
.pp-marquee-track { list-style: none; margin: 0; padding: var(--space-2) 0; display: flex; gap: var(--space-3); width: max-content; }
.pp-logo-chip { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; padding: var(--space-2) var(--space-4);
  min-height: 44px; border-radius: var(--radius-xl); border: 1px solid var(--color-border); background: var(--surface-page);
  font-weight: 600; font-size: .9rem; color: var(--bs-body-color); }
.pp-logo-chip .bi { color: var(--color-brand); }
@keyframes pp-marquee { to { transform: translateX(calc(-50% - var(--space-3) / 2)); } }
@media (prefers-reduced-motion: no-preference) { .pp-marquee-track { animation: pp-marquee 48s linear infinite; } }
@media (prefers-reduced-motion: reduce) {
  .pp-marquee { -webkit-mask-image: none; mask-image: none; }
  .pp-marquee-track { width: auto; flex-wrap: wrap; justify-content: center; padding: 0 var(--space-4); }
  .pp-logo-chip[aria-hidden="true"] { display: none; }
}

/* Compliance */
.pp-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-5); }
.pp-checks li { display: flex; gap: var(--space-3); line-height: 1.6; color: var(--bs-secondary-color); }
.pp-checks strong { color: var(--bs-body-color); }
.pp-checks .bi { color: var(--color-success); font-size: 1.15rem; flex-shrink: 0; margin-top: 2px; }
[data-bs-theme="dark"] .pp-checks .bi { color: var(--color-success-light); }

/* The suite */
.pp-app-current { border-color: rgba(var(--color-brand-rgb), .5); box-shadow: 0 0 0 1px rgba(var(--color-brand-rgb), .5); }
.pp-app-current .app-icon { background: var(--gradient-gold); color: var(--color-white); }
[data-bs-theme="dark"] .pp-app-current .app-icon { color: var(--color-white); }

/* Pricing */
.pp-plan { display: flex; flex-direction: column; padding: var(--space-8) var(--space-6); border-radius: var(--radius-xl);
  background: var(--bs-body-bg); border: 1px solid var(--color-border); box-shadow: var(--shadow-elevation-1); }
.pp-plan-featured { border: 2px solid var(--color-action); box-shadow: var(--shadow-elevation-3); }
[data-bs-theme="dark"] .pp-plan-featured { border-color: var(--color-action-lighter); }
.pp-plan-price { font-family: var(--font-heading); font-weight: 800; font-size: 1.6rem; margin: var(--space-2) 0; }
.pp-plan-desc { color: var(--bs-secondary-color); margin-bottom: var(--space-5); }
.pp-plan-list { list-style: none; padding: 0; margin: 0 0 var(--space-6); display: grid; gap: var(--space-3); flex: 1; }
.pp-plan-list li { display: flex; gap: var(--space-2); align-items: flex-start; font-size: .92rem; }
.pp-plan-list .bi { color: var(--color-success); margin-top: 3px; }
[data-bs-theme="dark"] .pp-plan-list .bi { color: var(--color-success-light); }

/* Call to action and footer */
.pp-cta-band { padding: calc(var(--space-8) * 1.5) var(--space-6); border-radius: var(--radius-xl);
  background: var(--gradient-hero); color: rgba(var(--color-white-rgb), .85); box-shadow: var(--shadow-elevation-3); }
.pp-cta-band .pp-h2 { color: var(--color-white); }
.pp-cta-band .pp-sub { color: rgba(var(--color-white-rgb), .85); }
.pp-footer { padding: var(--space-6) 0; font-size: .88rem; color: var(--bs-secondary-color);
  border-top: 1px solid var(--color-border); background: var(--bs-body-bg); }
