:root {
  --brand: #087a49;
  --brand-dark: #075c3b;
  --brand-deep: #0c3f2f;
  --brand-soft: #e9f6ef;
  --brand-mist: #f4faf7;
  --collection: #087a49;
  --past-due: #a8580a;
  --par: #b93630;
  --info: #2563a6;
  --surface: #fff;
  --surface-muted: #f7faf8;
  --page: #f2f6f4;
  --text: #17342b;
  --ink: #102a22;
  --muted: #60736c;
  --line: #d7e2dd;
  --line-strong: #baccc4;
  --shadow-sm: 0 1px 2px rgba(16, 42, 34, 0.04), 0 6px 18px rgba(16, 42, 34, 0.05);
  --shadow-md: 0 18px 42px rgba(16, 42, 34, 0.09);
  --radius-sm: 0.625rem;
  --radius: 0.875rem;
  --radius-lg: 1.25rem;
  --transition: 160ms ease;
}

/* Decision dashboard and task-first client workflows */
.applied-filter-label:is(button) {
  gap: 0.35rem;
  cursor: pointer;
}

.applied-filter-label:is(button):hover {
  color: #842029;
  background: #f8d7da;
  border-color: #f1aeb5;
}

.applied-filter-label:is(button) span {
  font-size: 1rem;
  line-height: 0.7;
}

.data-freshness {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.decision-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.decision-card {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.decision-card-heading,
.decision-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.decision-card-heading {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.decision-card > strong {
  display: block;
  margin: 0.55rem 0;
  color: var(--ink);
  font-size: clamp(1.75rem, 7vw, 2.35rem);
  line-height: 1;
}

.decision-card-footer {
  align-items: flex-end;
  color: var(--muted);
  font-size: 0.72rem;
}

.signal-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(127, 145, 137, 0.12);
}

.decision-card.signal-good { border-left-color: #087747; }
.decision-card.signal-warning { border-left-color: #b56a13; }
.decision-card.signal-critical { border-left-color: #ae332e; }
.signal-good .signal-dot { background: #087747; box-shadow: 0 0 0 4px rgba(8, 119, 71, 0.12); }
.signal-warning .signal-dot { background: #b56a13; box-shadow: 0 0 0 4px rgba(181, 106, 19, 0.12); }
.signal-critical .signal-dot { background: #ae332e; box-shadow: 0 0 0 4px rgba(174, 51, 46, 0.12); }

.dashboard-work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.action-queue,
.risk-movers {
  min-width: 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.action-queue-heading {
  gap: 0.75rem;
}

.action-queue-list,
.risk-movers-list {
  display: grid;
  gap: 0.55rem;
}

.action-item {
  display: grid;
  gap: 0.7rem;
  padding: 0.8rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.action-item-main,
.action-item-risk,
.action-item-actions,
.client-mobile-card-heading,
.client-mobile-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.action-item-main > div,
.action-item-risk {
  display: grid;
  gap: 0.1rem;
}

.action-item-main span:not(.priority-badge),
.action-item-risk span,
.risk-mover span,
.client-mobile-card-heading span {
  color: var(--muted);
  font-size: 0.73rem;
}

.action-item-risk strong {
  color: var(--par);
}

.action-item-actions {
  flex-wrap: wrap;
}

.priority-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
}

.priority-critical { color: #fff; background: #ae332e; }
.priority-high { color: #754000; background: #fff3cd; }
.priority-attention { color: #0b5570; background: #d9eff7; }

.no-phone-label,
.missing-contact-note {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.risk-mover {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.risk-mover > div {
  display: grid;
  gap: 0.1rem;
}

.risk-mover > div:last-child { text-align: right; }
.risk-mover.worse > div:last-child strong { color: #ae332e; }
.risk-mover.better > div:last-child strong { color: #087747; }

.client-mobile-list {
  display: grid;
  gap: 0.75rem;
}

.client-mobile-card {
  padding: 0.9rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  box-shadow: 0 5px 16px rgba(16, 42, 34, 0.06);
}

.client-mobile-card-heading {
  align-items: flex-start;
  justify-content: space-between;
}

.client-mobile-card-heading > div {
  display: grid;
  gap: 0.15rem;
}

.client-mobile-risk {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.75rem 0;
}

.client-mobile-risk > div {
  padding: 0.65rem;
  background: var(--surface-muted);
  border-radius: 0.6rem;
}

.client-mobile-risk dd { color: var(--par); }

.client-follow-up-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.client-follow-up-status > span {
  width: 8px;
  height: 8px;
  background: #b56a13;
  border-radius: 50%;
}

.client-mobile-actions {
  justify-content: flex-end;
}

.client-sticky-summary {
  position: sticky;
  top: -1rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem -0.25rem 0;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: 0 6px 20px rgba(16, 42, 34, 0.08);
  backdrop-filter: blur(8px);
}

.client-sticky-summary > div:first-child {
  display: grid;
}

.client-sticky-summary > div:first-child span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.client-sticky-summary > div:first-child strong {
  color: var(--par);
  font-size: 1.05rem;
}

.client-primary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.client-detail-tabs {
  margin-top: 1rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.client-detail-tabs .nav-tabs {
  flex-wrap: nowrap;
  min-width: max-content;
}

.client-detail-tabs .nav-link {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.client-detail-tabs .nav-link.active {
  color: var(--brand-dark);
  border-top: 3px solid var(--brand);
}

.client-detail-tab-content {
  padding-top: 0.9rem;
}

@media (min-width: 768px) {
  .decision-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .action-item {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) auto;
    align-items: center;
  }

  .client-table th:first-child,
  .client-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: inherit;
  }

  .client-table th:last-child,
  .client-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
    background: inherit;
    box-shadow: -8px 0 12px rgba(16, 42, 34, 0.05);
  }
}

@media (min-width: 992px) {
  .filter-wrapper {
    position: sticky;
    top: 76px;
    z-index: 25;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(16, 42, 34, 0.08);
    backdrop-filter: blur(10px);
  }

  .dashboard-work-grid {
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  }

  .action-queue-heading {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 5% 0, rgba(8, 122, 73, 0.055), transparent 24rem),
    var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--brand-dark);
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(8, 122, 73, 0.28);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1100;
  padding: 0.7rem 1rem;
  color: #fff;
  background: var(--brand-deep);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
  transition: transform var(--transition);
}

.skip-link:focus {
  color: #fff;
  transform: translateY(0);
}

.btn {
  min-height: 44px;
  padding: 0.58rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: color var(--transition), background-color var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-sm {
  min-height: 38px;
  padding: 0.42rem 0.72rem;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-deep);
  --bs-btn-active-border-color: var(--brand-deep);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
}

.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
}

.btn-outline-secondary {
  --bs-btn-color: #52665f;
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: #edf3f0;
  --bs-btn-hover-border-color: #9db3a9;
}

.form-label {
  margin-bottom: 0.38rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-control,
.form-select {
  min-height: 44px;
  color: var(--text);
  background-color: var(--surface);
  border-color: var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.form-control::placeholder {
  color: #82938c;
}

.form-control:hover:not(:disabled),
.form-select:hover:not(:disabled) {
  border-color: #9eb3aa;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.22rem rgba(8, 122, 73, 0.14);
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
  color: #657770;
  background-color: #edf2f0;
  opacity: 1;
}

.form-select[multiple] {
  min-height: 12rem;
  padding: 0.35rem;
}

.form-select[multiple] option {
  padding: 0.55rem 0.65rem;
  border-radius: 0.4rem;
}

.form-select[multiple] option:checked {
  color: #fff;
  background: var(--brand) linear-gradient(0deg, var(--brand), var(--brand));
}

.form-check-input {
  border-color: var(--line-strong);
}

.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}

.form-help {
  margin: -0.15rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.text-danger {
  color: #a92f2a !important;
}

.field-validation-error {
  display: block;
  margin-top: 0.35rem;
}

.validation-summary-valid {
  display: none;
}

.alert {
  border: 0;
  border-left: 4px solid currentColor;
  border-radius: var(--radius-sm);
}

.alert-danger {
  color: #812823;
  background: #fbeeed;
}

.alert-success {
  color: #0c5f3b;
  background: #e7f5ed;
}

/* Shared application shell */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-header .navbar {
  min-height: 68px;
  padding: 0.4rem 0;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 20px rgba(16, 42, 34, 0.06);
  backdrop-filter: blur(12px);
}

.app-header-inner {
  width: min(1440px, 100%);
  margin-inline: auto;
  padding-inline: 0.75rem;
}

.navbar-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
  margin-right: 0.5rem;
  color: var(--ink);
  font-weight: 750;
  text-align: left;
  white-space: nowrap;
}

.navbar-brand:hover,
.navbar-brand:focus {
  color: var(--ink);
}

.brand-logo-wrap {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  overflow: hidden;
  place-items: center;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-divider {
  display: none;
  width: 1px;
  height: 34px;
  background: var(--line);
}

.product-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
}

.product-lockup > .product-icon,
.product-lockup small {
  display: none;
}

.product-lockup strong,
.product-lockup small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-lockup strong {
  display: block;
  max-width: 9.75rem;
  font-size: 0.88rem;
  line-height: 1.15;
}

.product-lockup small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.navbar-toggler {
  width: 44px;
  height: 44px;
  padding: 0.5rem;
  border-color: var(--line);
  border-radius: var(--radius-sm);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(8, 122, 73, 0.14);
}

.navbar-collapse {
  padding-top: 0.75rem;
}

.navbar-nav {
  gap: 0.15rem;
  padding-block: 0.35rem;
}

.navbar .nav-link {
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  color: var(--muted);
  border-radius: 0.55rem;
  font-weight: 700;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--brand);
  background: var(--brand-mist);
}

.navbar .nav-link.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.navbar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.navbar-user-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.navbar-user-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-avatar {
  position: relative;
  overflow: hidden;
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #cbe4d7;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
}

.notification-center {
  flex: 0 0 auto;
}

.notification-bell {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.notification-bell:hover,
.notification-bell:focus,
.notification-bell[aria-expanded="true"] {
  background: var(--brand-soft);
  outline: none;
}

.notification-bell svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 21px;
  height: 21px;
  padding: 0 0.3rem;
  color: #fff;
  background: #c92a2a;
  border: 2px solid #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 850;
  line-height: 17px;
  text-align: center;
}

.notification-menu {
  width: min(390px, calc(100vw - 1.5rem));
  max-height: min(620px, calc(100vh - 90px));
  padding: 0;
  overflow: hidden;
  border-color: var(--line);
  border-radius: 0.8rem;
  box-shadow: 0 16px 40px rgba(24, 50, 39, 0.18);
}

.notification-menu-header {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.notification-menu-header .btn-link {
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 750;
  text-decoration: none;
}

.notification-menu-list {
  max-height: 430px;
  overflow-y: auto;
}

.notification-menu-item,
.notification-inbox-item {
  display: grid;
  width: 100%;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.8rem 0.9rem;
  color: var(--text);
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.notification-menu-item:hover,
.notification-menu-item:focus,
.notification-inbox-item:hover,
.notification-inbox-item:focus {
  background: var(--brand-mist);
  outline: none;
}

.notification-menu-item.unread,
.notification-inbox-item.unread {
  background: #f0f8f4;
}

.notification-status-dot {
  width: 8px;
  height: 8px;
  margin-top: 0.42rem;
  background: transparent;
  border-radius: 50%;
}

.unread .notification-status-dot {
  background: var(--brand);
}

.notification-copy {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.notification-copy strong,
.notification-copy span,
.notification-copy small {
  overflow-wrap: anywhere;
}

.notification-copy span {
  font-size: 0.82rem;
}

.notification-copy small {
  color: var(--muted);
  font-size: 0.72rem;
}

.notification-menu-loading,
.notification-menu-empty {
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.notification-view-all {
  display: block;
  padding: 0.75rem;
  color: var(--brand);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.notification-view-all:hover,
.notification-view-all:focus {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.notification-page,
.notification-inbox-list {
  display: grid;
  gap: 1rem;
}

.notification-inbox-list {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.notification-inbox-item {
  min-height: 92px;
  align-items: start;
  padding: 1rem;
}

.notification-inbox-item:last-child {
  border-bottom: 0;
}

.user-avatar img,
.audit-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Audit log */
.audit-filter-grid,
.audit-list {
  display: grid;
  gap: 0.85rem;
}

.audit-filter-panel .filter-actions {
  margin-top: 1rem;
}

.audit-log-section {
  min-width: 0;
  max-width: 100%;
  margin-top: 1rem;
}

.audit-row {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.audit-user,
.audit-user > div,
.audit-event,
.audit-event-heading,
.audit-meta {
  display: flex;
}

.audit-user {
  min-width: 0;
  align-items: flex-start;
  gap: 0.7rem;
}

.audit-user > div,
.audit-event {
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.22rem;
}

.audit-user span:not(.audit-avatar, .role-badge),
.audit-meta {
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.audit-avatar {
  position: relative;
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  overflow: hidden;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #cbe4d7;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 850;
}

.audit-event-heading {
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.audit-event p {
  margin: 0.2rem 0 0;
  color: var(--text);
}

.audit-result {
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.audit-result.success {
  color: #146c43;
  background: #dff3e8;
}

.audit-result.failed {
  color: #9d2929;
  background: #fde7e7;
}

.audit-meta {
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  margin-top: 0.3rem;
}

.audit-details {
  width: 100%;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.audit-details summary {
  cursor: pointer;
  font-weight: 700;
}

.audit-details dl {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 0.3rem 0.7rem;
  margin: 0.6rem 0 0;
}

.audit-details dt,
.audit-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.audit-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1rem;
}

.audit-pagination span {
  color: var(--muted);
  font-size: 0.85rem;
}

.audit-table-wrap {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.audit-table {
  width: 100% !important;
  min-width: 900px;
  table-layout: fixed;
  margin-bottom: 0;
}

.audit-table .audit-col-date { width: 13%; }
.audit-table .audit-col-user { width: 22%; }
.audit-table .audit-col-client { width: 23%; }
.audit-table .audit-col-comment { width: 18%; }
.audit-table .audit-col-summary { width: 24%; }

.audit-table thead th {
  white-space: nowrap;
}

.audit-table td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: break-word;
}

.audit-user-cell {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.audit-user-cell .audit-avatar {
  flex-basis: 36px;
  width: 36px;
  height: 36px;
}

.audit-user-cell > span:last-child,
.audit-table td:first-child {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.audit-user-cell strong,
.audit-user-cell small {
  overflow-wrap: anywhere;
}

.audit-user-cell small,
.audit-table td:first-child small {
  color: var(--muted);
}

.audit-table .audit-result {
  width: fit-content;
  margin-top: 0.35rem;
}

.audit-comment {
  white-space: pre-wrap !important;
}

.audit-client-cell {
  display: grid;
  justify-items: start;
  gap: 0.4rem;
}

.audit-branch-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0.18rem 0.5rem;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #cbe4d7;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

.audit-table tbody tr.audit-client-row {
  cursor: pointer;
  transition: background-color var(--transition), box-shadow var(--transition);
}

.audit-table tbody tr.audit-client-row:hover,
.audit-table tbody tr.audit-client-row:focus {
  background: var(--brand-mist);
  box-shadow: inset 3px 0 var(--brand);
  outline: none;
}

@media (min-width: 768px) {
  .audit-filter-grid {
    grid-template-columns: 2fr 1.3fr 1fr 1fr;
  }

  .audit-row {
    grid-template-columns: minmax(210px, 0.7fr) minmax(0, 2fr);
  }
}

.btn-header {
  color: var(--brand-dark);
  background: #fff;
  border-color: var(--line-strong);
}

.btn-header:hover {
  color: #fff;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.app-shell {
  width: min(1440px, 100%);
  min-height: calc(100vh - 146px);
  margin: 0 auto;
  padding: 1rem 0.75rem;
}

.app-footer {
  padding: 1.5rem 0 1.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.app-footer .container {
  display: flex;
  width: min(1440px, calc(100% - 1.5rem));
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
}

.has-mobile-bottom-nav {
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
}

.mobile-bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.4rem max(0.75rem, env(safe-area-inset-right)) calc(0.4rem + env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(16, 42, 34, 0.1);
  backdrop-filter: blur(12px);
}

.mobile-bottom-nav-link {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.15rem;
  color: var(--muted);
  border-radius: 0.65rem;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.1;
  text-decoration: none;
}

.mobile-bottom-nav-link svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mobile-bottom-nav-link:hover,
.mobile-bottom-nav-link:focus {
  color: var(--brand);
  background: var(--brand-mist);
}

.mobile-bottom-nav-link.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

/* Reusable headings and surfaces */
.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--brand);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.page-heading {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0.2rem 0 1rem;
}

.page-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.45rem, 6vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.page-title-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

.page-subtitle {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.heading-actions {
  display: flex;
  gap: 0.5rem;
}

.heading-actions .btn,
.page-heading > .btn {
  width: 100%;
}

.product-icon,
.kpi-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #cce5d8;
}

.product-icon svg,
.kpi-icon svg {
  width: 68%;
  height: 68%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.product-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.product-icon-sm {
  width: 34px;
  height: 34px;
  border-radius: 0.65rem;
}

.product-icon-heading {
  width: 48px;
  height: 48px;
  border-radius: 0.9rem;
  box-shadow: 0 8px 20px rgba(8, 122, 73, 0.1);
}

.filter-wrapper,
.kpi-card,
.client-section,
.management-section,
.search-panel,
.edit-access-form,
.identity-panel,
.state-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* Login */
.login-page {
  display: grid;
  min-height: calc(100vh - 170px);
  padding: 0.25rem 0;
  place-items: center;
}

.login-panel {
  display: grid;
  width: min(100%, 960px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-brand-stage {
  position: relative;
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.35rem;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 95% 5%, rgba(255, 255, 255, 0.15), transparent 12rem),
    linear-gradient(145deg, #0a7b4d, var(--brand-deep));
}

.login-brand-stage::after {
  position: absolute;
  right: -6rem;
  bottom: -8rem;
  width: 18rem;
  height: 18rem;
  border: 2.5rem solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
  content: "";
}

.login-logo {
  width: 78px;
  height: 78px;
  padding: 0.4rem;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 1rem;
  box-shadow: 0 14px 30px rgba(4, 44, 29, 0.2);
}

.login-brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.login-brand-divider {
  width: 1px;
  height: 58px;
  background: rgba(255, 255, 255, 0.45);
}

.login-par-icon {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 1rem;
  box-shadow: 0 14px 30px rgba(4, 44, 29, 0.28);
}

.login-product {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.product-icon-lg {
  width: 46px;
  height: 46px;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
  border-radius: 0.85rem;
}

.login-product .eyebrow {
  color: #b9e9d1;
}

.login-product h1 {
  margin: 0;
  font-size: clamp(1.7rem, 8vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-intro {
  max-width: 34rem;
  margin: 0.5rem 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  line-height: 1.55;
}

.login-form {
  align-self: center;
  padding: 1.35rem;
}

.login-form-heading {
  margin-bottom: 1.25rem;
}

.login-form-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
}

.login-form-heading > p:last-child {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.form-floating > .form-control {
  min-height: 56px;
}

/* Dashboard filters */
.filter-wrapper {
  position: relative;
  z-index: 20;
  margin-bottom: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius);
}

.btn-filter {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: #c8dfd3;
}

.filter-toggle-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.btn-filter[aria-expanded="true"] .filter-toggle-hint {
  font-size: 0;
}

.btn-filter[aria-expanded="true"] .filter-toggle-hint::after {
  font-size: 0.78rem;
  content: "Hide options";
}

.filter-form {
  padding-top: 0.85rem;
}

.filter-grid {
  display: grid;
  gap: 0.8rem;
}

.filter-actions,
.form-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.65rem;
  margin-top: 1rem;
}

.applied-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.applied-filters-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.applied-filter-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.loan-disbursement-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  color: #754000;
  background: #fff3cd;
  border: 1px solid #e5bd55;
  border-left: 4px solid var(--past-due);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(117, 64, 0, 0.1);
  font-size: 0.82rem;
}

.loan-disbursement-notice span {
  font-weight: 700;
}

.loan-disbursement-notice strong {
  font-weight: 850;
}

.applied-filter-label {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  padding: 0.3rem 0.6rem;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #cce2d7;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Dashboard KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.kpi-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 136px;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 1rem;
  overflow: hidden;
  border-radius: var(--radius);
}

.kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.kpi-label > span:first-child {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  background: var(--surface-muted);
  border: 0;
  border-radius: 0.7rem;
}

.kpi-card > strong {
  font-size: clamp(1.65rem, 8vw, 2.45rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.kpi-collection {
  border-top: 4px solid var(--collection);
}

.kpi-collection > strong {
  color: var(--collection);
}

.kpi-to-collect {
  border-top: 4px solid var(--brand);
}

.kpi-to-collect > strong,
.kpi-to-collect .kpi-subcard strong {
  color: var(--brand);
}

.kpi-past-due {
  border-top: 4px solid var(--past-due);
}

.kpi-past-due > strong {
  color: var(--past-due);
}

.kpi-par-risk {
  border-color: rgba(185, 54, 48, 0.28);
  border-top: 4px solid var(--par);
}

.kpi-par-risk > strong {
  color: var(--par);
}

.kpi-par-clear {
  border-color: rgba(8, 122, 73, 0.25);
  border-top: 4px solid var(--collection);
}

.kpi-par-clear > strong {
  color: var(--collection);
}

.kpi-par-aging-card {
  grid-column: 1 / -1;
}

.kpi-subcards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.kpi-subcards-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-subcards-three .kpi-subcard {
  padding: 0.55rem 0.45rem;
}

.kpi-subcards-three .kpi-subcard span {
  font-size: 0.65rem;
}

.kpi-subcards-three .kpi-subcard strong,
.kpi-subcards-three .kpi-subcard strong.amount-loading {
  font-size: clamp(0.72rem, 2.7vw, 0.92rem) !important;
}

.kpi-subcard {
  min-width: 0;
  padding: 0.65rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.kpi-subcard span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.kpi-subcard strong,
.kpi-subcard strong.amount-loading {
  display: block;
  margin-top: 0.2rem;
  color: var(--collection);
  font-size: clamp(0.88rem, 4vw, 1.1rem) !important;
  overflow-wrap: anywhere;
}

.amount-loading {
  color: var(--muted) !important;
  font-size: 1rem !important;
}

.par-aging-content {
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.par-aging-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.par-aging-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.par-aging-header > span {
  color: var(--muted);
  font-size: 0.78rem;
}

.par-aging-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
}

.par-aging-bucket {
  display: block;
  min-width: 0;
  padding: 0.75rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.par-aging-bucket:hover,
.par-aging-bucket:focus-visible {
  border-color: var(--par);
  box-shadow: 0 5px 14px rgba(137, 43, 43, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.par-aging-bucket span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.par-aging-bucket strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--par);
  font-size: clamp(0.9rem, 4vw, 1.15rem);
  overflow-wrap: anywhere;
  text-align: right;
}

/* Data tables and modal details */
.client-section {
  min-width: 0;
  padding: 0.9rem;
  overflow: hidden;
  border-radius: var(--radius);
}

.client-section-header,
.section-title {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 1rem;
}

.client-section-header h2,
.section-title h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
}

.client-section-header p,
.section-title span {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.table-scroll-hint {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.table-responsive {
  scrollbar-color: #a8bbb2 transparent;
  scrollbar-width: thin;
}

.client-table {
  min-width: 1080px;
  margin: 0;
  font-size: 0.86rem;
  white-space: nowrap;
}

.client-name-with-par-days {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.par-days-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0.18rem 0.48rem;
  color: #842029;
  background: #f8d7da;
  border: 1px solid #f1aeb5;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

.client-table thead {
  background: var(--surface-muted);
}

.client-table th {
  padding: 0.75rem;
  color: #53665f;
  border-bottom-color: var(--line-strong);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.client-table td {
  padding: 0.8rem 0.75rem;
  border-color: #e4ebe8;
}

.client-table tbody tr {
  cursor: pointer;
  transition: background-color var(--transition), box-shadow var(--transition);
}

.client-table tbody tr:hover,
.client-table tbody tr:focus {
  background: var(--brand-mist);
  box-shadow: inset 3px 0 var(--brand);
  outline: none;
}

.loading-state {
  display: flex;
  min-height: 140px;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
}

.empty-state,
.simple-state {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 2.2rem 1rem;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.empty-state span {
  max-width: 30rem;
  font-size: 0.85rem;
}

.empty-state h3,
.simple-state h1 {
  margin: 0;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
}

.compact {
  padding: 1rem;
}

.status-badge,
.role-badge,
.status-dot {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.15;
}

.status-paid {
  color: #fff;
  background: #087747;
}

.enabled {
  color: #09623d;
  background: #e1f2e9;
}

.status-past-due {
  color: #fff;
  background: #92500f;
}

.status-par {
  color: #fff;
  background: #ae332e;
}

.disabled {
  color: #992e29;
  background: #f7e5e3;
}

.status-partial {
  color: #fff;
  background: var(--info);
}

.status-muted {
  color: #fff;
  background: #5e6f78;
}

.role-badge {
  color: #405951;
  background: #e9efec;
}

.modal-content {
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(12, 38, 29, 0.22);
}

.modal-header {
  padding: 1rem 1.1rem;
  border-bottom-color: var(--line);
}

.modal-title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.modal-body {
  padding: 1rem;
}

.contact-heading h3 {
  margin: 0;
  color: var(--brand);
  font-size: 1.25rem;
  font-weight: 800;
}

.contact-heading p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.portfolio-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 0;
}

.risk-status-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.7rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.risk-status-item > span {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.risk-summary-badge {
  display: inline-flex;
  /*width: 100%;*/
  min-height: 34px;
  align-items: center;
  /*justify-content: center;*/
  gap: 0.35rem;
  padding: 0.38rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  /*font-size: 0.8rem;*/
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.risk-summary-badge span {
  font-size: 0;
}

.risk-summary-danger {
  color: #fff;
  background: var(--par);
  border-color: #a92f2a;
}

.risk-summary-success {
  color: #09623d;
  background: #e1f2e9;
  border-color: #b9ddca;
}

.daily-collection-card {
  margin-top: 0.75rem;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: 0 8px 22px rgba(16, 42, 34, 0.06);
}

.daily-collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.daily-collection-heading span {
  display: block;
  color: var(--brand);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.daily-collection-heading h4 {
  margin: 0.12rem 0 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 800;
}

.daily-collection-totals,
.collection-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.75rem 0 0;
}

.daily-collection-totals > div,
.collection-breakdown > div {
  min-width: 0;
  padding: 0.7rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.daily-collection-totals dd {
  font-size: clamp(1rem, 4.5vw, 1.25rem);
}

.daily-collection-totals .collection-total {
  background: var(--brand-soft);
  border-color: #c5e1d2;
}

.daily-collection-totals .collection-total dd {
  color: var(--brand-dark);
}

.collection-breakdown {
  position: relative;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line-strong);
}

.collection-breakdown::before {
  position: absolute;
  top: -0.55rem;
  left: 0;
  padding-right: 0.45rem;
  color: var(--muted);
  background: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  content: "Collection breakdown";
}

dt {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

dd {
  margin: 0.2rem 0 0;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.loan-summary-section,
.loan-schedule-section {
  margin-top: 1.25rem;
}

.loan-schedule-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.loan-schedule-heading h4 {
  margin: 0;
  color: var(--brand);
  font-size: 0.95rem;
  font-weight: 800;
}

.loan-schedule-heading span {
  color: var(--muted);
  font-size: 0.78rem;
}

.loan-summary-grid {
  display: grid;
  gap: 0.6rem;
}

.loan-summary-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.loan-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.loan-summary-card strong {
  display: block;
  margin-top: 0.15rem;
  overflow-wrap: anywhere;
}

.loan-schedule-table-wrapper {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  overflow-y: visible;
}

.loan-schedule-table {
  min-width: 1500px;
  margin-bottom: 0;
  font-size: 0.76rem;
  white-space: nowrap;
}

.loan-schedule-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
}

.loan-schedule-table th {
  padding: 0.6rem;
  color: var(--muted);
  vertical-align: middle;
}

.contact-number {
  display: grid;
  gap: 0.2rem;
  margin: 1rem 0;
  padding: 0.8rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.contact-number span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.btn-call {
  color: #fff;
  background: var(--collection);
  border-color: var(--collection);
}

.btn-call:hover {
  color: #fff;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.client-image-section {
  margin: 1rem 0;
  padding: 0.9rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.client-image-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
}

.client-uploaded-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.client-image-empty {
  padding-block: 1.25rem;
}

.client-image-upload-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.client-image-upload-form .btn {
  width: 100%;
}

.upload-feedback {
  font-size: 0.82rem;
  font-weight: 700;
}

.client-comments-card {
  margin-top: 1.25rem;
  padding: 0.9rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.client-comments-card form {
  display: grid;
  gap: 0.5rem;
}

.comment-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.comment-feedback {
  font-size: 0.82rem;
  font-weight: 700;
}

.client-comment-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.client-comment {
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.client-comment-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.client-comment-meta > div {
  display: grid;
  gap: 0.1rem;
}

.client-comment-meta .client-comment-actions {
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.client-comment-meta .btn {
  flex: 0 0 auto;
}

.client-comment-meta strong {
  color: var(--brand);
}

.client-comment p {
  margin: 0.45rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.client-comment-reply-form {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.client-comment-reply-buttons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.client-comment-replies {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--line);
}

.client-comment-replies:empty {
  display: none;
}

.client-comment-replies .client-comment {
  background: var(--surface-muted);
}

@media (max-width: 575.98px) {
  .client-comment-replies {
    margin-left: 0.25rem;
    padding-left: 0.5rem;
  }
}

/* DataTables Bootstrap integration */
div.dt-container .dt-layout-row {
  gap: 0.65rem;
  align-items: center;
  margin: 0.85rem 0;
}

div.dt-container .dt-search,
div.dt-container .dt-length {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}

div.dt-container .dt-search {
  align-items: stretch;
  flex-direction: column;
}

div.dt-container .dt-search input,
div.dt-container .dt-length select {
  min-height: 40px;
  margin: 0;
  border-color: var(--line-strong);
  border-radius: var(--radius-sm);
}

div.dt-container .dt-search input {
  width: 100%;
}

div.dt-container .dt-info {
  color: var(--muted);
  font-size: 0.8rem;
}

div.dt-container .pagination {
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: center;
}

.page-link {
  min-width: 38px;
  min-height: 38px;
  color: var(--brand);
  border-color: var(--line);
}

.active > .page-link,
.page-link.active {
  background: var(--brand);
  border-color: var(--brand);
}

/* User access */
.user-access-page {
  display: grid;
  gap: 1rem;
}

.search-panel,
.edit-access-form,
.identity-panel,
.management-section {
  padding: 1rem;
  border-radius: var(--radius);
}

.search-panel .input-group {
  align-items: stretch;
}

.management-grid {
  display: grid;
  gap: 1rem;
}

.access-list {
  display: grid;
  gap: 0.65rem;
}

.access-row {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.access-row:hover {
  border-color: var(--line-strong);
  box-shadow: 0 7px 18px rgba(16, 42, 34, 0.06);
}

.access-row > div:first-child,
.identity-panel {
  display: grid;
  min-width: 0;
  gap: 0.24rem;
}

.access-row strong,
.identity-panel strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.access-row span,
.identity-panel span,
.identity-panel small,
.access-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.row-actions .btn,
.row-actions form {
  flex: 1 1 auto;
}

.row-actions .btn {
  width: 100%;
}

.edit-access-form {
  width: 100%;
}

.identity-panel {
  margin-bottom: 1rem;
  background: var(--brand-mist);
  box-shadow: none;
}

.access-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem;
  margin-bottom: 1rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.access-toggle label {
  color: var(--ink);
  font-weight: 800;
}

.access-toggle p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.access-toggle .form-switch {
  flex: 0 0 auto;
  padding-left: 0;
}

.access-toggle .form-check-input {
  width: 2.75rem;
  height: 1.4rem;
  margin: 0;
}

.form-section {
  margin-bottom: 1rem;
}

.form-section-heading {
  margin-bottom: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.form-section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.form-section-heading p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.scope-section {
  margin-bottom: 1rem;
}

.scope-note {
  padding: 0.85rem;
  margin-bottom: 1rem;
  color: var(--muted);
  background: #f3f7f5;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 0.65rem;
  font-size: 0.88rem;
}

/* Error and permission states */
.state-card {
  width: min(100%, 620px);
  margin: 3rem auto;
  padding: 2rem 1rem;
  border-radius: var(--radius-lg);
}

.state-card > p:not(.eyebrow, .request-id) {
  max-width: 32rem;
  margin: 0.35rem auto 1rem;
}

.state-code {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 0.4rem;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 50%;
  font-weight: 850;
}

.request-id {
  max-width: 100%;
  padding: 0.65rem 0.8rem;
  overflow-wrap: anywhere;
  background: var(--surface-muted);
  border-radius: 0.5rem;
  font-size: 0.82rem;
}

@media (min-width: 576px) {
  .app-header-inner,
  .app-shell {
    padding-inline: 1rem;
  }

  .brand-logo-wrap,
  .brand-logo {
    width: 50px;
    height: 50px;
  }

  .brand-divider {
    display: block;
  }

  .product-lockup strong {
    max-width: none;
    font-size: 0.95rem;
  }

  .heading-actions .btn,
  .page-heading > .btn {
    width: auto;
  }

  .product-icon-heading {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
  }

  .filter-actions,
  .form-actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .filter-actions .btn,
  .form-actions .btn {
    min-width: 8.5rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-collection {
    grid-column: 1 / -1;
  }

  .kpi-to-collect {
    grid-column: 1 / -1;
  }

  .kpi-past-due {
    grid-column: 1 / -1;
  }

  .par-aging-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .risk-summary-badge span {
    font-size: inherit;
  }

  .modal-body {
    padding: 1.25rem;
  }

  div.dt-container .dt-search {
    align-items: center;
    flex-direction: row;
  }

  div.dt-container .dt-search input {
    width: auto;
    min-width: 220px;
  }

  .row-actions .btn,
  .row-actions form {
    flex: 0 0 auto;
  }
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }

  .has-mobile-bottom-nav {
    padding-bottom: 0;
  }

  .mobile-bottom-nav {
    display: none;
  }

  .app-shell {
    padding-top: 1.25rem;
  }

  .page-heading,
  .client-section-header,
  .section-title {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-collection,
  .kpi-to-collect {
    grid-column: auto;
  }

  .par-aging-header {
    flex-direction: row;
    align-items: end;
    justify-content: space-between;
  }

  .par-aging-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .loan-summary-card {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .access-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .login-brand-stage,
  .login-form {
    padding: 2rem;
  }

  .login-logo {
    width: 108px;
    height: 108px;
  }

  .login-brand-divider {
    height: 78px;
  }

  .login-par-icon {
    width: 108px;
    height: 108px;
  }
}

@media (min-width: 992px) {
  .app-header .navbar {
    min-height: 76px;
  }

  .brand-logo-wrap,
  .brand-logo {
    width: 56px;
    height: 56px;
  }

  .product-lockup > .product-icon,
  .product-lockup small {
    display: block;
  }

  .product-lockup > .product-icon {
    display: inline-grid;
  }

  .navbar-collapse {
    padding-top: 0;
  }

  .navbar-nav {
    margin-left: 1.25rem;
    padding-block: 0;
  }

  .navbar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    background: transparent;
  }

  .navbar .nav-link.active {
    background: transparent;
  }

  .navbar .nav-link.active::after {
    position: absolute;
    right: 0.8rem;
    bottom: -0.45rem;
    left: 0.8rem;
    height: 3px;
    background: var(--brand);
    border-radius: 999px;
    content: "";
  }

  .navbar-user {
    padding: 0;
    border-top: 0;
  }

  .filter-wrapper {
    padding: 1rem;
  }

  .filter-form {
    padding-top: 0;
  }

  .filter-grid {
    grid-template-columns: 180px repeat(4, minmax(0, 1fr));
  }

  .applied-filters {
    flex-direction: row;
    align-items: center;
  }

  .management-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edit-access-form {
    max-width: 840px;
  }

  .login-panel {
    grid-template-columns: 1.08fr 0.92fr;
  }

  .login-brand-stage {
    min-height: 520px;
  }
}

@media (min-width: 1200px) {
  .app-header-inner,
  .app-shell {
    padding-inline: 1.5rem;
  }

  .client-section,
  .management-section,
  .search-panel,
  .edit-access-form {
    padding: 1.25rem;
  }

  .kpi-grid {
    grid-template-columns: 1.35fr 1.35fr minmax(0, 1fr);
  }

  .kpi-past-due {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.biometric-settings {
  max-width: 800px;
  margin-inline: auto;
}

.biometric-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  margin-block: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--border, #dbe3ea);
  border-radius: 1rem;
  background: #fff;
}

.biometric-card h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

.biometric-icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  color: var(--brand, #13653f);
  border-radius: 50%;
  background: rgba(19, 101, 63, 0.1);
  font-size: 2rem;
}

.biometric-action + .biometric-action {
  margin-top: 1rem;
}

.biometric-login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-block: 1rem;
  color: #68747f;
  font-size: 0.85rem;
}

.biometric-login-divider::before,
.biometric-login-divider::after {
  flex: 1;
  height: 1px;
  background: #dbe3ea;
  content: "";
}

.comparison-on-demand {
  display: grid;
  justify-items: start;
  gap: 0.65rem;
  padding: 0.9rem;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  font-size: 0.78rem;
}

@media (min-width: 992px) {
  .dashboard-page .filter-wrapper {
    position: sticky;
    top: 76px;
    z-index: 25;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(16, 42, 34, 0.08);
    backdrop-filter: blur(10px);
  }

  .action-queue .action-queue-heading {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
