/*
 * Tinubuan authenticated product design system.
 * styles.css supplies legacy layout contracts; this file owns the canonical
 * tokens, typography, light-only appearance, and component finish.
 */

:root {
  color-scheme: light;
  --app-font-ui: 'Figtree', ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --app-font-display: var(--app-font-ui);
  --app-font-caption: .75rem;
  --app-font-support: .8125rem;
  --app-font-body: .9375rem;
  --app-canvas: #F5F6FA;
  --app-surface: #FFFFFF;
  --app-surface-subtle: #EEF0F5;
  --app-surface-muted: #E6E8F0;
  --app-ink: #020C45;
  --app-ink-soft: #020C45;
  --app-muted: #5B6180;
  --app-line: #D7D9E6;
  --app-line-strong: #BDC1D6;
  --app-brand: #F4D54A;
  --app-brand-soft: #FDF7DA;
  --app-brand-ink: #6B5410;
  --app-positive: #2E6B4D;
  --app-positive-soft: #E8F2EC;
  --app-warning: #6b5410;
  --app-warning-soft: #fdf7da;
  --app-danger: #B6423A;
  --app-danger-soft: #fbe9e6;
  --app-info: #315f7d;
  --app-info-soft: #e8f1f6;
  --app-radius-sm: 10px;
  --app-radius-md: 14px;
  --app-radius-lg: 20px;
  --app-radius-xl: 26px;
  --app-shadow-sm: 0 1px 2px rgba(2, 12, 69, .05);
  --app-shadow-md: 0 14px 34px rgba(2, 12, 69, .08);
  --app-shadow-lg: 0 24px 70px rgba(2, 12, 69, .18);

  --bg: var(--app-canvas);
  --surface: var(--app-surface);
  --surface-2: var(--app-surface-subtle);
  --border: var(--app-line);
  --border-strong: var(--app-line-strong);
  --text: var(--app-ink);
  --text-muted: var(--app-muted);
  --accent: var(--app-ink);
  --accent-strong: #020c45;
  --yellow: var(--app-brand);
  --yellow-deep: #6b5410;
  --danger: var(--app-danger);
  --success: var(--app-positive);
  --radius: var(--app-radius-md);
}

html {
  background: var(--app-canvas);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--app-ink);
  background: var(--app-canvas);
  font-family: var(--app-font-ui);
  font-size: 15px;
  line-height: 1.5;
}

body::before {
  content: none !important;
}

::selection {
  color: var(--app-ink);
  background: var(--app-brand-soft);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  letter-spacing: -.005em;
}

a,
button,
input,
select,
textarea {
  touch-action: manipulation;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea {
  min-height: 48px;
  padding: 12px 14px;
  color: var(--app-ink);
  background: var(--app-surface);
  border: 1px solid var(--app-line-strong);
  border-radius: var(--app-radius-md);
  box-shadow: 0 1px 1px rgba(2, 12, 69, .025);
}

textarea { min-height: 104px; }

input::placeholder,
textarea::placeholder { color: #707693; }

input:hover,
select:hover,
textarea:hover { border-color: #a8adc9; }

input:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(244, 213, 74, .28);
  outline-offset: 1px;
  border-color: #6b5410;
  box-shadow: none;
}

label {
  color: var(--app-ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.field-help,
.muted {
  color: var(--app-muted);
}

.field-help {
  font-weight: 500;
  line-height: 1.5;
}

/* Authentication */

#login-view {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top, 0px))
    max(18px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px))
    max(18px, env(safe-area-inset-left, 0px));
  background:
    linear-gradient(180deg, rgba(255,255,255,.7), transparent 48%),
    var(--app-canvas);
}

#login-view::before {
  content: "";
  position: fixed;
  z-index: -1;
  width: 190px;
  height: 190px;
  right: -88px;
  top: -78px;
  border: 42px solid rgba(244, 213, 74,.18);
  border-radius: 50%;
}

#login-view .card {
  width: min(100%, 420px);
  max-width: 420px;
  padding: 28px 22px 24px;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-xl);
  box-shadow: var(--app-shadow-md);
}

.auth-logo-wrap { padding: 6px 0 24px; }
.auth-logo { width: min(240px, 80%); }
.tagline { margin-bottom: 25px; color: var(--app-muted); }

#login-view button[type="submit"],
.panel-form button[type="submit"] {
  min-height: 48px;
  color: #fff;
  background: var(--app-ink);
  border-radius: var(--app-radius-md);
  box-shadow: none;
}

#login-view button[type="submit"]:hover,
.panel-form button[type="submit"]:hover { background: #020c45; }

/* Application shell */

.view { min-height: 100vh; min-height: 100dvh; }

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 68px;
  padding:
    calc(10px + env(safe-area-inset-top, 0px))
    max(15px, env(safe-area-inset-right, 0px))
    10px
    max(15px, env(safe-area-inset-left, 0px));
  gap: 12px;
  color: var(--app-ink);
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--app-line);
  box-shadow: none;
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.app-header::before,
.app-header::after { content: none !important; }

.app-header-left {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.dashboard-wordmark {
  width: 124px;
  max-width: 32vw;
  filter: none;
}

.group-heading {
  max-width: min(48vw, 360px);
  min-height: 28px;
  margin: 0;
  padding: 5px 10px;
  overflow: hidden;
  color: var(--app-ink-soft);
  background: var(--app-surface-muted);
  border: 1px solid var(--app-line);
  border-radius: 999px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 800;
  line-height: 16px;
  letter-spacing: .01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-btn,
.header-notification-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--app-ink);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: 13px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.avatar-btn:hover,
.header-notification-btn:hover,
.header-notification-btn.active {
  color: var(--app-ink);
  background: var(--app-brand-soft);
  border-color: #f4d54a;
}

.header-notification-badge,
.bell-badge,
.fab-badge {
  color: #fff;
  background: var(--app-danger);
  border-color: #fff;
  box-shadow: none;
}

.profile-menu {
  top: calc(100% + 9px);
  min-width: 224px;
  padding: 7px;
  background: rgba(255,255,255,.98);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  box-shadow: var(--app-shadow-md);
}

.profile-menu-item {
  min-height: 44px;
  padding: 10px 11px;
  border-radius: var(--app-radius-sm);
  font-size: 13px;
  font-weight: 750;
}

.profile-menu-item:hover { background: var(--app-surface-muted); }

.sticky-band-wrap,
.weave-band { display: none !important; }

/* Treasurer and administrator workspace */

.dashboard-shell {
  display: flex;
  flex-direction: column;
  width: min(100%, 1480px);
  max-width: 1480px;
  margin: 0 auto;
  padding:
    12px
    max(12px, env(safe-area-inset-right, 0px))
    calc(40px + env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  gap: 14px;
}

.sidebar {
  top: calc(var(--header-h, 68px) + 6px);
  display: flex;
  width: 100%;
  padding: 5px;
  gap: 3px;
  overflow-x: auto;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  box-shadow: var(--app-shadow-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sidebar-item {
  min-height: 42px;
  padding: 9px 11px;
  gap: 7px;
  color: var(--app-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--app-radius-sm);
  font-size: 12px;
  font-weight: 720;
}

.sidebar-item svg { width: 17px; height: 17px; }

.sidebar-item:hover {
  color: var(--app-ink);
  background: var(--app-surface-muted);
}

.sidebar-item.active {
  color: var(--app-ink);
  background: var(--app-brand-soft);
  border-color: #f7e48f;
  box-shadow: none;
}

.sidebar-item.is-locked,
.sidebar-item.is-locked:hover {
  color: #8a8fad;
  background: transparent;
}

.dashboard-main { min-width: 0; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.kpi-card,
.summary-card {
  position: relative;
  min-width: 0;
  padding: 14px;
  overflow: hidden;
  color: var(--app-ink);
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  box-shadow: var(--app-shadow-sm);
}

.kpi-card::before,
.summary-card::before { content: none; }

.kpi-label,
.summary-label {
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.kpi-value,
.summary-value {
  margin-top: 4px;
  color: var(--app-ink);
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: -.035em;
}

.dashboard-main > .tab-content,
.borrower-content > .tab-content {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.tab-content { animation: app-tab-in 160ms ease both; }

@keyframes app-tab-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

.section-header,
.borrower-page-head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  min-height: 0;
  margin: 0 0 14px;
  padding: 18px;
  overflow: visible;
  color: var(--app-ink);
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}

.section-header::before,
.section-header::after,
.borrower-page-head::before,
.borrower-page-head::after { content: none !important; }

.section-title-block { min-width: 0; }

.section-kicker,
.borrower-page-head .section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 8px;
  color: var(--app-brand-ink);
  background: var(--app-brand-soft);
  border: 1px solid #f7e48f;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  line-height: 15px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.section-title-block h2,
.section-header h2,
.borrower-page-head h2,
.borrower-page-head .greeting {
  margin: 7px 0 0;
  color: var(--app-ink);
  font-size: clamp(22px, 7vw, 31px);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -.04em;
}

.section-title-block p,
.borrower-page-head > p:last-child {
  max-width: 650px;
  margin: 7px 0 0;
  color: var(--app-muted);
  font-size: 13px;
  line-height: 1.55;
}

.section-header .add-btn,
.add-btn,
.confirm-btn {
  min-height: 43px;
  padding: 10px 14px;
  color: #fff;
  background: var(--app-ink);
  border: 1px solid var(--app-ink);
  border-radius: 12px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
}

.section-header .add-btn:hover,
.add-btn:hover,
.confirm-btn:hover {
  color: var(--app-ink);
  background: var(--app-brand);
  border-color: #d9b92e;
}

.ghost-btn,
.small-btn,
.toggle-btn,
.account-text-link,
.filter-chip,
.notification-filter {
  min-height: 38px;
  padding: 8px 11px;
  color: var(--app-ink-soft);
  background: var(--app-surface);
  border: 1px solid var(--app-line-strong);
  border-radius: 10px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 750;
}

.ghost-btn:hover,
.small-btn:hover,
.toggle-btn:hover,
.filter-chip:hover,
.notification-filter:hover {
  color: var(--app-ink);
  background: var(--app-surface-muted);
  border-color: #a8adc9;
}

.search-input input,
.loan-directory-toolbar input,
.loan-directory-toolbar select {
  min-height: 46px;
  background: var(--app-surface);
  border-color: var(--app-line-strong);
  border-radius: 12px;
  box-shadow: none;
}

.tab-support-copy,
.subscription-notice,
.feedback {
  padding: 12px 14px;
  color: var(--app-ink-soft);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: 12px;
}

.feedback.success { color: var(--app-positive); background: var(--app-positive-soft); border-color: #b9d8c9; }
.feedback.error { color: var(--app-danger); background: var(--app-danger-soft); border-color: #e9beb7; }

.subsection-heading {
  margin: 20px 0 10px;
  color: var(--app-ink-soft);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.list-row,
.group-row,
.loan-summary-card,
.history-card,
.contribution-record,
.borrower-loan-group,
.activity-row,
.cash-count-card,
.notification-list-item,
.reason-card {
  color: var(--app-ink);
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  box-shadow: var(--app-shadow-sm);
}

.list-row,
.group-row { padding: 14px; }

.row-title,
.history-title { color: var(--app-ink); font-weight: 800; }

.badge {
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge.active { color: var(--app-positive); background: var(--app-positive-soft); border-color: #b9d8c9; }
.badge.disabled { color: var(--app-muted); background: var(--app-surface-muted); border-color: var(--app-line); }
.badge.warning { color: var(--app-danger); background: var(--app-danger-soft); border-color: #e9beb7; }

.row-actions,
.contribution-record-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.history-receipt-btn { margin-top: 10px; }

.borrower-loan-toggle {
  min-height: 76px;
  padding: 13px;
  background: transparent;
  border-radius: var(--app-radius-md);
}

.borrower-loan-avatar {
  color: var(--app-ink);
  background: var(--app-brand-soft);
  border: 1px solid #f7e48f;
}

.borrower-loan-items { border-top-color: var(--app-line); background: var(--app-surface-subtle); }

.table-wrap {
  overflow-x: auto;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  box-shadow: var(--app-shadow-sm);
}

table { min-width: 720px; }

th {
  color: var(--app-muted);
  background: var(--app-surface-subtle);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

td, th { border-bottom-color: var(--app-line); }

.empty-state,
.loan-directory-empty,
.payment-history-empty,
.treasurer-access-empty {
  padding: 24px;
  color: var(--app-muted);
  background: var(--app-surface);
  border: 1px dashed var(--app-line-strong);
  border-radius: var(--app-radius-lg);
  box-shadow: none;
}

.variance-alert {
  padding: 13px;
  background: var(--app-warning-soft);
  border: 1px solid #f7e48f;
  border-radius: var(--app-radius-md);
  box-shadow: none;
}

/* Borrower portal */

body.borrower-page,
body.borrower-page #app-view { background: var(--app-canvas); }

.borrower-content {
  width: min(100%, 860px);
  max-width: 860px;
  padding:
    12px
    max(12px, env(safe-area-inset-right, 0px))
    calc(104px + env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
}

.borrower-page-head { align-items: flex-start; margin: 0 0 12px; }

.borrower-page-head .h2-icon {
  width: 30px;
  height: 30px;
  color: var(--app-ink);
  background: var(--app-brand-soft);
  border: 1px solid #f7e48f;
  border-radius: 9px;
}

.summary-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.summary-icon {
  width: 30px;
  height: 30px;
  color: var(--app-ink);
  background: var(--app-surface-muted);
  border-radius: 9px;
}

.summary-icon.gold { color: var(--app-brand-ink); background: var(--app-brand-soft); }
.summary-icon.green { color: var(--app-positive); background: var(--app-positive-soft); }

.standing-hero {
  padding: 18px;
  color: var(--app-ink);
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}

.standing-hero::before,
.standing-hero::after { content: none !important; }

.dock {
  left: 8px;
  right: 8px;
  bottom: calc(8px + var(--standalone-bottom-shift, 0px));
  min-height: 68px;
  padding:
    7px
    max(4px, env(safe-area-inset-right, 0px))
    max(7px, env(safe-area-inset-bottom, 0px))
    max(4px, env(safe-area-inset-left, 0px));
  background: rgba(255,255,255,.97);
  border: 1px solid var(--app-line);
  border-radius: 19px;
  box-shadow: 0 16px 36px rgba(2, 12, 69,.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.dock::after { display: none; }

.dock-item {
  min-height: 48px;
  gap: 2px;
  color: var(--app-muted);
  border-radius: 11px;
  font-size: 12px;
}

.dock-item svg { width: 20px; height: 20px; }
.dock-item.active { color: var(--app-ink); background: var(--app-brand-soft); }
.dock-item.active::after { content: none; }

.dock-center { margin-top: 0; gap: 2px; }
.dock-center-btn {
  width: 46px;
  height: 42px;
  color: var(--app-muted);
  background: transparent;
  border: 0;
  border-radius: 11px;
}
.dock-center-btn.active { color: var(--app-ink); background: var(--app-brand); }
.dock-center-btn.active svg { color: var(--app-ink); }

.fab-chat {
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  width: 48px;
  height: 48px;
  color: #fff;
  background: var(--app-ink);
  border: 1px solid #020c45;
  box-shadow: 0 12px 28px rgba(2, 12, 69,.2);
}

.notif-panel {
  width: min(calc(100vw - 24px), 390px);
  right: 12px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-lg);
}

.notif-item.unread { background: var(--app-brand-soft); }

/* Dialogs and forms */

.modal-overlay {
  padding:
    max(10px, env(safe-area-inset-top, 0px))
    max(10px, env(safe-area-inset-right, 0px))
    max(10px, env(safe-area-inset-bottom, 0px))
    max(10px, env(safe-area-inset-left, 0px));
  background: rgba(2, 12, 69, .54);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  width: min(100%, 620px);
  max-height: min(92dvh, 900px);
  padding: 20px;
  background: var(--app-surface);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-lg);
}

.modal.modal-wide { width: min(100%, 920px); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.secondary-btn {
  color: var(--app-ink-soft);
  background: var(--app-surface-subtle);
  border-color: var(--app-line-strong);
}

.modal-header {
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--app-line);
}

.modal-header h2 {
  margin: 0;
  color: var(--app-ink);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -.025em;
}

.modal-close-btn {
  width: 38px;
  height: 38px;
  color: var(--app-muted);
  background: var(--app-surface-muted);
  border: 1px solid var(--app-line);
  border-radius: 11px;
}

.modal-close-btn:hover { color: var(--app-ink); background: var(--app-brand-soft); }

form.panel-form {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.radio-row {
  padding: 5px;
  gap: 5px;
  background: var(--app-surface-muted);
  border-radius: var(--app-radius-md);
}

.radio-option,
.checkbox-option {
  color: var(--app-ink-soft);
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 11px;
}

.chat-modal { background: var(--app-surface); }
.chat-thread { background: var(--app-surface-subtle); border-color: var(--app-line); }
.chat-bubble.mine { color: #fff; background: var(--app-ink); }
.chat-bubble.theirs { color: var(--app-ink); background: var(--app-surface-muted); }

/* Account and subscription center */

.account-center-overlay { background: rgba(2, 12, 69,.54); }
.account-center-modal {
  background: var(--app-canvas);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: var(--app-radius-xl);
  box-shadow: var(--app-shadow-lg);
}

.account-center-topbar {
  background: rgba(255,255,255,.96);
  border-bottom-color: var(--app-line);
}

.account-profile-hero {
  min-height: 126px;
  color: #fff;
  background: var(--app-ink);
  border-radius: var(--app-radius-lg);
  box-shadow: none;
}

.account-profile-hero::before {
  width: 180px;
  height: 180px;
  right: -64px;
  top: -96px;
  background: var(--app-brand);
  opacity: 1;
}

.account-profile-hero::after { display: none; }

.account-panel {
  background: var(--app-surface);
  border-color: var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}

.subscription-plan-card {
  background: var(--app-surface);
  border-color: var(--app-line-strong);
  border-radius: var(--app-radius-md);
}

.subscription-plan-card.is-selected {
  background: #f5f6fa;
  border-color: #d9b92e;
  box-shadow: 0 0 0 3px rgba(244, 213, 74,.18);
}

/* Compliance and document components */

.trust-grid {
  display: grid;
  gap: 12px;
}

.trust-card,
.document-action-card,
.loan-disclosure-preview {
  padding: 17px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}

.trust-card-head,
.document-action-head,
.disclosure-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.trust-card-icon,
.document-action-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  color: var(--app-brand-ink);
  background: var(--app-brand-soft);
  border: 1px solid #f7e48f;
  border-radius: 11px;
}

.trust-card-icon svg,
.document-action-icon svg { width: 18px; height: 18px; }

.trust-card h3,
.document-action-card h3,
.loan-disclosure-preview h3 {
  margin: 0;
  color: var(--app-ink);
  font-size: 16px;
  font-weight: 830;
  letter-spacing: -.015em;
}

.trust-card p,
.document-action-card p,
.loan-disclosure-preview p {
  margin: 5px 0 0;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.55;
}

.trust-actions,
.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.trust-actions button,
.document-actions button,
.document-btn,
.disclosure-btn {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--app-ink-soft);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line-strong);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 780;
}

.trust-actions button:hover,
.document-actions button:hover,
.document-btn:hover,
.disclosure-btn:hover { color: var(--app-ink); background: var(--app-brand-soft); border-color: #f4d54a; }

.privacy-notice {
  display: grid;
  gap: 14px;
  color: var(--app-ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.privacy-notice h3 {
  margin: 0 0 4px;
  color: var(--app-ink);
  font-size: 15px;
}

.privacy-notice p,
.privacy-notice ul { margin: 0; }

.privacy-notice ul { padding-left: 19px; }

.consent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  color: var(--app-muted);
  background: var(--app-surface-muted);
  border: 1px solid var(--app-line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.consent-status.is-accepted { color: var(--app-positive); background: var(--app-positive-soft); border-color: #b9d8c9; }

.trust-history-grid {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.case-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: 11px;
}

.case-history-row + .case-history-row { margin-top: 7px; }
.case-history-row strong,
.case-history-row span { display: block; }
.case-history-row strong { color: var(--app-ink); font-size: 12px; }
.case-history-row div > span { margin-top: 2px; color: var(--app-muted); font-size: 12px; text-transform: capitalize; }

.compliance-form {
  display: grid;
  gap: 13px;
}

.compliance-form label { margin: 0; }

.disclosure-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.disclosure-metric {
  min-width: 0;
  padding: 11px;
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: 11px;
}

.disclosure-metric span {
  display: block;
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.disclosure-metric strong {
  display: block;
  margin-top: 4px;
  color: var(--app-ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.disclosure-attestation {
  display: grid;
  gap: 10px;
  margin: 15px 0;
  padding: 13px;
  background: var(--app-warning-soft);
  border: 1px solid #f7e48f;
  border-radius: 12px;
}

.disclosure-attestation label { margin: 0; }

.case-list,
.request-history-list,
.consent-history-list {
  display: grid;
  gap: 8px;
}

.case-row,
.request-history-row,
.consent-history-row {
  padding: 12px;
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: 11px;
}

.case-row strong,
.request-history-row strong,
.consent-history-row strong { display: block; color: var(--app-ink); font-size: 12px; }
.case-row span,
.request-history-row span,
.consent-history-row span { display: block; margin-top: 3px; color: var(--app-muted); font-size: 12px; }

.receipt-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.overdue-label { color: var(--app-danger); background: var(--app-danger-soft); border-color: #e9beb7; }
.due-soon-label { color: var(--app-warning); background: var(--app-warning-soft); border-color: #f7e48f; }

/* Administrator support queue */

.support-queue-grid {
  display: grid;
  gap: 12px;
}

.support-queue-section {
  padding: 16px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}

.support-queue-section h3 { margin: 0 0 12px; font-size: 15px; }

.compliance-queue-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: 12px;
}

.compliance-queue-card + .compliance-queue-card { margin-top: 10px; }
.compliance-queue-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.compliance-queue-head strong,
.compliance-queue-head span { display: block; }
.compliance-queue-head strong { color: var(--app-ink); font-size: 12px; }
.compliance-queue-head div > span { margin-top: 2px; color: var(--app-muted); font-size: 12px; }
.compliance-queue-card h4 { margin: 0; color: var(--app-ink); font-size: 14px; text-transform: capitalize; }
.compliance-queue-card p { margin: 0; color: var(--app-ink-soft); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.compliance-queue-card label { margin: 0; font-size: 12px; }
.case-category { color: var(--app-muted); font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }

/* Responsive progression */

@media (min-width: 480px) {
  #login-view .card { padding: 34px 32px 30px; }
  .dashboard-shell { padding: 16px; gap: 16px; }
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section-header,
  .borrower-page-head { padding: 21px; }
  .trust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .disclosure-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 760px) {
  .app-header {
    min-height: 74px;
    padding: 13px max(24px, env(safe-area-inset-right, 0px)) 13px max(24px, env(safe-area-inset-left, 0px));
  }
  .dashboard-wordmark { width: 138px; }
  .group-heading { max-width: 360px; font-size: 12px; }
  .dashboard-shell { padding: 20px 24px 48px; }
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .kpi-card,
  .summary-card { padding: 16px; }
  .section-header,
  .borrower-page-head { padding: 24px; border-radius: 22px; }
  .modal { padding: 24px; border-radius: 22px; }
  .trust-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .support-queue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .borrower-content { padding: 20px 24px 120px; }
}

@media (min-width: 960px) {
  .dashboard-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
    gap: 22px;
    padding-top: 22px;
  }
  .sidebar {
    top: calc(var(--header-h, 74px) + 18px);
    display: flex;
    flex-direction: column;
    width: 220px;
    max-height: calc(100dvh - var(--header-h, 74px) - 36px);
    padding: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: var(--app-radius-lg);
  }
  .sidebar-item {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
  }
  .kpi-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi-value { font-size: clamp(17px, 1.7vw, 23px); }
  .dashboard-main { min-width: 0; }
  .borrower-content { max-width: 980px; }
  .borrower-content .tab-content { min-width: 0; }
  .dock { left: 50%; right: auto; width: min(650px, calc(100vw - 32px)); transform: translateX(-50%); }
}

@media (min-width: 1240px) {
  .dashboard-shell { grid-template-columns: 236px minmax(0, 1fr); gap: 28px; }
  .sidebar { width: 236px; }
  .section-header { padding: 26px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .app-header,
  .sidebar,
  .dock,
  .fab-chat,
  .profile-menu,
  .header-notification-btn,
  button { display: none !important; }
  body,
  .view,
  .dashboard-shell,
  .dashboard-main,
  .borrower-content { display: block; width: auto; max-width: none; padding: 0; background: #fff; }
  .tab-content[hidden] { display: none !important; }
  .section-header,
  .borrower-page-head,
  .list-row,
  .history-card,
  .trust-card { break-inside: avoid; box-shadow: none; }
}

/* ============================================================
   TINUBUAN PRODUCT UI v3
   Polished responsive layer. This intentionally remains isolated from the
   public homepage and only refines authenticated and account-access screens.
   ============================================================ */

:root {
  --app-canvas: #f5f6fa;
  --app-surface: #ffffff;
  --app-surface-glass: rgba(255, 255, 255, .88);
  --app-surface-subtle: #f5f6fa;
  --app-surface-muted: #eef0f5;
  --app-ink: #020c45;
  --app-ink-soft: #0e1a5c;
  --app-muted: #5b6180;
  --app-line: #d5d8e6;
  --app-line-strong: #bcc0d6;
  --app-brand: #f4d54a;
  --app-brand-bright: #f4d54a;
  --app-brand-soft: #fdf7da;
  --app-brand-ink: #6b5410;
  --app-positive: #206346;
  --app-positive-soft: #e3f2e9;
  --app-warning: #6b5410;
  --app-warning-soft: #fdf7da;
  --app-danger: #a33e35;
  --app-danger-soft: #fbe7e4;
  --app-info: #315f7d;
  --app-info-soft: #e7f1f6;
  --app-radius-sm: 12px;
  --app-radius-md: 16px;
  --app-radius-lg: 22px;
  --app-radius-xl: 28px;
  --app-shadow-xs: 0 1px 2px rgba(2, 12, 69, .045);
  --app-shadow-sm: 0 1px 2px rgba(2, 12, 69, .035), 0 10px 26px rgba(2, 12, 69, .055);
  --app-shadow-md: 0 16px 42px rgba(2, 12, 69, .11);
  --app-shadow-lg: 0 28px 84px rgba(2, 12, 69, .28);
  --app-ease: cubic-bezier(.2, .8, .2, 1);
}

html {
  width: 100%;
  min-width: 320px;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  overflow-x: clip;
  background:
    radial-gradient(circle at 96% 0, rgba(244, 213, 74, .12), transparent 22rem),
    radial-gradient(circle at 4% 92%, rgba(42, 91, 65, .045), transparent 26rem),
    var(--app-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open,
body.chat-modal-open,
body.android-update-open {
  overflow: hidden;
  overscroll-behavior: none;
}

img,
svg,
video,
canvas { max-width: 100%; }

button,
a,
input,
select,
textarea { -webkit-tap-highlight-color: transparent; }

button {
  min-width: 0;
  border-radius: 12px;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 120ms ease;
}

button:active:not(:disabled) { transform: translateY(1px) scale(.985); }

button:disabled {
  filter: saturate(.55);
  cursor: not-allowed;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 50px;
  margin-top: 7px;
  padding: 13px 14px;
  font-size: 16px;
  line-height: 1.35;
  background: #ffffff;
  border-color: var(--app-line-strong);
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(2, 12, 69, .025);
}

input[type="date"] {
  min-height: 50px;
  height: 50px;
  max-height: 50px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover { background: #fff; }

input:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  background: #fff;
  border-color: #6b5410;
  outline: 3px solid rgba(244, 213, 74, .24);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .9);
}

label {
  margin-bottom: 17px;
  color: var(--app-ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .005em;
}

/* Access and authentication */

#login-view {
  overflow: hidden;
  isolation: isolate;
  padding:
    max(20px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 255, 255, .92), transparent 19rem),
    radial-gradient(circle at 95% 2%, rgba(244, 213, 74, .21), transparent 22rem),
    linear-gradient(160deg, #eef0f5, #f5f6fa 58%, #eef0f5);
}

#login-view::before {
  width: 240px;
  height: 240px;
  right: -116px;
  top: -124px;
  border: 52px solid rgba(244, 213, 74, .24);
  box-shadow: 0 22px 60px rgba(217, 185, 46, .09);
}

#login-view::after {
  content: "";
  position: fixed;
  z-index: -1;
  left: -94px;
  bottom: -118px;
  width: 240px;
  height: 240px;
  border: 42px solid rgba(31, 91, 62, .06);
  border-radius: 50%;
}

#login-view .card {
  width: min(100%, 430px);
  max-width: 430px;
  padding: 30px 22px 25px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(255, 255, 255, .96);
  border-radius: 28px;
  box-shadow:
    0 28px 72px rgba(2, 12, 69, .13),
    inset 0 0 0 1px rgba(2, 12, 69, .055);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.auth-logo-wrap { padding: 7px 0 25px; }
.auth-logo { width: min(246px, 78%); }
.tagline { margin-bottom: 25px; font-size: 13px; }

#login-view button[type="submit"] {
  min-height: 50px;
  color: #020c45;
  background: linear-gradient(135deg, var(--app-brand-bright), var(--app-brand));
  border: 1px solid #d9b92e;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(217, 185, 46, .2);
}

#login-view button[type="submit"]:hover {
  color: #fff;
  background: var(--app-ink);
  border-color: var(--app-ink);
}

/* Shared application shell */

.app-header {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 76px;
  padding:
    calc(10px + env(safe-area-inset-top, 0px))
    max(13px, env(safe-area-inset-right, 0px))
    10px
    max(13px, env(safe-area-inset-left, 0px));
  gap: 10px;
  background: rgba(245, 246, 250, .88);
  border-bottom: 1px solid rgba(2, 12, 69, .075);
  box-shadow: 0 9px 24px rgba(2, 12, 69, .065);
  backdrop-filter: blur(22px) saturate(155%);
  -webkit-backdrop-filter: blur(22px) saturate(155%);
}

.app-header-left {
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  gap: 3px;
}

.dashboard-wordmark {
  width: 118px;
  max-width: min(36vw, 132px);
}

.group-heading {
  width: auto;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 9px;
  color: var(--app-ink-soft);
  background: rgba(255, 255, 255, .72);
  border-color: rgba(2, 12, 69, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86);
  font-size: 12px;
  line-height: 16px;
}

.app-header-actions { flex: 0 0 auto; gap: 7px; }

.avatar-btn,
.header-notification-btn {
  width: 43px;
  height: 43px;
  color: var(--app-ink);
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(2, 12, 69, .1);
  border-radius: 14px;
  box-shadow:
    0 8px 18px rgba(2, 12, 69, .08),
    inset 0 1px 0 rgba(255, 255, 255, .94);
}

.avatar-btn:hover,
.header-notification-btn:hover,
.header-notification-btn.active {
  background: var(--app-brand);
  border-color: #d9b92e;
  box-shadow: 0 10px 22px rgba(217, 185, 46, .18);
}

.profile-menu {
  width: min(260px, calc(100vw - 24px));
  min-width: 210px;
  padding: 7px;
  border-color: rgba(2, 12, 69, .1);
  border-radius: 16px;
  box-shadow: 0 20px 52px rgba(2, 12, 69, .18);
}

.profile-menu-item {
  min-height: 46px;
  padding: 11px 12px;
  border-radius: 11px;
}

.profile-menu-item svg { color: var(--app-ink-soft); }
.profile-menu-item:hover { background: var(--app-brand-soft); }

/* Treasurer and administrator workspace */

.dashboard-shell {
  width: min(100%, 1480px);
  max-width: 1480px;
  padding:
    10px
    max(10px, env(safe-area-inset-right, 0px))
    calc(44px + env(safe-area-inset-bottom, 0px))
    max(10px, env(safe-area-inset-left, 0px));
  gap: 12px;
}

.sidebar {
  top: calc(var(--header-h, 76px) + 6px);
  margin-inline: 0;
  padding: 6px;
  gap: 5px;
  scroll-padding-inline: 6px;
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  background: rgba(255, 255, 255, .9);
  border-color: rgba(2, 12, 69, .09);
  border-radius: 17px;
  box-shadow: var(--app-shadow-sm);
}

.sidebar-item {
  scroll-snap-align: start;
  min-height: 44px;
  padding: 10px 12px;
  gap: 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 780;
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  color: currentColor;
}

.sidebar-item.active {
  color: #020c45;
  background: linear-gradient(135deg, var(--app-brand-bright), var(--app-brand));
  border-color: #d9b92e;
  box-shadow: 0 7px 15px rgba(217, 185, 46, .17);
}

.dashboard-main,
.borrower-content,
.tab-content,
.section-title-block,
.list-row-main,
.group-info { min-width: 0; }

.kpi-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}

.kpi-card,
.summary-card {
  isolation: isolate;
  min-height: 92px;
  padding: 15px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(245, 246, 250, .9));
  border-color: rgba(2, 12, 69, .085);
  border-radius: 18px;
  box-shadow: var(--app-shadow-sm);
}

.kpi-card::before,
.summary-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--app-brand-bright), var(--app-brand));
}

.kpi-card::after,
.summary-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 68px;
  height: 68px;
  right: -34px;
  top: -38px;
  border: 13px solid rgba(244, 213, 74, .09);
  border-radius: 50%;
}

.kpi-label,
.summary-label {
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: .075em;
}

.kpi-value,
.summary-value {
  max-width: 100%;
  margin-top: 7px;
  overflow: hidden;
  font-size: clamp(18px, 5.8vw, 25px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-main > .tab-content,
.borrower-content > .tab-content {
  padding: 0;
  background: transparent;
}

.section-header,
.borrower-page-head {
  isolation: isolate;
  align-items: flex-start;
  min-width: 0;
  margin-bottom: 15px;
  padding: 19px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 90% 14%, rgba(244, 213, 74, .15), transparent 10rem),
    linear-gradient(135deg, #020c45 0%, #020c45 70%, #020c45 100%);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 21px;
  box-shadow: 0 18px 38px rgba(2, 12, 69, .16);
}

.section-header::after,
.borrower-page-head::after {
  content: "" !important;
  position: absolute;
  z-index: -1;
  width: 164px;
  height: 164px;
  right: -76px;
  top: -92px;
  background: linear-gradient(145deg, var(--app-brand-bright), var(--app-brand));
  border: 12px solid rgba(255, 255, 255, .1);
  border-radius: 48% 52% 46% 54%;
  transform: rotate(14deg);
}

.section-header::before,
.borrower-page-head::before {
  content: "" !important;
  position: absolute;
  z-index: -1;
  width: 92px;
  height: 92px;
  right: 74px;
  bottom: -70px;
  border: 18px solid rgba(244, 213, 74, .1);
  border-radius: 50%;
}

.section-kicker,
.borrower-page-head .section-kicker {
  min-height: 24px;
  padding: 4px 9px;
  color: #020c45;
  background: var(--app-brand);
  border-color: rgba(255, 255, 255, .2);
  font-size: 12px;
  letter-spacing: .09em;
}

.section-title-block h2,
.section-header h2,
.borrower-page-head h2,
.borrower-page-head .greeting {
  max-width: 100%;
  margin-top: 8px;
  color: #fff;
  font-size: clamp(23px, 7.2vw, 33px);
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.section-title-block p,
.section-header p,
.borrower-page-head > p:last-child {
  position: relative;
  z-index: 1;
  max-width: 620px;
  color: rgba(255, 255, 255, .7);
  font-size: 12px;
  line-height: 1.55;
}

.borrower-page-head .h2-icon,
.section-header .h2-icon {
  color: #020c45;
  background: var(--app-brand);
  border-color: #d9b92e;
}

.section-header .add-btn,
.section-header > .add-btn,
.section-header > .small-btn {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 46px;
  justify-content: center;
  color: #020c45;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 13px;
  box-shadow: 0 10px 24px rgba(2, 12, 69, .18);
}

.section-header .add-btn:hover,
.section-header > .small-btn:hover {
  color: #020c45;
  background: var(--app-brand);
  border-color: var(--app-brand);
}

.add-btn,
.confirm-btn,
.panel-form button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 15px;
  color: #fff;
  background: var(--app-ink);
  border: 1px solid var(--app-ink);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(2, 12, 69, .12);
  font-size: 13px;
  font-weight: 820;
}

.add-btn svg,
.confirm-btn svg,
.small-btn svg,
.ghost-btn svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}

.add-btn:hover,
.confirm-btn:hover,
.panel-form button[type="submit"]:hover {
  color: #020c45;
  background: var(--app-brand);
  border-color: #d9b92e;
  box-shadow: 0 10px 22px rgba(217, 185, 46, .17);
}

.ghost-btn,
.small-btn,
.toggle-btn,
.account-text-link,
.filter-chip,
.notification-filter,
.secondary-btn,
.document-btn,
.disclosure-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--app-ink-soft);
  background: #fff;
  border: 1px solid var(--app-line-strong);
  border-radius: 11px;
  box-shadow: var(--app-shadow-xs);
  font-size: 12px;
  font-weight: 780;
}

.ghost-btn:hover,
.small-btn:hover,
.toggle-btn:hover,
.filter-chip:hover,
.notification-filter:hover,
.secondary-btn:hover,
.document-btn:hover,
.disclosure-btn:hover {
  color: var(--app-ink);
  background: var(--app-brand-soft);
  border-color: #f4d54a;
}

.tab-support-copy,
.subscription-notice,
.feedback {
  border-left: 4px solid var(--app-brand);
  border-radius: 4px 14px 14px 4px;
}

.subsection-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 23px 0 11px;
  color: var(--app-ink);
  font-size: 13px;
  letter-spacing: .075em;
}

.subsection-heading::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: var(--app-brand);
  border: 2px solid #fdf7da;
  border-radius: 3px;
  box-shadow: 0 0 0 1px #f4d54a;
}

.list-row,
.group-row,
.loan-summary-card,
.history-card,
.contribution-record-list,
.borrower-loan-group,
.activity-row,
.cash-count-card,
.notification-list-item,
.reason-card,
.trust-card,
.document-action-card,
.loan-disclosure-preview,
.support-queue-section,
.release-panel {
  border-color: rgba(2, 12, 69, .085);
  border-radius: 18px;
  box-shadow: var(--app-shadow-sm);
}

.list-row,
.group-row,
.loan-summary-card,
.history-card {
  padding: 15px;
}

.list-row:hover,
.group-row:hover,
.loan-summary-card:hover,
.history-card:hover,
.trust-card:hover,
.document-action-card:hover {
  border-color: #bec2d7;
  box-shadow: 0 2px 3px rgba(2, 12, 69, .04), 0 14px 31px rgba(2, 12, 69, .075);
}

.row-title,
.history-title,
.group-name { overflow-wrap: anywhere; }

.row-actions,
.contribution-record-actions,
.borrower-loan-actions,
.receipt-action-row {
  width: 100%;
  gap: 8px;
}

.row-actions > button,
.borrower-loan-actions > button { flex: 1 1 128px; }

.badge,
.consent-status,
.subscription-preview-badge,
.account-access-pill {
  min-height: 24px;
  padding: 4px 9px;
  line-height: 15px;
}

.empty-state,
.loan-directory-empty,
.payment-history-empty,
.treasurer-access-empty,
.release-empty {
  min-width: 0;
  padding: 27px 20px;
  background:
    radial-gradient(circle at 92% 5%, rgba(244, 213, 74, .1), transparent 8rem),
    rgba(255, 255, 255, .72);
  border: 1px dashed var(--app-line-strong);
  border-radius: 20px;
}

/* Financial directories and records */

.loan-directory-toolbar {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--app-line);
  border-radius: 18px;
  box-shadow: var(--app-shadow-xs);
}

.loan-directory-search { grid-column: auto; }

.borrower-loan-toggle {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 86px;
  padding: 14px;
  background: linear-gradient(145deg, #fff, #ffffff);
}

.borrower-loan-balance {
  grid-column: 2 / 3;
  min-width: 0;
  text-align: left;
}

.borrower-loan-chevron {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.borrower-loan-items { padding: 9px; }
.borrower-loan-item { padding: 13px; }

.borrower-loan-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.borrower-loan-metrics > span {
  min-width: 0;
  padding: 10px;
  background: #f5f6fa;
}

.borrower-loan-metrics strong {
  overflow-wrap: anywhere;
  white-space: normal;
}

.contribution-record {
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
}

.contribution-record-main { flex: 1 1 auto; }

.contribution-record-actions {
  width: auto;
  flex: 0 1 auto;
  align-items: flex-end;
  flex-direction: column;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

table { width: 100%; }

/* The base application converts financial schedules into labeled record cards
   on phones. Cancel v2's desktop min-width so those cards fit the viewport. */
@media (max-width: 639px) {
  .table-wrap:has(table.schedule),
  .table-wrap:has(.dist-table) {
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  table.schedule,
  .dist-table,
  .loan-ledger-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  table.schedule tr,
  .dist-table tr {
    padding: 5px 13px;
    border-radius: 15px;
    box-shadow: var(--app-shadow-xs);
  }

  table.schedule td,
  .dist-table td {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .ledger-cell-group { max-width: 66%; }
  .ledger-cell-group > span { min-width: 64px; }
}

/* Borrower experience */

.borrower-content {
  width: min(100%, 920px);
  max-width: 920px;
  padding:
    11px
    max(10px, env(safe-area-inset-right, 0px))
    calc(126px + env(safe-area-inset-bottom, 0px))
    max(10px, env(safe-area-inset-left, 0px));
}

.borrower-page-head { margin: 0 0 14px; }

.summary-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 16px;
}

.summary-card { min-height: 114px; }

.summary-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.summary-icon svg { width: 17px; height: 17px; }

.standing-hero {
  min-height: 172px;
  padding: 22px;
  background:
    radial-gradient(circle at 88% 8%, rgba(244, 213, 74, .16), transparent 11rem),
    linear-gradient(145deg, #fff, #f5f6fa);
  border-color: rgba(2, 12, 69, .085);
  border-radius: 22px;
  box-shadow: var(--app-shadow-sm);
}

.standing-hero::after {
  width: 190px;
  height: 190px;
  right: -78px;
  top: -96px;
  background: var(--app-brand);
  opacity: .24;
}

.standing-value { font-size: clamp(28px, 9vw, 38px); }

.dock {
  left: max(8px, env(safe-area-inset-left, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: calc(8px + var(--standalone-bottom-shift, 0px));
  min-height: 72px;
  padding:
    7px
    4px
    max(7px, env(safe-area-inset-bottom, 0px))
    4px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(2, 12, 69, .1);
  border-radius: 21px;
  box-shadow: 0 22px 46px rgba(2, 12, 69, .2);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.dock-item {
  min-width: 0;
  min-height: 50px;
  padding: 6px 2px;
  gap: 3px;
  overflow: hidden;
  border-radius: 12px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-item svg { width: 21px; height: 21px; }

.dock-item.active {
  color: var(--app-ink);
  background: var(--app-brand-soft);
}

.dock-center {
  align-self: flex-start;
  margin-top: -14px;
  gap: 3px;
}

.dock-center-btn {
  width: 50px;
  height: 50px;
  color: var(--app-ink);
  background: var(--app-brand);
  border: 4px solid rgba(255, 255, 255, .94);
  border-radius: 50%;
  box-shadow: 0 10px 22px rgba(217, 185, 46, .28);
}

.dock-center-btn.active {
  background: var(--app-brand);
  box-shadow: 0 10px 24px rgba(217, 185, 46, .32);
}

.dock-center span { font-size: 12px; }

.fab-chat {
  right: max(17px, env(safe-area-inset-right, 0px));
  bottom: calc(101px + env(safe-area-inset-bottom, 0px) + var(--standalone-bottom-shift, 0px));
  width: 52px;
  height: 52px;
  color: #020c45;
  background: var(--app-brand);
  border: 1px solid #d9b92e;
  box-shadow: 0 14px 30px rgba(217, 185, 46, .27);
}

.notif-panel {
  left: max(10px, env(safe-area-inset-left, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: calc(91px + env(safe-area-inset-bottom, 0px) + var(--standalone-bottom-shift, 0px));
  width: auto;
  max-height: min(62dvh, 560px);
  border-radius: 20px;
}

/* Dialogs, sheets, and forms */

.modal-overlay {
  align-items: flex-end;
  justify-content: center;
  padding:
    max(8px, env(safe-area-inset-top, 0px))
    0
    0;
  overflow: hidden;
  background: rgba(2, 12, 69, .62);
  overscroll-behavior: contain;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal {
  width: 100%;
  max-width: none;
  max-height: calc(100vh - max(8px, env(safe-area-inset-top, 0px)));
  max-height: calc(100dvh - max(8px, env(safe-area-inset-top, 0px)));
  padding:
    20px
    max(18px, env(safe-area-inset-right, 0px))
    max(22px, env(safe-area-inset-bottom, 0px))
    max(18px, env(safe-area-inset-left, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .7);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -22px 64px rgba(2, 12, 69, .3);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal.modal-wide { width: 100%; }

.modal-header {
  position: sticky;
  top: -20px;
  z-index: 5;
  min-width: 0;
  margin: -2px 0 17px;
  padding: 2px 0 14px;
  background: linear-gradient(#fff 82%, rgba(255, 255, 255, .92));
  border-bottom-color: var(--app-line);
}

.modal-header > *:first-child,
.modal-header h2 { min-width: 0; }

.modal-header h2 {
  max-width: calc(100vw - 98px);
  font-size: clamp(19px, 6vw, 23px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.modal-close-btn {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--app-ink-soft);
  background: var(--app-surface-muted);
  border: 1px solid var(--app-line);
  border-radius: 13px;
  font-size: 24px;
}

.modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  margin-top: 20px;
}

.modal-actions > * {
  width: 100%;
  min-height: 47px;
  margin: 0;
}

.modal-actions button:not(.secondary-btn):not(.ghost-btn):not(.small-btn) {
  color: #fff;
  background: var(--app-ink);
  border: 1px solid var(--app-ink);
  font-weight: 820;
}

form.panel-form {
  min-width: 0;
  padding: 0;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.field-row > label { min-width: 0; }

.radio-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 6px;
  gap: 6px;
  background: var(--app-surface-muted);
  border-radius: 15px;
}

.radio-option,
.checkbox-option {
  min-width: 0;
  min-height: 45px;
  padding: 10px 12px;
  margin: 0;
  border-radius: 12px;
}

.radio-option input,
.checkbox-option input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.chat-modal-overlay .chat-modal {
  background: #fff;
}

.chat-thread {
  min-height: 0;
  background: #f5f6fa;
  border: 1px solid var(--app-line);
  border-radius: 17px;
  padding: 13px;
}

.chat-input-row {
  bottom: 0;
  margin-top: 10px;
  padding: 9px 0 max(2px, env(safe-area-inset-bottom, 0px));
  background: #fff;
}

.chat-input-row input {
  min-height: 48px;
  background: var(--app-surface-subtle);
}

.chat-send-btn {
  flex-basis: 48px !important;
  width: 48px !important;
  height: 48px !important;
  background: var(--app-brand) !important;
  border: 1px solid #d9b92e;
  box-shadow: 0 8px 18px rgba(217, 185, 46, .18);
}

/* Account, subscription, compliance, and support */

.account-center-overlay {
  align-items: flex-end;
  padding: max(8px, env(safe-area-inset-top, 0px)) 0 0;
}

.account-center-modal {
  width: 100%;
  max-width: none;
  max-height: calc(100dvh - max(8px, env(safe-area-inset-top, 0px)));
  background:
    radial-gradient(circle at 96% 2%, rgba(244, 213, 74, .15), transparent 20rem),
    #f5f6fa;
  border-radius: 25px 25px 0 0;
}

.account-center-topbar {
  min-height: 64px;
  padding: 13px 16px;
}

#account-center-content {
  padding: 14px 14px max(23px, env(safe-area-inset-bottom, 0px));
}

.account-profile-hero {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  min-height: 138px;
  padding: 19px;
  background:
    radial-gradient(circle at 90% 8%, rgba(244, 213, 74, .13), transparent 10rem),
    linear-gradient(135deg, #020c45, #020c45);
  border-radius: 21px;
  box-shadow: 0 18px 38px rgba(2, 12, 69, .17);
}

.account-profile-hero::before {
  width: 190px;
  height: 190px;
  right: -76px;
  top: -112px;
  background: var(--app-brand);
  opacity: 1;
}

.account-profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 20px;
}

.account-profile-copy h2 { font-size: 22px; }

.account-access-pill {
  grid-column: 2;
  justify-self: start;
}

.account-center-grid { grid-template-columns: minmax(0, 1fr); }
.account-profile-panel { order: 2; }
.subscription-panel { order: 1; }

.account-panel {
  padding: 18px;
  border-radius: 20px;
  box-shadow: var(--app-shadow-sm);
}

.subscription-plan-grid { grid-template-columns: minmax(0, 1fr); }

.subscription-plan-card {
  min-height: 136px;
  border-radius: 17px;
}

.trust-grid,
.support-queue-grid,
.trust-history-grid,
.disclosure-metrics {
  grid-template-columns: minmax(0, 1fr);
  gap: 11px;
}

.trust-card,
.document-action-card,
.loan-disclosure-preview,
.support-queue-section { padding: 17px; }

.trust-actions,
.document-actions,
.receipt-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.trust-actions button,
.document-actions button,
.receipt-action-row button { width: 100%; }

.case-history-row,
.compliance-queue-head,
.account-panel-heading,
.subscription-status-row,
.subscription-methods {
  align-items: flex-start;
  flex-direction: column;
}

.release-hero,
.release-panel { min-width: 0; }

.release-panel-heading {
  align-items: flex-start;
  flex-direction: column;
}

.release-field-grid,
.release-type-picker { grid-template-columns: minmax(0, 1fr); }

.release-file-drop strong {
  max-width: min(260px, calc(100vw - 128px));
}

.push-diagnostics-grid { grid-template-columns: minmax(0, 1fr); }

.push-diagnostics-timeline > div {
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
}

.push-diagnostics-timeline strong {
  max-width: 100%;
  text-align: left;
}

/* Phone refinements */

@media (max-width: 479px) {
  .section-header,
  .borrower-page-head { flex-direction: column; }

  .quicklink-grid { grid-template-columns: minmax(0, 1fr); }

  .quicklink-card {
    min-height: 52px;
    padding: 13px 14px;
    border-radius: 15px;
  }

  .loan-summary-top,
  .loan-summary-row,
  .history-top {
    align-items: flex-start;
    gap: 6px;
  }

  .loan-summary-row { flex-wrap: wrap; }

  .history-date {
    max-width: 46%;
    text-align: right;
    white-space: normal;
  }

  .case-history-row { align-items: flex-start; }

  .payment-history-empty {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
  }

  .account-profile-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-profile-actions .add-btn,
  .account-profile-actions .account-text-link { width: 100%; }
}

@media (max-width: 359px) {
  .app-header { padding-inline: 10px; }
  .dashboard-wordmark { width: 108px; }
  .app-header-actions { gap: 5px; }
  .avatar-btn,
  .header-notification-btn { width: 40px; height: 40px; }
  .dashboard-shell,
  .borrower-content { padding-inline: 8px; }
  .kpi-card,
  .summary-card { padding: 13px; }
  .kpi-value,
  .summary-value { font-size: 17px; }
  .borrower-loan-metrics,
  .borrower-loan-actions { grid-template-columns: minmax(0, 1fr); }
  .dock { left: 4px; right: 4px; }
  .dock-item { font-size: 12px; }
}

@media (max-height: 700px) {
  #login-view { align-items: flex-start; overflow-y: auto; }
  #login-view .card { margin-block: auto; }
}

/* Tablet progression */

@media (min-width: 480px) {
  #login-view .card { padding: 36px 32px 31px; }

  .app-header-left {
    flex-direction: row;
    align-items: center;
    gap: 11px;
  }

  .dashboard-wordmark { width: 130px; }
  .group-heading { max-width: min(48vw, 360px); font-size: 12px; }

  .dashboard-shell { padding: 15px; gap: 15px; }
  .borrower-content { padding-inline: 15px; }

  .section-header,
  .borrower-page-head { padding: 22px; }

  .section-header .add-btn,
  .section-header > .add-btn,
  .section-header > .small-btn { width: auto; }

  .modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .modal-actions > * { width: auto; flex: 1 1 140px; }

  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .radio-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .loan-directory-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loan-directory-search { grid-column: 1 / -1; }

  .trust-grid,
  .disclosure-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .trust-actions,
  .document-actions,
  .receipt-action-row {
    display: flex;
    flex-wrap: wrap;
  }

  .trust-actions button,
  .document-actions button,
  .receipt-action-row button { width: auto; }

  .case-history-row,
  .compliance-queue-head,
  .account-panel-heading,
  .subscription-status-row,
  .subscription-methods {
    align-items: center;
    flex-direction: row;
  }

  .release-panel-heading { flex-direction: row; }
  .push-diagnostics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .push-diagnostics-timeline > div {
    align-items: center;
    flex-direction: row;
    gap: 14px;
  }

  .push-diagnostics-timeline strong {
    max-width: 58%;
    text-align: right;
  }
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding:
      max(18px, env(safe-area-inset-top, 0px))
      max(18px, env(safe-area-inset-right, 0px))
      max(18px, env(safe-area-inset-bottom, 0px))
      max(18px, env(safe-area-inset-left, 0px));
  }

  .modal {
    width: min(100%, 620px);
    max-width: 620px;
    max-height: min(90dvh, 900px);
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 24px;
    box-shadow: var(--app-shadow-lg);
  }

  .modal.modal-wide { width: min(100%, 960px); max-width: 960px; }
  .modal-header { top: -25px; }

  table { min-width: 720px; }
  table.loan-ledger-table { min-width: 0; }

  .contribution-record {
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
  }

  .contribution-record-actions {
    width: auto;
    align-items: center;
    flex-direction: row;
  }

  .row-actions { width: auto; }
  .row-actions > button { flex: 0 1 auto; }

  .borrower-loan-toggle {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 13px;
    padding: 15px 17px;
  }

  .borrower-loan-balance {
    grid-column: auto;
    min-width: 132px;
    text-align: right;
  }

  .borrower-loan-chevron {
    grid-column: auto;
    grid-row: auto;
  }

  .borrower-loan-metrics { grid-template-columns: repeat(3, minmax(110px, 1fr)); }

  .account-center-overlay {
    align-items: center;
    padding:
      max(14px, env(safe-area-inset-top, 0px))
      max(14px, env(safe-area-inset-right, 0px))
      max(14px, env(safe-area-inset-bottom, 0px))
      max(14px, env(safe-area-inset-left, 0px));
  }

  .account-center-modal {
    width: min(100%, 1000px);
    max-width: 1000px;
    max-height: min(92dvh, 940px);
    border-radius: 28px;
  }

  #account-center-content { padding: 22px; }
  .account-profile-hero { grid-template-columns: auto minmax(0, 1fr) auto; padding: 24px; }
  .account-access-pill { grid-column: auto; justify-self: auto; }
  .subscription-plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .release-field-grid,
  .release-type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .release-type-picker legend { grid-column: 1 / -1; }
}

@media (min-width: 760px) {
  .app-header {
    min-height: 76px;
    padding:
      calc(13px + env(safe-area-inset-top, 0px))
      max(24px, env(safe-area-inset-right, 0px))
      13px
      max(24px, env(safe-area-inset-left, 0px));
  }

  .dashboard-wordmark { width: 140px; }
  .group-heading { min-height: 28px; padding: 5px 11px; font-size: 12px; }
  .dashboard-shell { padding: 21px 24px 50px; }
  .borrower-content { padding: 21px 24px 126px; }

  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
  .kpi-card,
  .summary-card { padding: 17px; }

  .section-header,
  .borrower-page-head { padding: 26px 28px; border-radius: 24px; }

  .trust-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .support-queue-grid,
  .trust-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .disclosure-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .account-center-grid {
    grid-template-columns: minmax(270px, .78fr) minmax(390px, 1.22fr);
    gap: 18px;
  }

  .account-profile-panel { order: 1; }
  .subscription-panel { order: 2; }
}

/* Desktop workspace */

@media (min-width: 960px) {
  .dashboard-shell {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 24px;
    padding-top: 24px;
  }

  .sidebar {
    top: calc(var(--header-h, 76px) + 20px);
    width: 230px;
    max-height: calc(100dvh - var(--header-h, 76px) - 40px);
    padding: 10px;
    gap: 4px;
    border-radius: 21px;
    scroll-snap-type: none;
  }

  .sidebar-item {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    font-size: 13px;
  }

  .kpi-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi-card { min-height: 102px; }
  .kpi-value { font-size: clamp(18px, 1.7vw, 25px); }

  .section-header {
    align-items: flex-end;
    padding: 28px 30px;
  }

  .loan-directory-toolbar {
    grid-template-columns: minmax(360px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr);
    align-items: end;
  }

  .loan-directory-search { grid-column: auto; }
  .borrower-loan-metrics { grid-template-columns: repeat(5, minmax(110px, 1fr)); }

  .dock {
    left: 50%;
    right: auto;
    width: min(680px, calc(100vw - 34px));
    transform: translateX(-50%);
  }
}

@media (min-width: 1240px) {
  .dashboard-shell { grid-template-columns: 246px minmax(0, 1fr); gap: 30px; }
  .sidebar { width: 246px; }
}

/* ========================================================================
   TINUBUAN PRODUCT UI v4
   Treasurer overview, compact mobile navigation, resilient icon sizing,
   and review-first document previews.
   ======================================================================== */

/* Treasurer overview */

.overview-header { margin-bottom: 14px; }

#tab-overview .kpi-row { margin-bottom: 14px; }

.overview-shortcuts {
  margin-top: 16px;
  padding: 17px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(2, 12, 69, .085);
  border-radius: 20px;
  box-shadow: var(--app-shadow-sm);
}

.overview-shortcuts-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.overview-shortcuts-heading h3 {
  margin: 8px 0 0;
  color: var(--app-ink);
  font-size: 18px;
  line-height: 1.2;
}

.overview-shortcuts-heading > p {
  max-width: 320px;
  margin: 0;
  color: var(--app-muted);
  font-size: 12px;
  text-align: right;
}

.overview-shortcut-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}

.overview-shortcut {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 66px;
  padding: 11px 12px;
  color: var(--app-ink);
  background: #fff;
  border: 1px solid var(--app-line);
  border-radius: 15px;
  box-shadow: var(--app-shadow-xs);
  text-align: left;
}

.overview-shortcut:hover {
  background: #ffffff;
  border-color: #f4d54a;
  box-shadow: var(--app-shadow-sm);
}

.overview-shortcut.is-locked { opacity: .48; }

.overview-shortcut-icon,
.treasurer-more-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  color: var(--app-brand-ink);
  background: var(--app-brand-soft);
  border: 1px solid #f7e48f;
  border-radius: 12px;
}

.overview-shortcut-icon svg,
.treasurer-more-icon svg {
  width: 19px;
  height: 19px;
}

.overview-shortcut > span:nth-child(2),
.treasurer-more-item > span:nth-child(2) { min-width: 0; }

.overview-shortcut strong,
.overview-shortcut small,
.treasurer-more-item strong,
.treasurer-more-item small { display: block; }

.overview-shortcut strong,
.treasurer-more-item strong {
  font-size: 13px;
  line-height: 1.2;
}

.overview-shortcut small,
.treasurer-more-item small {
  margin-top: 3px;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.3;
}

.overview-shortcut-arrow {
  width: 18px;
  height: 18px;
  color: var(--app-muted);
}

/* Member directory */

.member-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
}

.member-section-heading .subsection-heading { margin: 0; }

.member-section-heading p {
  max-width: 520px;
  margin: 0;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.member-list-row { align-items: flex-start; }

.member-row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 8px;
}

.member-row-actions > button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding-inline: 9px;
  white-space: normal;
  line-height: 1.2;
}

/* Screenshot repairs: every decorative icon receives an explicit box. */

.tab-locked-modal { text-align: left; }

.access-modal-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tab-locked-symbol {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 4px 0 18px;
  color: var(--app-brand-ink);
  background: var(--app-brand-soft);
  border: 1px solid #f7e48f;
  border-radius: 21px;
}

.tab-locked-symbol svg {
  width: 34px;
  height: 34px;
}

.treasurer-access-empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  color: var(--app-brand-ink);
  background: var(--app-brand-soft);
  border-radius: 15px;
}

.treasurer-access-empty-icon svg { width: 23px; height: 23px; }

.interest-notifications-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.interest-notification-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--app-line);
  border-radius: 17px;
  box-shadow: var(--app-shadow-sm);
}

.interest-notification-item.is-unread {
  background: linear-gradient(135deg, #f5f6fa, #fff);
  border-color: #f4d54a;
}

.interest-notification-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--app-brand-ink);
  background: var(--app-brand-soft);
  border: 1px solid #f7e48f;
  border-radius: 14px;
}

.interest-notification-icon svg { width: 23px; height: 23px; }

.interest-notification-body,
.interest-notification-title-row,
.interest-notification-amount { min-width: 0; }

.interest-notification-body,
.interest-notification-amount {
  display: flex;
  flex-direction: column;
}

.interest-notification-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}

.interest-notification-name {
  color: var(--app-ink);
  font-size: 13px;
  font-weight: 820;
  overflow-wrap: anywhere;
}

.notification-state {
  padding: 3px 7px;
  color: var(--app-positive);
  background: var(--app-positive-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.interest-notification-body > strong { font-size: 12px; }

.interest-notification-body small,
.interest-notification-amount small,
.interest-notification-amount > span {
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.45;
}

.interest-notification-amount {
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.interest-notification-amount > strong {
  color: var(--app-ink);
  font-size: 15px;
}

.notification-read-toggle {
  min-height: 34px;
  margin-top: 5px;
  padding: 6px 9px;
  color: var(--app-ink-soft);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line-strong);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 780;
}

.interest-notification-empty {
  padding: 24px;
  color: var(--app-muted);
  background: rgba(255, 255, 255, .76);
  border: 1px dashed var(--app-line-strong);
  border-radius: 17px;
}

.interest-notification-empty strong { color: var(--app-ink); }
.interest-notification-empty p { margin: 5px 0 0; }

/* Forms and account center */

.panel-form > button[type="submit"] {
  min-height: 48px;
  padding-inline: 18px;
}

.account-center-modal {
  overflow-x: hidden;
  overflow-y: auto;
}

.account-center-topbar {
  top: 0;
  flex: 0 0 auto;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 7px 20px rgba(2, 12, 69, .08);
}

.account-center-brand img { max-width: 122px; }

.subscription-notice-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--app-brand-ink);
  background: #f7e48f;
  border-radius: 10px;
}

.subscription-notice-icon svg { width: 18px; height: 18px; }

/* Treasurer mobile navigation */

.treasurer-page .sidebar { display: none; }

.treasurer-page .dashboard-shell {
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
}

.treasurer-mobile-nav {
  position: fixed;
  z-index: 86;
  left: max(8px, env(safe-area-inset-left, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: 70px;
  padding: 7px 4px max(7px, env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(2, 12, 69, .1);
  border-radius: 21px;
  box-shadow: 0 20px 46px rgba(2, 12, 69, .2);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.treasurer-mobile-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-width: 0;
  min-height: 52px;
  padding: 5px 2px;
  gap: 3px;
  color: var(--app-muted);
  background: transparent;
  border: 0;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 780;
  line-height: 1;
}

.treasurer-mobile-item svg { width: 20px; height: 20px; }

.treasurer-mobile-item.active {
  color: var(--app-ink);
  background: var(--app-brand-soft);
}

.treasurer-mobile-item.active::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 17px;
  height: 3px;
  background: var(--app-brand);
  border-radius: 999px;
}

.treasurer-mobile-item.is-locked { opacity: .42; }

.treasurer-page .fab-chat {
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.treasurer-more-sheet { padding-bottom: max(22px, env(safe-area-inset-bottom, 0px)); }

.treasurer-more-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.treasurer-more-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 60px;
  padding: 10px 11px;
  color: var(--app-ink);
  background: #fff;
  border: 1px solid var(--app-line);
  border-radius: 14px;
  text-align: left;
}

.treasurer-more-item.active,
.treasurer-more-item:hover {
  background: #f5f6fa;
  border-color: #f4d54a;
}

.treasurer-more-item.is-locked { opacity: .45; }

/* Treasurer message list remains full-height on phones for keyboard safety,
   but its conversation surface keeps a clear, compact hierarchy. */

.treasurer-page .chat-modal .modal-header { background: #fff; }

.treasurer-page .chat-convo-row {
  min-height: 76px;
  margin-bottom: 9px;
  padding: 13px;
  border-radius: 16px;
  box-shadow: var(--app-shadow-xs);
}

.treasurer-page .chat-convo-avatar {
  width: 42px;
  height: 42px;
  background: var(--app-ink);
}

/* Review-first statement, disclosure, and receipt viewer */

.document-viewer-overlay {
  align-items: stretch;
  padding: 0;
}

.document-viewer-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: 100dvh;
  padding: 0;
  overflow: hidden;
  background: #eef0f5;
  border: 0;
  border-radius: 0;
}

.document-viewer-header {
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding:
    calc(14px + env(safe-area-inset-top, 0px))
    max(15px, env(safe-area-inset-right, 0px))
    13px
    max(15px, env(safe-area-inset-left, 0px));
  background: #fff;
  border-bottom: 1px solid var(--app-line);
  box-shadow: 0 8px 22px rgba(2, 12, 69, .07);
}

.document-viewer-heading { min-width: 0; }

.document-viewer-heading h2 {
  margin: 7px 0 2px;
  color: var(--app-ink);
  font-size: clamp(19px, 5.8vw, 25px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.document-viewer-heading p {
  margin: 0;
  color: var(--app-muted);
  font-size: 12px;
}

.document-viewer-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.tinubuan-document-sheet {
  width: min(100%, 760px);
  min-height: 100%;
  margin: 0 auto;
  padding: 22px 18px;
  color: #020c45;
  background: #fff;
  border: 1px solid #d4d7e5;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(2, 12, 69, .12);
  font: 12px/1.5 Arial, sans-serif;
}

.tinubuan-document-sheet .doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid #020c45;
}

.tinubuan-document-sheet .doc-head img { width: 122px; height: auto; }

.tinubuan-document-sheet .doc-meta {
  color: #5b6180;
  font-size: 12px;
  text-align: right;
}

.tinubuan-document-sheet .doc-meta strong {
  display: block;
  color: #020c45;
  font-size: 12px;
}

.tinubuan-document-sheet > h1 {
  margin: 21px 0 4px;
  color: #020c45;
  font-size: clamp(21px, 7vw, 29px);
  line-height: 1.12;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}

.tinubuan-document-sheet .subtitle { margin: 0; color: #5b6180; }

.tinubuan-document-sheet .reference {
  display: inline-block;
  margin-top: 11px;
  padding: 4px 8px;
  color: #6b5410;
  background: #fdf7da;
  border: 1px solid #f7e48f;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tinubuan-document-sheet .doc-body { margin-top: 20px; }

.tinubuan-document-sheet .doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.tinubuan-document-sheet .doc-field {
  padding: 11px;
  background: #f5f6fa;
  border: 1px solid #e6e8f0;
  border-radius: 10px;
}

.tinubuan-document-sheet .doc-field span {
  display: block;
  color: #5b6180;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tinubuan-document-sheet .doc-field strong {
  display: block;
  margin-top: 3px;
  color: #020c45;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tinubuan-document-sheet table {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 14px;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.tinubuan-document-sheet th,
.tinubuan-document-sheet td {
  padding: 8px;
  border-bottom: 1px solid #e6e8f0;
  text-align: left;
  vertical-align: top;
}

.tinubuan-document-sheet th {
  color: #5b6180;
  background: #f5f6fa;
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.tinubuan-document-sheet .doc-note {
  margin-top: 14px;
  padding: 11px;
  color: #6b5410;
  background: #fdf7da;
  border-left: 4px solid #f4d54a;
  font-size: 12px;
}

.tinubuan-document-sheet .doc-signatures {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
  margin-top: 42px;
}

.tinubuan-document-sheet .signature {
  padding-top: 7px;
  color: #5b6180;
  border-top: 1px solid #020c45;
  font-size: 12px;
}

.tinubuan-document-sheet .doc-footer {
  margin-top: 28px;
  padding-top: 13px;
  color: #5b6180;
  border-top: 1px solid #e6e8f0;
  font-size: 12px;
}

.document-viewer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: column;
  gap: 9px;
  padding:
    11px
    max(14px, env(safe-area-inset-right, 0px))
    max(11px, env(safe-area-inset-bottom, 0px))
    max(14px, env(safe-area-inset-left, 0px));
  background: #fff;
  border-top: 1px solid var(--app-line);
  box-shadow: 0 -8px 22px rgba(2, 12, 69, .07);
}

.document-viewer-actions > p {
  margin: 0;
  color: var(--app-muted);
  font-size: 12px;
  text-align: center;
}

.document-viewer-actions > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: 100%;
  gap: 8px;
}

.document-viewer-actions button { min-height: 46px; }

.document-save-btn {
  padding: 10px 15px;
  color: #fff;
  background: var(--app-ink);
  border: 1px solid var(--app-ink);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 820;
}

@media (max-width: 479px) {
  .overview-shortcuts-heading,
  .member-section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .overview-shortcuts-heading > p,
  .member-section-heading p { text-align: left; }

  .panel-form > button[type="submit"] { width: 100%; }

  .interest-notification-item {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
  }

  .interest-notification-amount {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid var(--app-line);
    text-align: left;
  }

  .interest-notification-amount small,
  .interest-notification-amount > strong,
  .interest-notification-amount > span { grid-column: 1; }

  .interest-notification-amount .notification-read-toggle {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin: 0;
  }

  .account-center-brand span { display: none; }
  .account-center-brand img { width: 108px; }
}

@media (max-width: 359px) {
  .member-row-actions { grid-template-columns: minmax(0, 1fr); }
  .treasurer-mobile-item { font-size: 12px; }
  .document-viewer-actions > div { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 480px) {
  .overview-shortcut-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .overview-shortcut {
    grid-template-columns: auto minmax(0, 1fr);
    align-content: start;
  }

  .overview-shortcut-arrow { display: none; }
  .tinubuan-document-sheet { padding: 30px; }
  .tinubuan-document-sheet .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tinubuan-document-sheet .doc-signatures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 640px) {
  .member-list-row {
    display: flex;
    align-items: center;
  }

  .member-row-actions {
    display: flex;
    width: auto;
    justify-content: flex-end;
  }

  .member-row-actions > button { width: auto; }

  .treasurer-more-sheet { width: min(100%, 680px); max-width: 680px; }
  .treasurer-more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .document-viewer-overlay {
    align-items: center;
    padding:
      max(18px, env(safe-area-inset-top, 0px))
      max(18px, env(safe-area-inset-right, 0px))
      max(18px, env(safe-area-inset-bottom, 0px))
      max(18px, env(safe-area-inset-left, 0px));
  }

  .document-viewer-modal {
    width: min(100%, 1020px);
    height: min(92dvh, 940px);
    max-width: 1020px;
    max-height: min(92dvh, 940px);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 25px;
  }

  .document-viewer-header { padding: 17px 20px; }
  .document-viewer-scroll { padding: 22px; }
  .tinubuan-document-sheet { padding: 38px; border-radius: 8px; }

  .document-viewer-actions {
    flex-direction: row;
    padding: 13px 18px;
  }

  .document-viewer-actions > p { max-width: 430px; text-align: left; }
  .document-viewer-actions > div { display: flex; width: auto; }
}

@media (min-width: 960px) {
  .treasurer-page .sidebar { display: flex; }

  .treasurer-page .dashboard-shell {
    grid-template-columns: 230px minmax(0, 1fr);
    padding-bottom: 50px;
  }

  .treasurer-mobile-nav { display: none; }
  .treasurer-page .fab-chat { bottom: 24px; }
}

/* Centered modal contract
 *
 * Every dialog uses the same center/center placement at every viewport size.
 * Tall forms, account content, conversations, and documents scroll inside
 * their card so the dialog never drops behind mobile browser controls.
 */

.modal-overlay,
.account-center-overlay,
.document-viewer-overlay {
  align-items: center;
  justify-content: center;
  padding:
    max(12px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
}

.modal {
  width: min(100%, 620px);
  max-width: 620px;
  max-height: calc(
    100vh
    - max(12px, env(safe-area-inset-top, 0px))
    - max(12px, env(safe-area-inset-bottom, 0px))
  );
  max-height: calc(
    100dvh
    - max(12px, env(safe-area-inset-top, 0px))
    - max(12px, env(safe-area-inset-bottom, 0px))
  );
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 24px;
  box-shadow: 0 24px 72px rgba(2, 12, 69, .3);
}

.modal.modal-wide {
  width: min(100%, 960px);
  max-width: 960px;
}

.treasurer-more-sheet {
  width: min(100%, 680px);
  max-width: 680px;
}

.account-center-modal {
  width: min(100%, 1000px);
  max-width: 1000px;
  max-height: calc(
    100dvh
    - max(12px, env(safe-area-inset-top, 0px))
    - max(12px, env(safe-area-inset-bottom, 0px))
  );
  padding: 0;
  border-radius: 28px;
}

.account-center-topbar { border-radius: 28px 28px 0 0; }

.document-viewer-modal {
  width: min(100%, 1020px);
  height: min(92dvh, 940px);
  max-width: 1020px;
  max-height: calc(
    100dvh
    - max(12px, env(safe-area-inset-top, 0px))
    - max(12px, env(safe-area-inset-bottom, 0px))
  );
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 25px;
  box-shadow: 0 24px 72px rgba(2, 12, 69, .3);
}

.document-viewer-header {
  padding: 15px max(15px, env(safe-area-inset-right, 0px)) 13px
    max(15px, env(safe-area-inset-left, 0px));
}

@media (max-width: 639px) {
  .modal-overlay.chat-modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 8px;
  }

  .chat-modal-overlay .chat-modal {
    width: min(100%, 620px);
    height: calc(100% - 16px);
    max-width: 620px;
    max-height: min(calc(100% - 16px), 760px);
    padding:
      16px
      max(16px, env(safe-area-inset-right, 0px))
      max(10px, env(safe-area-inset-bottom, 0px))
      max(16px, env(safe-area-inset-left, 0px));
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 22px;
    box-shadow: 0 24px 72px rgba(2, 12, 69, .3);
  }

  .chat-modal-overlay.chat-keyboard-open .chat-modal {
    padding-bottom: 4px;
  }
}

/* Messaging experience
 *
 * Treasurer and member chat share one compact, keyboard-safe conversation
 * surface. The inbox sizes to its content; an open thread owns the available
 * height so the header and composer never scroll away.
 */

.chat-modal-overlay .chat-modal {
  display: flex;
  flex-direction: column;
  width: min(100%, 660px);
  max-width: 660px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 26px;
  box-shadow: 0 28px 80px rgba(2, 12, 69, .34);
}

#modal-chat .chat-modal,
#modal-messages .chat-modal.is-thread-view {
  height: min(84dvh, 760px);
}

#modal-messages .chat-modal:not(.is-thread-view) {
  height: auto;
  max-height: min(84dvh, 760px);
}

#messages-list-view:not([hidden]),
#messages-thread-view:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

#messages-list-view:not([hidden]) {
  height: auto;
  max-height: inherit;
}

#messages-thread-view:not([hidden]) { height: 100%; }

.chat-topbar {
  position: relative;
  z-index: 4;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 15px 17px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--app-line);
}

.chat-thread-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.chat-peer {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.chat-peer-avatar {
  display: inline-flex;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--app-ink);
  border: 1px solid rgba(2, 12, 69, .12);
  border-radius: 15px;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .02em;
}

.chat-peer-avatar-brand {
  color: var(--app-ink);
  background: var(--app-brand);
  border-color: #d9b92e;
}

.chat-peer-avatar svg {
  width: 20px;
  height: 20px;
}

.chat-peer-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.chat-context-label {
  margin-bottom: 2px;
  color: #6b5410;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .11em;
  line-height: 1.15;
  text-transform: uppercase;
}

.chat-peer-copy h2 {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--app-ink);
  font-size: 19px;
  font-weight: 850;
  letter-spacing: -.025em;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-peer-status {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-peer-status > span {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  background: #2f9662;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(47, 150, 98, .12);
}

.chat-topbar .modal-close-btn,
.chat-back-btn {
  display: inline-flex;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  color: var(--app-ink-soft);
  background: var(--app-surface-muted);
  border: 1px solid var(--app-line);
  border-radius: 13px;
  box-shadow: none;
}

.chat-back-btn { cursor: pointer; }
.chat-back-btn svg { width: 20px; height: 20px; }
.chat-back-btn:hover { color: var(--app-ink); background: var(--app-brand-soft); }

.chat-intro {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 18px;
  color: var(--app-muted);
  background: #fff;
  border-bottom: 1px solid var(--app-line-soft);
  font-size: 13px;
  line-height: 1.45;
}

.chat-convo-search {
  position: relative;
  display: block;
  flex: 0 0 auto;
  margin: 13px 16px 10px;
}

.chat-convo-search svg {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--app-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.chat-convo-search input {
  width: 100%;
  min-height: 45px;
  margin: 0;
  padding: 10px 14px 10px 42px;
  color: var(--app-ink);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: 14px;
  font-size: 16px;
}

#messages-convo-list {
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(54dvh, 480px);
  padding: 0 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.treasurer-page .chat-convo-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 72px;
  align-items: center;
  gap: 11px;
  margin: 0 0 8px;
  padding: 11px 12px;
  color: var(--app-ink);
  background: #fff;
  border: 1px solid var(--app-line);
  border-radius: 16px;
  box-shadow: 0 5px 16px rgba(2, 12, 69, .06);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.treasurer-page .chat-convo-row:hover,
.treasurer-page .chat-convo-row:focus-visible {
  border-color: #f4d54a;
  box-shadow: 0 9px 22px rgba(2, 12, 69, .1);
  transform: translateY(-1px);
}

.treasurer-page .chat-convo-row.unread {
  background: #f5f6fa;
  border-color: #f4d54a;
}

.treasurer-page .chat-convo-avatar {
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--app-ink);
  border-radius: 14px;
}

.chat-convo-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.chat-convo-name {
  overflow: hidden;
  color: var(--app-ink);
  font-size: 14px;
  font-weight: 780;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-convo-row.unread .chat-convo-name { font-weight: 880; }

.chat-convo-preview {
  display: block;
  overflow: hidden;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-convo-meta {
  display: flex;
  min-width: 42px;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.chat-convo-time {
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.chat-convo-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  color: var(--app-ink);
  background: var(--app-brand);
  border: 1px solid #d9b92e;
  font-size: 12px;
  font-weight: 900;
}

.chat-convo-chevron {
  color: #9499b5;
  font-size: 22px;
  line-height: 15px;
}

.chat-thread {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 16px 14px 22px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 6%, rgba(244, 213, 74, .07), transparent 12rem),
    #f5f6fa;
  border: 0;
  border-radius: 0;
  scroll-padding-block: 18px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.chat-day-divider {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
  color: #5b6180;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.chat-day-divider::before,
.chat-day-divider::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  background: #d6d8e6;
}

.chat-day-divider span {
  padding: 5px 8px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid #d6d8e6;
  border-radius: 999px;
}

.chat-row { flex: 0 0 auto; margin-top: 2px; }
.chat-row.group-start { margin-top: 10px; }
.chat-row.group-start:first-of-type { margin-top: 0; }
.chat-bubble-wrap { max-width: min(82%, 430px); }

.chat-bubble {
  padding: 9px 13px;
  border-radius: 17px;
  font-size: 14px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 4px 12px rgba(2, 12, 69, .06);
}

.chat-row.mine .chat-bubble {
  color: #fff;
  background: var(--app-ink);
  border: 1px solid var(--app-ink);
  border-bottom-right-radius: 6px;
}

.chat-row.theirs .chat-bubble {
  color: var(--app-ink);
  background: #fff;
  border: 1px solid #ced1e1;
  border-bottom-left-radius: 6px;
}

.chat-row.grouped.mine .chat-bubble { border-top-right-radius: 8px; }
.chat-row.grouped.theirs .chat-bubble { border-top-left-radius: 8px; }
.chat-row:not(.group-end).mine .chat-bubble { border-bottom-right-radius: 8px; }
.chat-row:not(.group-end).theirs .chat-bubble { border-bottom-left-radius: 8px; }

.chat-sender-label {
  margin: 0 0 5px;
  padding: 0 4px;
  color: #6b5410;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
}

.chat-time {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 0 4px;
  color: #5b6180;
  font-size: 12px;
  line-height: 1.2;
}

.chat-delivery-state::before { content: "·"; margin-right: 6px; }

.chat-composer {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  padding: 11px 14px max(11px, env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .98);
  border-top: 1px solid var(--app-line);
  box-shadow: 0 -10px 24px rgba(2, 12, 69, .05);
}

.chat-input-row {
  position: relative;
  bottom: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0;
  background: transparent;
}

.chat-input-row input {
  width: 100% !important;
  min-height: 50px;
  margin: 0 !important;
  padding: 11px 17px !important;
  color: var(--app-ink);
  background: #ffffff;
  border: 1px solid #c1c5d9;
  border-radius: 18px !important;
  font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(2, 12, 69, .03);
}

.chat-input-row input:focus {
  border-color: #d9b92e;
  box-shadow: 0 0 0 4px rgba(244, 213, 74, .15);
  outline: 0;
}

.chat-send-btn {
  flex-basis: 50px !important;
  width: 50px !important;
  height: 50px !important;
  color: var(--app-ink);
  background: var(--app-brand) !important;
  border: 1px solid #d9b92e;
  box-shadow: 0 9px 20px rgba(217, 185, 46, .2);
}

.chat-send-btn svg { width: 19px; height: 19px; }

.chat-send-feedback {
  margin: 0 4px 8px;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.3;
}

.chat-send-feedback.error { color: var(--app-danger); font-weight: 700; }
.chat-send-feedback[hidden] { display: none; }

.chat-empty-state {
  display: flex;
  flex: 1 1 auto;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px 20px;
  color: var(--app-muted);
  text-align: center;
}

.chat-empty-state strong {
  margin: 11px 0 4px;
  color: var(--app-ink);
  font-size: 15px;
}

.chat-empty-state > span:last-child { max-width: 310px; font-size: 12px; line-height: 1.45; }

.chat-empty-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  color: var(--app-ink);
  background: var(--app-brand-soft);
  border: 1px solid #f7e48f;
  border-radius: 14px;
}

.chat-empty-icon svg { width: 20px; height: 20px; }
.chat-empty-inbox { min-height: 190px; }

@media (max-width: 639px) {
  .modal-overlay.chat-modal-overlay {
    padding:
      max(8px, env(safe-area-inset-top, 0px))
      max(8px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px))
      max(8px, env(safe-area-inset-left, 0px));
  }

  .chat-modal-overlay .chat-modal {
    width: 100%;
    max-width: 620px;
    padding: 0;
    border-radius: 22px;
  }

  #modal-chat .chat-modal,
  #modal-messages .chat-modal.is-thread-view {
    height: min(calc(100% - 2px), 760px);
    max-height: min(calc(100% - 2px), 760px);
  }

  #modal-messages .chat-modal:not(.is-thread-view) {
    height: auto;
    max-height: min(calc(100% - 2px), 760px);
  }

  .chat-topbar {
    min-height: 68px;
    gap: 9px;
    padding: 11px 12px;
  }

  .chat-thread-topbar { grid-template-columns: 38px minmax(0, 1fr) 38px; }

  .chat-peer { gap: 9px; }

  .chat-peer-avatar {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .chat-peer-copy h2 { font-size: 17px; }
  .chat-peer-status { font-size: 12px; }
  .chat-context-label { font-size: 12px; }

  .chat-topbar .modal-close-btn,
  .chat-back-btn {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .chat-intro { padding: 9px 13px; font-size: 12px; }
  .chat-convo-search { margin: 10px 12px 8px; }
  .chat-convo-search input { min-height: 43px; }
  #messages-convo-list { max-height: 54dvh; padding: 0 12px 12px; }

  .treasurer-page .chat-convo-row {
    min-height: 68px;
    gap: 9px;
    padding: 10px;
  }

  .treasurer-page .chat-convo-avatar { width: 40px; height: 40px; }
  .chat-convo-name { font-size: 13px; }
  .chat-convo-preview { font-size: 12px; }
  .chat-convo-time { font-size: 12px; }

  .chat-thread { padding: 12px 9px 18px; }
  .chat-day-divider { margin: 6px 0 9px; }
  .chat-bubble-wrap { max-width: 86%; }
  .chat-bubble { padding: 9px 12px; font-size: 13px; }

  .chat-composer { padding: 9px 10px max(9px, env(safe-area-inset-bottom, 0px)); }
  .chat-input-row { grid-template-columns: minmax(0, 1fr) 48px; gap: 8px; }
  .chat-input-row input { min-height: 48px; padding-inline: 15px !important; }
  .chat-send-btn { flex-basis: 48px !important; width: 48px !important; height: 48px !important; }

  .chat-modal-overlay.chat-keyboard-open .chat-modal {
    height: calc(100% - 2px);
    max-height: calc(100% - 2px);
    padding: 0;
    border-radius: 18px;
  }

  .chat-modal-overlay.chat-keyboard-open .chat-intro { display: none; }
  .chat-modal-overlay.chat-keyboard-open .chat-composer { padding-bottom: 6px; }
}

@supports not (overflow: clip) {
  html,
  body { overflow-x: hidden; }
}

@media (hover: none) and (pointer: coarse) {
  button:hover,
  .list-row:hover,
  .group-row:hover,
  .loan-summary-card:hover,
  .history-card:hover,
  .trust-card:hover,
  .document-action-card:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  body { background: #fff !important; }
  .section-header,
  .borrower-page-head,
  .account-profile-hero {
    color: #020c45 !important;
    background: #fff !important;
    border-color: #abb0cb !important;
  }
  .section-header h2,
  .section-header p,
  .borrower-page-head h2,
  .borrower-page-head p { color: #020c45 !important; }
}
/* Master Admin content studio */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.cms-tab{--cms-ink:#020c45;--cms-muted:#5b6180;--cms-paper:#f5f6fa;--cms-line:#d1d4e3;--cms-yellow:#f4d54a}
.cms-heading-row{display:flex;align-items:flex-end;justify-content:space-between;gap:28px;margin-bottom:26px}
.cms-heading-row h2{margin:4px 0 5px;font-size:32px;letter-spacing:-.035em}
.cms-heading-row p{margin:0;color:var(--cms-muted);font-size:14px}
.cms-stat-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:22px}
.cms-stat-row>div{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:18px 20px;background:#fff;border:1px solid var(--cms-line);border-radius:14px}
.cms-stat-row span{color:var(--cms-muted);font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.07em}
.cms-stat-row strong{font-size:24px;letter-spacing:-.04em}
.cms-list-tools{display:grid;grid-template-columns:minmax(240px,1fr) 180px auto;gap:10px;margin-bottom:16px}
.cms-list-tools input,.cms-list-tools select{width:100%;height:44px;padding:0 14px;background:#fff;border:1px solid var(--cms-line);border-radius:11px;font:inherit;color:var(--cms-ink)}
.cms-list-tools .small-btn{height:44px}
.cms-list-empty{padding:72px 24px;text-align:center;background:#fff;border:1px dashed #b6bad2;border-radius:17px}
.cms-list-empty svg{width:42px;height:42px;margin-bottom:12px;color:#8086a7}
.cms-list-empty h3{margin:0;font-size:23px}
.cms-list-empty p{margin:8px 0 0;color:var(--cms-muted)}
.cms-article-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:24px;padding:20px 22px;margin-bottom:10px;background:#fff;border:1px solid var(--cms-line);border-radius:15px;transition:border-color .2s ease,transform .2s ease}
.cms-article-row:hover{transform:translateY(-1px);border-color:#a4a8c0}
.cms-article-row-main{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:center;gap:18px;min-width:0}
.cms-article-thumb{display:grid;width:84px;aspect-ratio:16/10;overflow:hidden;place-items:center;background:#e6e8f0;border-radius:10px}
.cms-article-thumb img{width:100%;height:100%;object-fit:cover}
.cms-article-thumb span{font-size:24px;font-weight:780;color:#70779c}
.cms-article-copy{min-width:0}
.cms-article-copy h3{overflow:hidden;margin:5px 0 6px;font-size:18px;letter-spacing:-.02em;text-overflow:ellipsis;white-space:nowrap}
.cms-article-copy p{overflow:hidden;margin:0;color:var(--cms-muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}
.cms-article-meta{display:flex;align-items:center;gap:9px;color:var(--cms-muted);font-size: 12px}
.cms-status-chip{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:#eef0f5;color:#3a4270;font-size: 12px;font-weight:800;letter-spacing:.05em;text-transform:uppercase}
.cms-status-chip.published{background:#dff3e6;color:#22633a}
.cms-status-chip.scheduled{background:#fdf7da;color:#6b5410}
.cms-status-chip.archived{background:#e6e8f0;color:#5b6180}
.cms-article-row-actions{display:flex;align-items:center;gap:8px}
.cms-article-row-actions a,.cms-article-row-actions button{white-space:nowrap}

.cms-editor-topbar{position:sticky;top:var(--sticky-offset,72px);z-index:12;display:flex;align-items:center;justify-content:space-between;gap:20px;margin:-4px -8px 22px;padding:12px 8px;background:rgba(245, 246, 250,.94);backdrop-filter:blur(14px)}
.cms-editor-top-actions{display:flex;align-items:center;justify-content:flex-end;gap:9px}
.cms-save-state{color:var(--cms-muted);font-size:12px}
.cms-save-state.error{color:#9c2f2f}
.cms-editor-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(270px,340px);align-items:start;gap:18px}
.cms-editor-main,.cms-editor-settings{display:grid;gap:18px;min-width:0}
.cms-editor-settings{position:sticky;top:calc(var(--sticky-offset,72px) + 78px)}
.cms-title-field{display:block;padding:20px 24px;background:#fff;border:1px solid var(--cms-line);border-radius:16px}
.cms-title-field>span{display:block;margin-bottom:8px;color:var(--cms-muted);font-size: 12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.cms-title-field textarea{display:block;width:100%;padding:0;resize:none;border:0;outline:0;background:transparent;color:var(--cms-ink);font:650 clamp(28px,4vw,44px)/1.08 Figtree,Arial,sans-serif;letter-spacing:-.045em}
.cms-editor-card{min-width:0;padding:20px;background:#fff;border:1px solid var(--cms-line);border-radius:16px}
.cms-card-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}
.cms-card-heading span{display:block;color:var(--cms-muted);font-size: 12px;font-weight:800;letter-spacing:.09em;text-transform:uppercase}
.cms-card-heading h3{margin:3px 0 0;font-size:18px;letter-spacing:-.025em}
.cms-content-count{display:flex;gap:9px;color:var(--cms-muted);font-size: 12px}
.cms-editor-card>label,.cms-editor-settings label{display:block;margin-top:14px;color:#3a4270;font-size:12px;font-weight:700}
.cms-editor-card>label:first-of-type{margin-top:0}
.cms-editor-card label input,.cms-editor-card label textarea,.cms-editor-card label select{display:block;width:100%;margin-top:7px;padding:11px 12px;border:1px solid #c3c7db;border-radius:10px;outline:0;background:#fff;color:var(--cms-ink);font:500 14px/1.45 Figtree,Arial,sans-serif;transition:border-color .2s ease,box-shadow .2s ease}
.cms-editor-card label input:focus,.cms-editor-card label textarea:focus,.cms-editor-card label select:focus{border-color:#d9b92e;box-shadow:0 0 0 3px rgba(244, 213, 74,.16)}
.cms-editor-card label small{display:block;margin-top:5px;color:var(--cms-muted);font-weight:500;text-align:right}
.cms-field-note,.cms-editor-hint{margin:8px 0 0;color:var(--cms-muted);font-size: 12px;line-height:1.45}
.cms-markdown-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:8px;background:#eef0f5;border:1px solid #c8ccde;border-bottom:0;border-radius:11px 11px 0 0}
.cms-markdown-toolbar button{min-width:36px;height:32px;padding:0 9px;border:1px solid transparent;border-radius:7px;background:transparent;color:#0e1a5c;font:650 12px Figtree,Arial,sans-serif;cursor:pointer}
.cms-markdown-toolbar button:hover{background:#fff;border-color:#b6bad2}
.cms-content-source{display:block;width:100%;min-height:480px;padding:20px;resize:vertical;border:1px solid #c8ccde;border-radius:0 0 11px 11px;outline:0;background:#ffffff;color:#020c45;font:500 16px/1.72 Figtree,Arial,sans-serif}
.cms-content-source:focus{border-color:#d9b92e;box-shadow:0 0 0 3px rgba(244, 213, 74,.13)}
.cms-live-preview{padding:34px clamp(18px,5vw,58px);background:#f5f6fa;border:1px solid #d4d7e5;border-radius:13px}
.cms-preview-category{color:#6b5410;font-size: 12px;font-weight:800;letter-spacing:.12em;text-transform:uppercase}
.cms-live-preview>h1{margin:11px 0 12px;font-size:clamp(32px,5vw,52px);line-height:1.04;letter-spacing:-.05em}
.cms-preview-excerpt{margin:0;color:var(--cms-muted);font-size:17px;line-height:1.55}
.cms-preview-meta{display:flex;gap:18px;margin:20px 0 32px;padding-bottom:20px;border-bottom:1px solid #cccfe0;color:var(--cms-muted);font-size: 12px}
.cms-preview-content{font-size:16px;line-height:1.72;color:#0e1a5c}
.cms-preview-content h2{margin:38px 0 13px;font-size:28px;line-height:1.15;letter-spacing:-.035em}
.cms-preview-content h3{margin:30px 0 11px;font-size:23px;line-height:1.2}
.cms-preview-content p{margin:0 0 18px}
.cms-preview-content ul,.cms-preview-content ol{padding-left:24px}
.cms-preview-content blockquote{margin:24px 0;padding-left:18px;border-left:3px solid var(--cms-yellow);font-size:18px}
.cms-preview-content a{text-decoration:underline;text-decoration-color:#6b5410;text-underline-offset:3px}
.cms-image-preview{display:grid;min-height:150px;overflow:hidden;place-items:center;background:#eef0f5;border:1px dashed #b1b5cf;border-radius:12px;color:var(--cms-muted);font-size:12px}
.cms-image-preview img{width:100%;height:100%;max-height:220px;object-fit:cover}
.cms-file-button{display:flex!important;align-items:center;justify-content:center;min-height:42px;margin-top:10px!important;border:1px solid var(--cms-ink);border-radius:10px;color:var(--cms-ink)!important;cursor:pointer}
.cms-file-button input{display:none!important}
.cms-search-preview{margin-top:18px;padding:15px;background:#ffffff;border:1px solid #dfe2e8;border-radius:10px}
.cms-search-preview span{display:block;overflow:hidden;color:#49715b;font-size: 12px;text-overflow:ellipsis;white-space:nowrap}
.cms-search-preview strong{display:block;margin-top:5px;color:#2458aa;font:500 17px/1.25 Arial,sans-serif}
.cms-search-preview p{margin:5px 0 0;color:#3a4270;font:400 12px/1.45 Arial,sans-serif}
.cms-history-item{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;padding:11px 0;border-bottom:1px solid var(--cms-line)}
.cms-history-item:last-child{border-bottom:0}
.cms-history-item strong{display:block;font-size:12px}
.cms-history-item span{display:block;margin-top:2px;color:var(--cms-muted);font-size: 12px}
.cms-danger-card{padding:18px;background:#ffffff;border:1px solid #eccfc7;border-radius:15px}
.cms-danger-card strong{font-size:13px}
.cms-danger-card p{margin:5px 0 14px;color:#795c55;font-size: 12px;line-height:1.45}
.cms-danger-card button{width:100%;margin-top:7px}
.cms-delete-draft{color:#9d2e2e!important;border-color:#d9aaa0!important}

@media(max-width:980px){
  .cms-editor-grid{grid-template-columns:1fr}
  .cms-editor-settings{position:static}
  .cms-stat-row{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media(max-width:640px){
  .cms-heading-row{align-items:flex-start}
  .cms-heading-row .add-btn{flex:0 0 auto;padding-inline:12px}
  .cms-list-tools{grid-template-columns:1fr 1fr}
  .cms-list-tools .cms-search{grid-column:1/-1}
  .cms-article-row{display:block;padding:15px}
  .cms-article-row-main{grid-template-columns:68px minmax(0,1fr);gap:12px}
  .cms-article-thumb{width:68px}
  .cms-article-row-actions{justify-content:flex-end;margin-top:14px}
  .cms-editor-topbar{top:var(--sticky-offset,60px);margin-inline:-2px}
  .cms-editor-top-actions .cms-save-state,.cms-editor-top-actions #cms-copy-link{display:none}
  .cms-editor-top-actions .add-btn{padding-inline:13px}
  .cms-title-field{padding:17px}
  .cms-editor-card{padding:16px}
  .cms-content-source{min-height:400px;padding:15px}
  .cms-live-preview{padding:24px 17px}
  .cms-stat-row>div{padding:14px 15px}
}
.loan-attention-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.loan-attention-card {
  appearance: none;
  border: 1px solid rgba(14, 26, 92, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--app-ink);
  padding: 15px 16px;
  text-align: left;
  display: grid;
  gap: 4px;
}

button.loan-attention-card {
  cursor: pointer;
}

button.loan-attention-card:hover,
button.loan-attention-card:focus-visible {
  border-color: rgba(31, 92, 62, 0.42);
  box-shadow: 0 7px 20px rgba(2, 12, 69, 0.08);
}

.loan-attention-card > span,
.loan-attention-card > small {
  color: var(--app-muted);
  font-size: 12px;
}

.loan-attention-card > strong {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 28px;
  line-height: 1;
}

.loan-attention-card--overdue {
  border-color: rgba(166, 65, 51, 0.28);
  background: rgba(255, 246, 243, 0.86);
}

.loan-attention-card--soon {
  border-color: rgba(217, 185, 46, 0.28);
  background: rgba(245, 246, 250, 0.88);
}

@media (max-width: 720px) {
  .loan-attention-grid {
    grid-template-columns: 1fr;
  }
}

/* Batch 2 operational risk and queue reporting */

.risk-overview-panel {
  display: grid;
  gap: 16px;
  margin: 18px 0 24px;
  padding: 18px;
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}

.risk-report-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.risk-report-heading h3,
.report-section-heading h3 {
  margin: 2px 0 4px;
  color: var(--app-ink);
  font-size: 19px;
}

.risk-report-heading p,
.report-section-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.55;
}

.risk-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.risk-summary-card {
  min-width: 0;
  padding: 14px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 14px;
}

.risk-summary-card--warning {
  background: var(--app-warning-soft);
  border-color: #f7e48f;
}

.risk-summary-card > span,
.risk-summary-card > small {
  display: block;
  color: var(--app-muted);
  font-size: 12px;
}

.risk-summary-card > span {
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.risk-summary-card > strong {
  display: block;
  margin: 6px 0 3px;
  overflow-wrap: anywhere;
  color: var(--app-ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(19px, 5vw, 26px);
  line-height: 1;
}

.operations-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 16px 0 8px;
}

.operations-filter-grid label {
  display: grid;
  gap: 5px;
  margin: 0;
}

.operations-filter-grid label > span {
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.operations-filter-grid input,
.operations-filter-grid select {
  min-height: 44px;
  margin: 0;
  background: var(--app-surface);
  border-color: var(--app-line-strong);
  border-radius: 11px;
}

.filter-result-count {
  min-height: 16px;
  margin: 8px 0 12px;
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 750;
}

.risk-table-wrap { background: var(--app-surface); }
.risk-table td { vertical-align: top; }
.risk-table td > strong { display: block; color: var(--app-ink); }
.risk-table td > .badge { display: inline-flex; margin-top: 5px; }
.risk-table td > small { display: block; margin-top: 4px; color: var(--app-muted); line-height: 1.45; }
.risk-value-warning { color: var(--app-danger) !important; }

.risk-loan-filters {
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid var(--app-line);
}

.report-section-heading {
  margin: 28px 0 12px;
  padding-top: 22px;
  border-top: 1px solid var(--app-line);
}

.compliance-queue-badges {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;
}

.activity-context {
  color: var(--app-muted);
  font-size: 12px;
  text-transform: capitalize;
}

@media (min-width: 640px) {
  .risk-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .operations-filter-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operations-filter-grid--three { grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, .8fr)); }
  .operations-filter-grid--four { grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(140px, .8fr)); }
}

@media (max-width: 639px) {
  .risk-overview-panel { padding: 14px; }
  .risk-report-heading { flex-direction: column; }
  .risk-report-heading .small-btn { width: 100%; }
  .risk-summary-card > strong { font-size: 20px; }
  .compliance-queue-badges { align-items: flex-start; }
}

.account-security-modal {
  width: min(520px, calc(100vw - 28px));
}

.security-status-card,
.security-session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  background: var(--app-surface-subtle);
}

.security-status-card p,
.security-session-card p,
.security-enrollment p,
#security-challenge-view > p {
  margin: 4px 0 0;
  color: var(--app-muted);
  font-size: 13px;
}

#security-mfa-status.is-secure {
  color: var(--app-positive);
  font-weight: 650;
}

.security-session-card {
  margin-top: 14px;
}

.security-enrollment {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  text-align: center;
  background: var(--app-surface);
}

.security-enrollment img {
  display: block;
  width: 190px;
  height: 190px;
  margin: 16px auto;
  border: 8px solid #fff;
  border-radius: 12px;
}

.security-enrollment details {
  margin-bottom: 14px;
  color: var(--app-muted);
  font-size: 12px;
}

.security-enrollment code {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--app-ink);
}

.security-enrollment form,
#security-challenge-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  text-align: left;
}

.security-enrollment input,
#security-challenge-code {
  font-size: 20px;
  letter-spacing: .22em;
  text-align: center;
}

.security-recovery-note {
  margin: 14px 2px 0;
  color: var(--app-muted);
  font-size: 12px;
}

#security-challenge-view {
  padding: 6px 0 2px;
  text-align: center;
}

.security-gate-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  color: #fff;
  background: var(--app-positive);
  font-size: 25px;
  font-weight: 800;
}

@media (max-width: 560px) {
  .security-status-card,
  .security-session-card {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Canonical accessibility and high-volume directory finish */

h1,
h2,
h3,
.dashboard-group-name,
.kpi-value,
.summary-value {
  font-family: var(--app-font-display);
}

.kpi-value,
.summary-value,
.borrower-loan-balance strong,
.loan-item-total strong,
.borrower-loan-metrics strong,
.standing-amount,
.money,
table {
  font-variant-numeric: tabular-nums;
}

.sidebar-section-label {
  display: none;
}

.loan-directory-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
  padding: 16px;
  color: var(--app-muted);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
}

.loan-directory-pagination p {
  margin: 0;
  font-size: var(--app-font-support);
}

.loan-directory-pagination p strong {
  color: var(--app-ink);
}

.loan-directory-more {
  flex: 0 0 auto;
  min-height: 44px;
  color: #020c45;
  background: var(--app-brand);
  border-color: #d9b92e;
}

.loan-directory-summary:focus {
  outline: none;
}

@media (max-width: 560px) {
  .loan-directory-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .loan-directory-more {
    width: 100%;
  }
}

@media (min-width: 960px) {
  .sidebar-section-label {
    display: block;
    width: 100%;
    margin: 13px 10px 2px;
    color: var(--app-muted);
    font-size: var(--app-font-caption);
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .sidebar-section-label:first-child {
    margin-top: 7px;
  }
}


@media (prefers-contrast: more) {
  :root {
    --app-muted: #3a4270;
    --app-line: #5b6180;
    --app-line-strong: #3a4270;
  }

  :focus-visible {
    outline-width: 4px !important;
    outline-offset: 3px !important;
  }

  .app-header,
  .sidebar,
  .loan-directory-toolbar,
  .modal {
    background-color: var(--app-surface);
  }
}


@media (prefers-reduced-transparency: reduce) {
  .app-header,
  .sidebar,
  .treasurer-mobile-nav,
  .dock,
  .profile-menu,
  .notif-panel,
  .modal-overlay,
  .modal {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .app-header,
  .sidebar,
  .treasurer-mobile-nav,
  .dock,
  .profile-menu,
  .notif-panel,
  .modal {
    background: var(--app-surface) !important;
  }

  .modal-overlay {
    background: rgba(2, 12, 69, .84) !important;
  }
}

/* ========================================================================
   Treasurer workspace — Android workflow parity, light-only UI
   ======================================================================== */

.treasurer-page {
  color: var(--app-ink);
  background: var(--app-canvas);
}

.treasurer-page .app-header {
  background: rgba(255, 255, 255, .96);
  border-color: var(--app-line);
  box-shadow: 0 1px 0 rgba(2, 12, 69, .03);
}

.treasurer-page .dashboard-shell {
  align-items: start;
  width: min(100%, 1480px);
}

.treasurer-page .dashboard-main > .tab-content {
  min-height: 60vh;
  color: var(--app-ink);
  background: transparent;
}

.treasurer-page .section-header {
  color: var(--app-ink);
  background: var(--app-surface);
  border-color: var(--app-line);
  box-shadow: var(--app-shadow-sm);
}

.treasurer-page .section-header::after {
  right: -42px;
  top: -102px;
  width: 190px;
  height: 190px;
  background: var(--app-brand-soft);
  border: 28px solid rgba(244, 213, 74, .28);
}

.treasurer-page .section-header h2,
.treasurer-page .section-header p,
.treasurer-page .section-header .section-kicker {
  color: inherit;
}

.treasurer-page .section-header .section-kicker { color: var(--app-brand-ink); }

.treasurer-page .sidebar {
  background: var(--app-surface);
  border-color: var(--app-line);
  box-shadow: var(--app-shadow-sm);
}

.treasurer-page .sidebar-item {
  position: relative;
  color: var(--app-muted);
  background: transparent;
  border-color: transparent;
}

.treasurer-page .sidebar-item:hover {
  color: var(--app-ink);
  background: var(--app-surface-subtle);
}

.treasurer-page .sidebar-item.active {
  color: var(--app-ink);
  background: var(--app-brand-soft);
  border-color: rgba(217, 185, 46, .2);
  box-shadow: none;
}

.sidebar-count-badge,
.mobile-nav-badge,
.overview-shortcut-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  min-height: 20px;
  padding: 2px 6px;
  color: #fff;
  background: var(--app-danger);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.sidebar-count-badge { margin-left: auto; }
.mobile-nav-badge { position: absolute; top: 2px; right: max(7px, 18%); border: 2px solid var(--app-surface); }

.treasurer-dashboard-intro,
.dashboard-section-heading,
.overview-shortcuts-heading,
.treasurer-report-toolbar,
.loan-request-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.treasurer-dashboard-intro {
  margin: 4px 2px 18px;
}

.treasurer-dashboard-intro h2 {
  margin: 2px 0 5px;
  font-size: clamp(27px, 4vw, 40px);
  letter-spacing: -.04em;
}

.treasurer-dashboard-intro p,
.dashboard-section-heading p,
.overview-shortcuts-heading p,
.report-section-heading p,
.treasurer-report-toolbar p,
.loan-request-card p {
  margin: 3px 0 0;
  color: var(--app-muted);
}

.dashboard-attention-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--app-brand-ink);
  background: var(--app-brand-soft);
  border: 1px solid rgba(217, 185, 46, .22);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 850;
}

.dashboard-attention-pill svg { width: 16px; height: 16px; }
.dashboard-attention-pill.is-clear { color: var(--app-positive); background: var(--app-positive-soft); border-color: rgba(46, 107, 77, .18); }

.treasurer-financial-hero {
  position: relative;
  isolation: isolate;
  margin-bottom: 14px;
  padding: clamp(22px, 4vw, 34px);
  overflow: hidden;
  color: #fff;
  background: linear-gradient(140deg, #020c45 0%, #020c45 70%, #6b5410 100%);
  border: 1px solid rgba(2, 12, 69, .2);
  border-radius: var(--app-radius-xl);
  box-shadow: 0 20px 44px rgba(2, 12, 69, .16);
}

.treasurer-financial-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 260px;
  height: 260px;
  right: -110px;
  top: -120px;
  background: rgba(244, 213, 74, .13);
  border: 36px solid rgba(244, 213, 74, .1);
  border-radius: 50%;
}

.financial-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.financial-hero-icon,
.request-queue-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--app-ink);
  background: var(--app-brand);
  border-radius: 13px;
}

.financial-hero-icon svg { width: 21px; height: 21px; }
.financial-hero-pill { padding: 6px 10px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; font-size: 12px; font-weight: 750; }
.treasurer-financial-hero > span { display: block; color: rgba(255, 255, 255, .7); font-size: 13px; font-weight: 700; }
.treasurer-financial-hero > strong { display: block; margin: 4px 0 21px; font-size: clamp(34px, 7vw, 60px); letter-spacing: -.055em; line-height: 1; font-variant-numeric: tabular-nums; }
.treasurer-financial-hero > p { margin: 18px 0 0; color: rgba(255, 255, 255, .62); font-size: 12px; }

.financial-hero-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid rgba(255, 255, 255, .12);
}

.financial-hero-values > div { padding: 17px 0 0; }
.financial-hero-values > div + div { padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, .12); }
.financial-hero-values span { display: block; color: rgba(255, 255, 255, .58); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.financial-hero-values strong { display: block; margin-top: 4px; font-size: clamp(18px, 4vw, 26px); font-variant-numeric: tabular-nums; }

.treasurer-metric-grid,
.overview-cycle-grid,
.fund-ledger-summary,
.member-directory-summary,
.member-detail-summary,
.treasurer-report-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.treasurer-metric-grid { margin-bottom: 22px; }
.treasurer-metric-card,
.overview-cycle-card,
.fund-ledger-summary article,
.treasurer-report-summary-grid article {
  min-width: 0;
  padding: 16px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}

.treasurer-metric-card > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.treasurer-metric-card strong { font-size: clamp(22px, 5vw, 31px); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.treasurer-metric-card h3 { margin: 13px 0 2px; font-size: 14px; }
.treasurer-metric-card p { margin: 0; color: var(--app-muted); font-size: 12px; }
.metric-icon { display: grid; place-items: center; width: 30px; height: 30px; color: var(--app-brand-ink); background: var(--app-brand-soft); border-radius: 9px; font-size: 15px; }

.dashboard-section,
.treasurer-report-panel {
  margin-top: 16px;
  padding: clamp(17px, 3vw, 24px);
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-xl);
  box-shadow: var(--app-shadow-sm);
}

.dashboard-section-heading,
.overview-shortcuts-heading { margin-bottom: 14px; }
.dashboard-section-heading h3,
.overview-shortcuts-heading h3,
.report-section-heading h3,
.treasurer-report-toolbar h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.dashboard-section-heading--action { align-items: center; }

.overview-attention-list,
.overview-activity-list,
.loan-request-list { display: grid; gap: 9px; }

.overview-action-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  color: var(--app-ink);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  text-align: left;
}

.overview-action-card:hover { background: var(--app-brand-soft); border-color: rgba(217, 185, 46, .22); }
.overview-action-card span:nth-child(2) { min-width: 0; }
.overview-action-card strong,
.overview-action-card small { display: block; }
.overview-action-card small { margin-top: 2px; color: var(--app-muted); font-weight: 500; }
.overview-action-card b { color: var(--app-brand-ink); font-size: 12px; }
.overview-action-icon { display: grid; place-items: center; width: 36px; height: 36px; background: var(--app-brand); border-radius: 11px; font-weight: 850; }

.overview-caught-up,
.empty-state {
  padding: 21px;
  color: var(--app-ink);
  background: var(--app-positive-soft);
  border: 1px solid rgba(46, 107, 77, .16);
  border-radius: var(--app-radius-md);
  text-align: center;
}

.overview-caught-up p,
.empty-state p { margin: 4px 0 0; color: var(--app-muted); }
.overview-cycle-card span,
.fund-ledger-summary span,
.member-directory-summary span,
.member-detail-summary span,
.treasurer-report-summary-grid span { display: block; color: var(--app-muted); font-size: 12px; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.overview-cycle-card strong,
.fund-ledger-summary strong,
.member-directory-summary strong,
.member-detail-summary strong,
.treasurer-report-summary-grid strong { display: block; margin-top: 7px; font-size: clamp(19px, 4vw, 27px); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.overview-cycle-card p,
.fund-ledger-summary small,
.treasurer-report-summary-grid small { display: block; margin: 5px 0 0; color: var(--app-muted); font-size: 12px; }

.overview-shortcut-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.overview-shortcut {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 11px 12px;
  color: var(--app-ink);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  text-align: left;
}

.overview-shortcut:hover { background: var(--app-brand-soft); border-color: rgba(217, 185, 46, .22); transform: none; }
.overview-shortcut-icon { display: grid; place-items: center; width: 38px; height: 38px; color: var(--app-brand-ink); background: var(--app-brand-soft); border-radius: 11px; font-size: 18px; font-weight: 850; }
.overview-shortcut-icon svg { width: 19px; height: 19px; }
.overview-shortcut strong,
.overview-shortcut small { display: block; }
.overview-shortcut small { margin-top: 2px; color: var(--app-muted); font-size: 12px; font-weight: 550; }
.overview-shortcut-arrow { width: 17px; height: 17px; color: var(--app-muted); }

.overview-activity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--app-line);
}

.overview-activity-row:last-child { border-bottom: 0; }
.overview-activity-row strong,
.overview-activity-row small { display: block; }
.overview-activity-row strong { font-size: 13px; }
.overview-activity-row small { margin-top: 2px; color: var(--app-muted); font-size: 12px; }
.overview-activity-dot { width: 9px; height: 9px; margin-top: 6px; background: var(--app-brand); border: 2px solid var(--app-brand-soft); border-radius: 50%; box-shadow: 0 0 0 2px var(--app-brand); }

.overview-access-list { display: flex; flex-wrap: wrap; gap: 7px; }
.overview-access-list > span { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 9px; color: var(--app-muted); background: var(--app-surface-subtle); border: 1px solid var(--app-line); border-radius: 999px; font-size: 12px; font-weight: 750; }
.overview-access-list i { width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.overview-access-list b { margin-left: 3px; color: inherit; font-size: 12px; }
.overview-access-list .is-enabled { color: var(--app-positive); background: var(--app-positive-soft); border-color: rgba(46, 107, 77, .15); }

.request-queue-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  margin-bottom: 14px;
  padding: 20px;
  background: var(--app-brand-soft);
  border: 1px solid rgba(217, 185, 46, .18);
  border-radius: var(--app-radius-xl);
}

.request-queue-icon { width: 48px; height: 48px; background: var(--app-brand); font-size: 23px; }
.request-queue-hero span:not(.request-queue-icon) { color: var(--app-brand-ink); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.request-queue-hero strong { display: block; font-size: 34px; line-height: 1; }
.request-queue-hero p { margin: 5px 0 0; color: var(--app-muted); }

.loan-request-card {
  padding: 17px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}

.loan-request-card-head h3 { margin: 3px 0 0; font-size: 18px; }
.loan-request-card-head > strong { flex: 0 0 auto; font-size: 21px; font-variant-numeric: tabular-nums; }
.loan-request-note { padding: 11px 12px; background: var(--app-surface-subtle); border-radius: 11px; }
.loan-request-meta,
.loan-request-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.loan-request-meta { color: var(--app-muted); font-size: 12px; }
.loan-request-card--decision { background: var(--app-surface-subtle); box-shadow: none; }
.report-section-heading { margin: 26px 2px 12px; }
.loan-request-context { margin-bottom: 14px; padding: 13px; background: var(--app-brand-soft); border: 1px solid rgba(217, 185, 46, .2); border-radius: var(--app-radius-md); }
.loan-request-context span,
.loan-request-context strong { display: block; }
.loan-request-context span { color: var(--app-brand-ink); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.loan-request-context strong { margin-top: 2px; font-size: 17px; }
.loan-request-context p { margin: 4px 0 0; color: var(--app-muted); }

.member-directory-summary { margin-bottom: 12px; }
.member-directory-summary > div,
.member-detail-summary > div {
  padding: 14px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  box-shadow: var(--app-shadow-sm);
}

.member-directory-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  margin: 12px 0 20px;
  padding: 13px;
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
}

.member-directory-toolbar label,
.member-directory-toolbar input,
.member-directory-toolbar select { width: 100%; }
.member-list-row { background: var(--app-surface); border-color: var(--app-line); border-radius: var(--app-radius-md); box-shadow: var(--app-shadow-sm); }
.member-row-actions { flex-wrap: wrap; justify-content: flex-end; }
.member-detail-modal { width: min(900px, 100%); }
.member-detail-summary { margin-bottom: 14px; }
.member-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.member-detail-grid > section { padding: 15px; background: var(--app-surface-subtle); border: 1px solid var(--app-line); border-radius: var(--app-radius-md); }
.member-detail-grid h3 { margin: 0 0 10px; font-size: 15px; }
.member-detail-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--app-line); font-size: 12px; }
.member-detail-row:last-child { border-bottom: 0; }
.member-detail-row span { color: var(--app-muted); }
.member-detail-row--stack { align-items: flex-start; flex-direction: column; }

.fund-ledger-summary { margin-bottom: 13px; }
.fund-ledger-summary .positive { color: var(--app-positive); }
.fund-ledger-summary .negative { color: var(--app-danger); }
.fund-ledger-table td:nth-child(2) strong,
.fund-ledger-table td:nth-child(2) small,
.fund-ledger-table td:nth-child(2) span,
.report-table td strong,
.report-table td small { display: block; }
.fund-ledger-table td:nth-child(2) small,
.fund-ledger-table td:nth-child(2) span,
.report-table td small { margin-top: 2px; color: var(--app-muted); font-size: 12px; }

.treasurer-report-panel { margin-top: 0; }
.treasurer-report-toolbar { align-items: end; margin-bottom: 16px; }
.treasurer-report-toolbar label { flex: 0 0 min(220px, 42%); }
.treasurer-report-toolbar select { width: 100%; }
.treasurer-report-summary-grid { margin-bottom: 4px; }
.report-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.report-detail-grid > section { min-width: 0; }
.report-table { min-width: 680px; }
.report-month-table { min-width: 980px; }

.treasurer-mobile-nav {
  background: rgba(255, 255, 255, .97);
  border-color: var(--app-line);
  box-shadow: 0 14px 36px rgba(2, 12, 69, .15);
}

.treasurer-mobile-item.active { color: var(--app-ink); background: var(--app-brand-soft); }

@media (min-width: 640px) {
  .overview-shortcut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .member-directory-toolbar { grid-template-columns: minmax(0, 1fr) minmax(180px, .34fr); }
  .member-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .treasurer-report-summary-grid,
  .fund-ledger-summary,
  .member-directory-summary,
  .member-detail-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
  .treasurer-page .sidebar {
    max-height: calc(100dvh - var(--header-h, 76px) - 38px);
    overflow-y: auto;
  }

  .treasurer-page .dashboard-main { max-width: 1180px; }
  .treasurer-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .overview-shortcut-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1260px) {
  .overview-shortcut-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 639px) {
  .treasurer-dashboard-intro { align-items: flex-start; }
  .dashboard-attention-pill { min-width: 62px; justify-content: center; }
  .treasurer-metric-card,
  .overview-cycle-card,
  .fund-ledger-summary article,
  .treasurer-report-summary-grid article { padding: 13px; }
  .loan-request-card-head,
  .treasurer-report-toolbar { align-items: stretch; flex-direction: column; }
  .loan-request-card-head > strong { order: -1; }
  .treasurer-report-toolbar label { width: 100%; }
  .loan-request-actions > * { flex: 1 1 140px; }
  .member-list-row { align-items: stretch; }
  .member-row-actions { justify-content: flex-start; }
}
