/* Plantvest design tokens for Peer Finance Manager (operational UI).
   Retune colors, type, and radius here only. Loaded after styles.css. */

:root {
  --pv-forest-950: #0a2a1f;
  --pv-forest-900: #0b3d2c;
  --pv-forest-700: #135c3f;
  --pv-green-600: #146b45;
  --pv-green-500: #1e8a57;
  --pv-lime-400: #8cd84e;
  --pv-lime-300: #b7f04c;
  --pv-glow: #1b7f52;
  --pv-surface-0: #ffffff;
  --pv-surface-1: #f4f6f5;
  --pv-success-badge-bg: #e6f4ec;
  --pv-radius-card: 16px;
  --pv-surface-2: #ebeeec;
  --pv-ink-900: #14181c;
  --pv-ink-700: #2b3136;
  --pv-ink-500: #5b6570;
  /* Spec #7B8590 is 3.75:1 on white. #6E787D is the lightest nearby grey that meets 4.5:1. */
  --pv-ink-400: #6e787d;
  --pv-ink-sidebar: #dce7df;
  --pv-ink-nav-label: #8fa69a;
  --pv-line: #dfe4e1;
  --pv-success: #1e8a57;
  --pv-warning: #d98e04;
  --pv-danger: #b3261e;
  --pv-info: #1f6f8b;
  --pv-success-tint: #e6f4ec;
  --pv-warning-tint: #f8eedc;
  --pv-danger-tint: #f4e4e2;
  --pv-info-tint: #e4eef2;
  --pv-highlight: #eaf6ee;
  /* Spec 0% #6FBF3F is 2.28:1 with white. #2A7A44 is 5.30:1. */
  --pv-grad-btn: linear-gradient(90deg, #2a7a44 0%, #1e6b3c 45%, #0b3d2c 100%);
  --pv-grad-band: linear-gradient(90deg, #0b3d2c 0%, #146b45 55%, #8cd84e 100%);
  --pv-grad-logo: linear-gradient(135deg, #8cd84e 0%, #146b45 100%);
  --pv-grad-dark-card:
    radial-gradient(120% 120% at 100% 0%, rgba(27, 127, 82, 0.45) 0%, rgba(27, 127, 82, 0) 55%),
    var(--pv-forest-950);
  --pv-font-display: "Plus Jakarta Sans", Inter, sans-serif;
  --pv-font-body: Inter, sans-serif;
  --pv-radius-sm: 10px;
  --pv-radius-md: 20px;
  --pv-radius-lg: 28px;
  --pv-radius-pill: 999px;
  --pv-shadow-1: 0 1px 2px rgba(10, 42, 31, 0.06), 0 4px 14px rgba(10, 42, 31, 0.06);
  --pv-shadow-2: 0 14px 40px rgba(10, 42, 31, 0.14);
  --pv-space: 4px;
  --pv-motion: 160ms ease-out;
  --pv-sidebar: 248px;
  /* Operational views fill the pane beside the sidebar. Login cards keep their own max-width. */
  --pv-content-max: none;
  --pv-logo-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' shape-rendering='geometricPrecision'%3E%3Cpath d='M5 19V10'/%3E%3Cpath d='M10 19V6'/%3E%3Cpath d='M15 19v-6'/%3E%3Cpath d='M13 8l6-5v6'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --pv-motion: 0.01ms;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--pv-surface-1);
}

body {
  margin: 0;
  font-family: var(--pv-font-body);
  background: var(--pv-surface-1);
  color: var(--pv-ink-700);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  font-optical-sizing: none;
  text-rendering: auto;
  font-synthesis: none;
}

h1,
h2,
h3,
h4,
.section-title,
.panel-head h2,
.panel-head h3,
.card h3,
.account-card h4 {
  font-family: var(--pv-font-display);
  color: var(--pv-ink-900);
  letter-spacing: 0;
  line-height: 1.15;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
}

h2,
.panel-head h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--pv-ink-900);
}

h3,
.card h3,
.panel-head h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--pv-green-600);
}

a {
  color: var(--pv-green-600);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--pv-green-600);
  outline-offset: 2px;
}

.money,
.book-amount,
td,
th,
input[type="number"],
input[type="date"] {
  font-variant-numeric: tabular-nums;
}

/* --- Logo tile --- */
.pv-logo-tile {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--pv-grad-logo);
  flex-shrink: 0;
}

.pv-logo-tile::before {
  content: "";
  width: 22px;
  height: 22px;
  background: #fff;
  -webkit-mask: var(--pv-logo-glyph) center / contain no-repeat;
  mask: var(--pv-logo-glyph) center / contain no-repeat;
  shape-rendering: geometricPrecision;
}

.brand {
  font-size: 13px;
  font-weight: 600;
  color: var(--pv-green-600);
  letter-spacing: 0.02em;
}
.tag-outline,
.brand.org-brand,
#appOrgBrand,
.platform-shell .brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0;
  padding: 6px 14px;
  border: 1.5px solid var(--pv-green-600);
  border-radius: var(--pv-radius-pill);
  background: transparent;
  color: var(--pv-green-600);
  font-family: var(--pv-font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.login-card .tag-outline,
.login-card .brand.org-brand {
  margin: 0 0 10px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 18px;
  border: 1.5px solid var(--pv-green-600);
  border-radius: var(--pv-radius-pill);
  background: transparent;
  color: var(--pv-green-600);
  font-family: var(--pv-font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--pv-motion), color var(--pv-motion), border-color var(--pv-motion);
}

.btn:hover {
  text-decoration: none;
}

.btn.primary {
  background: var(--pv-grad-btn);
  border-color: transparent;
  color: #fff;
}

.btn.primary:not(.btn-icon):not(.small):not(:disabled)::after {
  content: "↗";
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.btn-dark,
.btn.btn-dark {
  background: var(--pv-forest-900);
  border-color: var(--pv-forest-900);
  color: #fff;
}

.btn-danger,
.btn.btn-danger {
  background: var(--pv-danger);
  border-color: var(--pv-danger);
  color: #fff;
}

.btn-danger::after,
.btn.btn-danger::after {
  content: none;
}

.btn.link,
.btn.linkish,
.btn-ghost {
  border: none;
  background: transparent;
  color: var(--pv-green-600);
  min-height: 36px;
  padding: 4px 8px;
  box-shadow: none;
}

.btn.small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 15px;
}

.btn.btn-icon,
.logout-btn {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--pv-surface-1);
  color: var(--pv-forest-900);
}

.btn.btn-icon:hover,
.logout-btn:hover {
  background: var(--pv-forest-700);
  color: #fff;
}

.btn:disabled,
.btn.primary:disabled {
  cursor: not-allowed;
  background: #8a9690;
  border-color: #8a9690;
  color: #ffffff;
}

.info-tip {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--pv-surface-1);
  color: var(--pv-ink-700);
  font-family: var(--pv-font-body);
  font-size: 13px;
  font-weight: 600;
  font-style: normal;
}

.info-tip:hover,
.info-tip:focus-visible {
  border-color: transparent;
  color: var(--pv-forest-700);
}

/* --- Inputs --- */
label,
.entry-form label,
.messages-field-label {
  color: var(--pv-ink-700);
  font-size: 13.5px;
  font-weight: 600;
}

.entry-form input,
.entry-form select,
.entry-form textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
select,
textarea,
.app-notice-input {
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--pv-line);
  border-radius: var(--pv-radius-sm);
  background: var(--pv-surface-0);
  color: var(--pv-ink-900);
  font-family: var(--pv-font-body);
  font-size: 15px;
}

::placeholder {
  color: var(--pv-ink-400);
  opacity: 1;
}

.entry-form input:focus,
.entry-form select:focus,
.entry-form textarea:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--pv-green-600);
  outline-offset: 2px;
  border-color: var(--pv-green-600);
  background: var(--pv-surface-0);
  box-shadow: none;
}

.entry-form input[type="file"] {
  width: auto;
  max-width: 100%;
  min-height: 0;
  padding: 8px 0;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--pv-green-600);
  width: 18px;
  height: 18px;
}

.members-former-toggle input[type="checkbox"],
.toggle-row input[type="checkbox"]:not([name="loanPaymentPolicyMode"]) {
  appearance: none;
  width: 44px;
  height: 26px;
  min-height: 26px;
  border-radius: var(--pv-radius-pill);
  background: var(--pv-surface-2);
  border: 1px solid var(--pv-line);
  position: relative;
  cursor: pointer;
}

.members-former-toggle input[type="checkbox"]::after,
.toggle-row input[type="checkbox"]:not([name="loanPaymentPolicyMode"])::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--pv-motion);
}

.members-former-toggle input[type="checkbox"]:checked,
.toggle-row input[type="checkbox"]:not([name="loanPaymentPolicyMode"]):checked {
  background: var(--pv-forest-900);
  border-color: var(--pv-forest-900);
}

.members-former-toggle input[type="checkbox"]:checked::after,
.toggle-row input[type="checkbox"]:not([name="loanPaymentPolicyMode"]):checked::after {
  transform: translateX(16px);
}

/* --- Cards --- */
.card:not(details),
.detail,
.messages-surface,
.flexxforms-catalog-item,
.flexxforms-application-card {
  background: var(--pv-surface-0);
  border: 1px solid var(--pv-line);
  border-radius: var(--pv-radius-card);
  padding: 24px;
  box-shadow: var(--pv-shadow-1);
}

details.card,
details.profile-disclosure {
  background: var(--pv-surface-0);
  border: 1px solid var(--pv-line);
  border-radius: var(--pv-radius-card);
  padding: 0;
  box-shadow: var(--pv-shadow-1);
}

details.card > summary,
details.profile-disclosure > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  margin: 0;
  padding: 0 24px;
  font-family: var(--pv-font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--pv-ink-900);
  cursor: pointer;
}

details.card > summary::-webkit-details-marker,
details.profile-disclosure > summary::-webkit-details-marker,
details.card > summary::marker,
details.profile-disclosure > summary::marker {
  display: none;
  content: none;
}

details.card > summary::after,
details.profile-disclosure > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid var(--pv-ink-700);
  border-bottom: 2px solid var(--pv-ink-700);
  transform: rotate(45deg);
  transition: transform var(--pv-motion);
}

details.card[open] > summary::after,
details.profile-disclosure[open] > summary::after {
  transform: rotate(225deg);
}

details.card > .profile-disclosure-body,
details.profile-disclosure > .profile-disclosure-body {
  padding: 24px;
  border-top: 1px solid var(--pv-line);
}

details.card > summary.import-panel-summary,
details.profile-disclosure > summary.import-panel-summary,
details.profile-disclosure > summary.import-subsection-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.5rem;
  align-items: center;
  justify-content: stretch;
  column-gap: 12px;
  row-gap: 2px;
  padding-top: 10px;
  padding-bottom: 10px;
  text-align: left;
}

.import-panel-title {
  grid-column: 1;
  font-size: 16px;
}

.import-panel-hint {
  grid-column: 1;
  font-family: var(--pv-font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--pv-ink-500);
}

details.card > summary.import-panel-summary > *,
details.profile-disclosure > summary.import-panel-summary > *,
details.profile-disclosure > summary.import-subsection-summary > * {
  pointer-events: none;
}

details.card > summary.import-panel-summary::after,
details.profile-disclosure > summary.import-panel-summary::after,
details.profile-disclosure > summary.import-subsection-summary::after {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: center;
}

.import-panel-section > summary::before,
.import-subsection > summary::before,
details.profile-disclosure > summary::before {
  content: none;
  display: none;
}

.table-wrap,
.login-card,
.account-card,
.my-profile-card,
.book-card,
.app-notice-card,
.ledger-split-modal-card {
  background: var(--pv-surface-0);
  border: 1px solid var(--pv-line);
  border-radius: var(--pv-radius-card);
  box-shadow: var(--pv-shadow-1);
}

.card.accent,
.book-card.accent {
  background: var(--pv-highlight);
  border: 1px solid var(--pv-green-600);
}

.book-card.accent .book-label {
  color: var(--pv-green-600);
}

.book-card.accent .book-amount {
  color: var(--pv-forest-900);
}

.book-card.accent:hover {
  border-color: var(--pv-forest-700);
}

.danger-zone {
  border: 1px solid var(--pv-danger);
  background: var(--pv-danger-tint);
}

.hint,
.subtle,
.book-note,
.account-card-hint {
  color: var(--pv-ink-500);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.hint-line {
  display: block;
}
.hint-line + .hint-line {
  margin-top: 8px;
}

.panel > .hint,
.panel-intro-hint,
.monthly-status-report-body > .subtle,
.platform-check-instructions,
.readonly-banner,
.flexxforms-catalog-head .hint {
  background: var(--pv-surface-1);
  border-radius: 10px;
  border-left: 3px solid var(--pv-green-600);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 400;
  color: var(--pv-ink-700);
}

.readonly-banner {
  background: var(--pv-warning-tint);
  border: 1px solid var(--pv-warning);
  border-left-width: 3px;
  color: #8a5a00;
}

.status.ok {
  color: var(--pv-success);
}

.status.err {
  color: var(--pv-danger);
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
}

.loan-terms-schedule-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
}

.loan-terms-schedule {
  width: 100%;
  min-width: 28rem;
  font-size: 14px;
}

.loan-terms-inbox-card {
  margin: 12px 0 8px;
  padding: 16px;
  border: 1px solid var(--pv-line);
  border-radius: 14px;
  background: var(--pv-surface-0);
}

.loan-terms-inbox-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.loan-terms-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 0 0 16px;
}

.loan-terms-summary div {
  min-width: 0;
}

.loan-terms-summary dt {
  font-size: 12px;
  color: var(--pv-ink-500);
  margin: 0 0 2px;
}

.loan-terms-summary dd {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.loan-terms-inbox-table {
  width: 100%;
  min-width: 0;
  font-size: 15px;
}

.loan-terms-inbox-table th,
.loan-terms-inbox-table td {
  padding: 10px 8px;
  text-align: left;
}

.loan-terms-inbox-table td:last-child,
.loan-terms-inbox-table th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.loan-terms-schedule-heading {
  margin: 4px 0 8px;
  font-size: 14px;
  font-weight: 650;
}

.loan-terms-installments {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  border-top: 1px solid var(--pv-line);
}

.loan-terms-installment {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--pv-line);
}

.loan-terms-installment-date {
  font-size: 15px;
  font-weight: 650;
  min-width: 0;
}

.loan-terms-installment-payment {
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.loan-terms-installment-split {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 500;
  color: var(--pv-ink-500);
  line-height: 1.4;
}

.loan-terms-inbox-actions,
.loan-plan-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.loan-lot-actions .loan-plan-download-actions,
.panel-head-actions .loan-plan-download-actions {
  margin-top: 0;
}

.messages-bubble-body table {
  width: 100%;
  margin: 10px 0 0;
  font-size: 15px;
}

.messages-bubble-body th,
.messages-bubble-body td {
  padding: 8px 6px;
  text-align: left;
}

.messages-bubble-body td:last-child,
.messages-bubble-body th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.flexxforms-application-card.loan-terms-accepted {
  border-color: var(--pv-green-600);
}

table {
  font-variant-numeric: tabular-nums;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--pv-surface-2);
  color: var(--pv-ink-500);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td {
  color: var(--pv-ink-700);
  font-size: 14px;
  font-weight: 400;
}

td.money,
.money,
.book-amount,
.account-balance {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

td,
th {
  padding: 16px 14px;
  border-bottom: 1px solid var(--pv-line);
  height: 52px;
}

tr:hover td {
  background: var(--pv-surface-2);
}

td:last-child .btn {
  min-height: 36px;
}

@media (max-width: 768px) {
  th:first-child,
  td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--pv-surface-0);
  }
}

#panel-loans table {
  min-width: 70rem;
}

#panel-loans th.loan-id-col,
#panel-loans th:first-child,
#panel-loans td.loan-id-cell {
  white-space: nowrap;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--pv-radius-pill);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  background: var(--pv-surface-1);
  color: var(--pv-ink-700);
}

.badge.ok,
.subscription-active,
.badge.subscription-active {
  background: var(--pv-success-badge-bg);
  color: var(--pv-green-600);
}

.badge.warn,
.subscription-warning,
.badge.subscription-warning {
  background: var(--pv-warning-tint);
  color: #8a5a00;
}

.badge.err,
.badge.danger {
  background: var(--pv-danger-tint);
  color: var(--pv-danger);
}

.subscription-info,
.badge.subscription-info {
  background: var(--pv-info-tint);
  color: var(--pv-info);
}

.subscription-muted,
.badge.subscription-muted {
  background: var(--pv-surface-1);
  color: var(--pv-ink-700);
}

.tab-attention-badge,
.messages-unread-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 50%;
  background: var(--pv-forest-900);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.tab-attention-badge.hidden,
.tab .tab-attention-badge:is(:empty),
.tab-attention-badge[data-count="0"] {
  background: var(--pv-ink-500);
}

/* --- Books --- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.book-card {
  padding: 20px;
  text-align: left;
  cursor: pointer;
  transition: box-shadow var(--pv-motion), border-color var(--pv-motion);
}

.book-card:hover {
  border-color: var(--pv-line);
  box-shadow: var(--pv-shadow-1);
}

.book-card:focus-visible {
  outline: 2px solid var(--pv-green-600);
  outline-offset: 2px;
}

.book-label {
  min-height: calc(1.35em * 2);
  margin: 0 0 8px;
  color: var(--pv-ink-500);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.35;
}

.book-amount {
  margin: 0;
  color: var(--pv-ink-900);
  font-family: var(--pv-font-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.book-note {
  margin: 8px 0 0;
  min-height: calc(1.5em * 2);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

.book-card.reconcile-warn {
  border-color: var(--pv-warning);
  background: var(--pv-warning-tint);
}

/* --- Shell --- */
.app {
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--pv-surface-1);
}

#appShell.app {
  display: grid;
  grid-template-columns: var(--pv-sidebar) minmax(0, 1fr);
}

#appShell.member-portal,
#platformShell.app {
  display: block;
}

.app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 24px 20px 0;
  background: var(--pv-forest-950);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
  color: #ffffff;
  font-family: var(--pv-font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.sidebar-org {
  margin-top: auto;
  min-height: 56px;
  padding: 16px 12px;
  color: #dce7df;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  border-top: 1px solid #1a4336;
}

#appShell.member-portal .app-sidebar {
  display: none;
}

.app-main {
  min-width: 0;
  padding: 0;
}

.app-content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 32px 40px;
}

.app-content > .panel,
.platform-panel {
  max-width: none;
  margin: 0;
  padding-top: 0;
}

.panel.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.entry-form {
  gap: 16px;
}

.entry-form label,
.field-row {
  gap: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  justify-content: space-between;
  align-items: center;
  column-gap: 16px;
  row-gap: 10px;
  min-height: 0;
  margin: 0 0 28px;
  padding: 28px 0 20px;
  background: var(--pv-surface-1);
  border: none;
  border-bottom: 1px solid var(--pv-line);
  border-radius: 0;
  box-shadow: none;
}

.topbar-titles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.topbar-titles .tag-outline,
.topbar-titles .brand.org-brand,
.topbar-titles #appOrgBrand {
  margin: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  color: var(--pv-ink-900);
}

#appOrgSubtitle,
#platformSubtitle {
  margin: 0;
  color: var(--pv-ink-500);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.topbar-subtitle {
  flex-basis: 100%;
  order: 3;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
  flex-shrink: 1;
  min-width: 0;
  padding-bottom: 2px;
}

.session-role {
  flex-shrink: 0;
  font-weight: 400;
  color: var(--pv-ink-500);
  margin-right: 4px;
}

.session-user {
  margin: 0;
  color: var(--pv-ink-700);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.session-role:empty,
.session-user:empty {
  display: none;
}

/* Tabs: sidebar on desktop, pills below 1024px */
#appShell .tabs {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
  overflow: visible;
  padding: 0;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.nav-group-label {
  margin: 20px 12px 6px;
  color: #8fa69a;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-group:first-child .nav-group-label {
  margin-top: 0;
}

.nav-group:not(:has(.tab:not(.hidden))) {
  display: none;
}

#appShell .tab {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--pv-radius-pill);
  background: transparent;
  color: #dce7df;
  font-family: var(--pv-font-body);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

#appShell .tab:hover {
  background: #14382c;
  color: #ffffff;
}

#appShell .tab.active {
  background: var(--pv-lime-300);
  color: var(--pv-forest-950);
  font-weight: 700;
}

#appShell .tab.active .tab-attention-badge {
  background: var(--pv-forest-950);
  color: #fff;
}

.platform-shell .tabs,
.member-portal #mainTabs {
  display: none;
}

.panel-head {
  align-items: center;
  margin-bottom: 8px;
}

.panel-head h2 {
  color: var(--pv-ink-900);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.books-detail-view-tabs,
.messages-audience-seg,
.messages-folder-seg {
  display: flex;
  gap: 8px;
  margin: 8px 0 16px;
  border-bottom: 1px solid var(--pv-line);
}

.books-detail-view-tabs [data-book-view],
.messages-audience-option,
.messages-folder-btn {
  padding: 8px 4px;
  border: none;
  background: none;
  color: var(--pv-ink-500);
  border-bottom: 2px solid transparent;
}

.books-detail-view-tabs [data-book-view].active,
.messages-audience-option:has(input:checked),
.messages-folder-btn.active {
  color: var(--pv-green-600);
  border-bottom-color: var(--pv-green-600);
  font-weight: 700;
}

.btn.link,
.btn.linkish,
.btn-ghost {
  border: none;
  background: transparent;
  color: var(--pv-green-600);
  min-height: 32px;
  height: 32px;
  padding: 4px 8px;
  box-shadow: none;
  text-decoration: none;
}

.cooperative-meeting-actions,
.email-audit-view {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.email-notice-copy {
  margin: 0 0 1rem;
}

.email-notice-copy-card {
  border: 1px solid var(--pv-line);
  background: var(--pv-surface-0);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.email-notice-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  margin: 8px 0 0;
  overflow: auto;
  max-height: 240px;
}

body.email-notice-standalone #appShell.app {
  grid-template-columns: minmax(0, 1fr);
}

body.email-notice-standalone .app-sidebar,
body.email-notice-standalone #mainTabs,
body.email-notice-standalone #adminMembershipAppsNag,
body.email-notice-standalone .panel:not(#panel-email-notice) {
  display: none !important;
}

body.email-notice-standalone .app-main {
  margin-left: 0;
}

body.email-notice-standalone #panel-email-notice {
  display: flex;
}

body.email-notice-standalone .email-notice-body {
  max-height: none;
  overflow: visible;
}

.sep {
  display: none;
}

/* --- File lists --- */
.file-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  height: auto;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--pv-surface-0);
  border: 1px solid var(--pv-line);
  border-radius: 10px;
}

.file-list li:hover {
  background: var(--pv-surface-1);
  border-color: var(--pv-line);
}

.file-list li.selected {
  background: var(--pv-highlight);
  border-color: var(--pv-green-600);
}

.file-list li .badge,
#appShell .file-list li .badge {
  background: var(--pv-surface-1);
  color: var(--pv-ink-700);
}

.file-list li .badge.ok,
#appShell .file-list li .badge.ok {
  background: var(--pv-success-badge-bg);
  color: var(--pv-green-600);
}

.file-list li .badge.warn,
#appShell .file-list li .badge.warn {
  background: var(--pv-warning-tint);
  color: #8a5a00;
}

.file-list li .badge.err,
#appShell .file-list li .badge.err {
  background: var(--pv-danger-tint);
  color: var(--pv-danger);
}

.file-list-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background: var(--pv-green-600);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.file-list-name {
  flex: 1;
  min-width: 0;
  color: var(--pv-ink-900);
  font-size: 14px;
}

.file-list-go {
  color: var(--pv-green-600);
  font-size: 14px;
  font-weight: 700;
}

.cooperative-meetings-list .cooperative-meeting-item {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(0, 1.4fr) auto;
  gap: 16px;
  align-items: start;
  min-height: 48px;
  height: auto;
  cursor: default;
}

.meeting-zone-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.meeting-zone-title strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--pv-ink-900);
}

.meeting-zone-meta {
  min-width: 0;
}

.meeting-zone-meta .subtle {
  font-size: 14px;
  color: var(--pv-ink-500);
}

.cooperative-meeting-agenda {
  margin-top: 4px;
  font-size: 14px;
  color: var(--pv-ink-700);
  white-space: pre-wrap;
}

@media (max-width: 899px) {
  .cooperative-meetings-list .cooperative-meeting-item {
    grid-template-columns: 1fr;
  }
}

.file-dropzone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  padding: 16px;
  background: var(--pv-surface-1);
  border: 1.5px dashed var(--pv-green-600);
  border-radius: 12px;
}

.card form {
  align-items: stretch;
  width: 100%;
}

.card .entry-form {
  flex-wrap: nowrap;
  flex-direction: column;
  width: 100%;
}

.entry-form > label,
.entry-form > .field-row,
.entry-form > .panel-head-actions {
  width: 100%;
  min-width: 0;
}

.entry-form .field-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.entry-form select {
  width: 100%;
  min-width: 0;
}

label.toggle-row,
.entry-form label.toggle-row {
  flex-direction: row;
  align-items: flex-start;
  font-weight: 500;
}

#panel-users .record-grid,
#panel-maintenance .record-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

@media (min-width: 960px) {
  #panel-users .record-grid,
  #panel-maintenance .record-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

#panel-users .record-grid > .card,
#panel-maintenance .record-grid > .card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

#panel-users .record-grid > .card > h3,
#panel-maintenance .record-grid > .card > h3,
#panel-users .record-grid > .card > p,
#panel-maintenance .record-grid > .card > p {
  margin: 0;
}

#panel-users .record-grid .panel-head-actions,
#panel-maintenance .record-grid .panel-head-actions {
  margin: 0;
  flex-wrap: wrap;
}

#panel-users .record-grid .panel-head-actions .btn,
#panel-maintenance .record-grid .panel-head-actions .btn {
  flex: 1 1 16rem;
  white-space: nowrap;
}

#panel-users .record-grid .status,
#panel-maintenance .record-grid .status {
  margin-top: 0;
}

.visually-hidden-file,
.file-dropzone input.visually-hidden-file,
.entry-form input.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  min-height: 0;
  max-width: none;
  pointer-events: none;
}

.hint code,
.subtle code,
.panel p code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 400;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--pv-ink-700);
  background: var(--pv-surface-2);
}

/* --- Login --- */
.login-screen {
  min-height: 100vh;
  display: block;
  padding: 16px;
  background: var(--pv-surface-0);
}

.login-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100vh - 32px);
  gap: 0;
}

.login-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  padding: 20px 22px;
  border-radius: var(--pv-radius-lg);
  background: var(--pv-grad-dark-card);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.login-brand-panel::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -30px;
  width: 220px;
  height: 220px;
  opacity: 0.08;
  background: var(--pv-logo-glyph) center / contain no-repeat;
  pointer-events: none;
}

.login-brand-top {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.login-brand-wordmark {
  margin: 0;
  font-family: var(--pv-font-display);
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.login-brand-copy {
  position: relative;
  z-index: 1;
}

.login-brand-heading {
  margin: 12px 0 8px;
  color: #fff;
  font-family: var(--pv-font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

.login-brand-sub {
  margin: 0;
  color: #dce7df;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
}

.login-brand-links {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  color: var(--pv-lime-300);
  font-size: 14px;
  font-weight: 600;
}

.login-brand-links a {
  color: var(--pv-lime-300);
}

.login-card {
  width: 100%;
  max-width: 460px;
  margin: 24px auto;
  padding: 28px;
  border: none;
  border-radius: var(--pv-radius-lg);
  box-shadow: var(--pv-shadow-1);
}

.login-card.flexxforms-apply-card {
  max-width: 960px;
}

.login-card > .brand {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.login-card .btn.primary {
  width: 100%;
}

.register-name-confirm,
.register-details-after-name {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.register-name-confirm-prompt {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--pv-ink-700);
}

.register-name-confirm-value {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--pv-line);
  border-radius: var(--pv-radius-sm);
  background: var(--pv-surface-1);
  font-size: 16px;
  font-weight: 600;
  color: var(--pv-ink-900);
  word-break: break-word;
}

.register-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.register-step-actions .btn,
.login-card .register-step-actions .btn.primary {
  width: auto;
  flex: 1 1 140px;
  margin-top: 0;
}

#registerOrgSlug[readonly] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
  background: var(--pv-surface-1);
}

.login-foot a[href="/register"],
.login-foot a[href="/admin"] {
  display: inline-flex;
  margin-top: 4px;
}

@media (min-width: 1024px) {
  .login-layout {
    grid-template-columns: 48% 52%;
    align-items: stretch;
  }

  .login-brand-panel {
    min-height: calc(100vh - 32px);
    padding: 32px;
  }

  .login-brand-heading {
    font-size: 44px;
  }

  .login-card {
    margin: auto;
  }

  .login-card > .brand,
  .login-card > h1,
  .login-card > .org-subtitle,
  .login-card > h1 + .subtle {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .login-card .public-org-links {
    display: none;
  }
}

@media (max-width: 1023px) {
  .login-brand-links {
    display: none;
  }

  .login-brand-copy {
    display: none;
  }
}

/* --- Record index --- */
.record-workspace {
  display: grid;
  gap: 20px;
}

.record-grid {
  min-width: 0;
}

.record-index {
  display: none;
}

#panel-record .record-recent .table-wrap {
  width: 100%;
  overflow-x: auto;
}

#panel-record .record-recent table {
  min-width: 36rem;
}

@media (min-width: 1200px) {
  .record-workspace {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
  }

  .record-index {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 92px;
  }

  .record-workspace > .record-recent {
    grid-column: 2;
    min-width: 0;
  }

  .record-index a {
    display: flex;
    align-items: center;
    height: 58px;
    padding: 0 10px;
    border-radius: var(--pv-radius-sm);
    color: var(--pv-ink-700);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
  }

  .record-index a:hover {
    background: var(--pv-surface-1);
    color: var(--pv-green-600);
  }
}

/* Members & Accounts: the panel scrolls with the page like every other
   tab (header, hints, and search scroll up out of the way) so the full
   member list is reachable with normal page scrolling. */
#panel-members.active {
  gap: 12px;
}

#panel-members .members-layout {
  grid-template-columns: minmax(0, 1fr);
}

#panel-members:not(.member-detail-open) .member-profile-pane {
  display: none;
}

#panel-members.member-detail-open .members-list-pane,
#panel-members.member-detail-open .members-search-row,
#panel-members.member-detail-open > .hint {
  display: none;
}

.member-detail-bar {
  margin-bottom: 12px;
}

.members-list-pane,
.member-profile-pane {
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.members-list-pane {
  background: var(--pv-surface-0);
  border: 1px solid var(--pv-line);
  border-radius: var(--pv-radius-card);
  box-shadow: var(--pv-shadow-1);
}

.members-list-pane .table-wrap {
  overflow-x: auto;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.members-list-pane table {
  width: 100%;
  min-width: 32rem;
}

.members-list-pane th,
.members-list-pane td {
  height: auto;
  padding: 10px 8px;
  vertical-align: middle;
}

.members-list-pane th {
  white-space: normal;
  line-height: 1.25;
  letter-spacing: 0.05em;
  font-size: 12.5px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.members-list-pane th:last-child,
.members-list-pane td:last-child {
  white-space: nowrap;
}

.member-profile-pane {
  max-height: none;
  min-height: 0;
  padding: 16px;
}

.member-profile-pane .profile-card {
  gap: 16px;
}

.member-profile-pane .profile-header {
  gap: 16px;
  flex-wrap: wrap;
}

.member-profile-pane .profile-photo-wrap {
  flex: 0 0 auto;
  max-width: none;
}

.member-profile-pane .profile-photo {
  width: 120px;
  height: 120px;
}

.member-profile-pane .profile-photo-upload input[type="file"] {
  max-width: 220px;
}

.member-profile-pane .profile-photo-upload .profile-photo-submit-btn {
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  padding: 8px 18px;
}

.member-profile-pane .profile-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
  flex: 1 1 16rem;
}

.member-profile-pane .profile-summary h3,
.member-profile-pane .profile-summary > p {
  flex: 1 1 100%;
}

.member-profile-pane .profile-summary .btn {
  flex: 0 1 auto;
  width: auto;
}

.member-profile-pane .account-cards {
  grid-template-columns: 1fr 1fr;
  margin: 0;
  gap: 12px;
}

.member-profile-pane .account-card {
  padding: 14px;
}

.member-profile-pane .account-card-hint {
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}

@media (max-width: 1200px) {
  #appShell.app:has(#panel-members.active) {
    height: auto;
    overflow: visible;
  }

  #appShell.app:has(#panel-members.active) .app-main,
  #appShell.app:has(#panel-members.active) .app-content {
    overflow: visible;
    height: auto;
  }

  #panel-members.active {
    flex: none;
  }

  #panel-members .members-layout {
    grid-template-columns: 1fr;
    flex: none;
  }

  .members-list-pane,
  .member-profile-pane {
    overflow: visible;
    max-height: none;
  }

  .members-list-pane .table-wrap {
    overflow-x: auto;
  }
}

.record-section .entry-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  .record-section .entry-form {
    grid-template-columns: 1fr 1fr;
  }

  .record-section .entry-form > button[type="submit"],
  .record-section .entry-form > .hint,
  .record-section .entry-form > p {
    grid-column: 1 / -1;
  }
}

/* --- Subscription plans --- */
.subscription-plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 20px 0 12px;
}

@media (min-width: 900px) {
  .subscription-plan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.subscription-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 22px 22px;
  background: var(--pv-surface-0);
  border: 1px solid var(--pv-line);
  border-radius: var(--pv-radius-md);
  box-shadow: var(--pv-shadow-1);
}

.subscription-plan-card::before {
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pv-forest-700);
  -webkit-mask: none;
  margin-bottom: 4px;
  box-shadow: inset 0 0 0 10px var(--pv-forest-700);
  background-image: var(--pv-logo-glyph);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 22px;
}

.subscription-plan-card .tag-outline {
  margin-bottom: 0;
}

.subscription-plan-card .btn.primary {
  width: 100%;
  margin-top: auto;
}

.subscription-extra-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* --- Policy option cards --- */
.policy-option-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  margin: 8px 0;
  background: var(--pv-surface-1);
  border: 2px solid transparent;
  border-radius: var(--pv-radius-md);
  cursor: pointer;
}

.policy-option-card:has(input:checked) {
  border-color: var(--pv-green-600);
  background: var(--pv-highlight);
}

/* --- Messages toolbar --- */
.messages-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--pv-surface-1);
  border-radius: var(--pv-radius-pill);
  border-bottom: none;
}

.messages-format-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--pv-ink-700);
}

.messages-format-btn:hover,
.messages-format-btn:focus-visible {
  background: #fff;
  border-color: transparent;
}

.messages-format-btn:active,
.messages-format-btn.is-active {
  background: var(--pv-forest-900);
  color: #fff;
}

.messages-format-btn-wide {
  width: auto;
  border-radius: var(--pv-radius-pill);
  padding: 0 12px;
}

/* --- Modals --- */
.app-notice-modal,
.ledger-split-modal {
  background: rgba(10, 42, 31, 0.5);
}

.app-notice-card,
.ledger-split-modal-card {
  max-width: 560px;
  border: none;
  border-radius: var(--pv-radius-lg);
  box-shadow: var(--pv-shadow-2);
}

.app-notice-title {
  color: var(--pv-green-600);
  font-family: var(--pv-font-display);
  font-weight: 700;
}

.app-toast.variant-success {
  border-color: var(--pv-success);
}

.app-toast.variant-danger {
  border-color: var(--pv-danger);
}

.app-toast.variant-warning {
  border-color: var(--pv-warning);
}

.app-toast.variant-info {
  border-color: var(--pv-info);
}

.app-toast.variant-success .app-toast-icon {
  background: var(--pv-success-tint);
  color: var(--pv-success);
}

.app-toast.variant-danger .app-toast-icon {
  background: var(--pv-danger-tint);
  color: var(--pv-danger);
}

.app-toast.variant-warning .app-toast-icon {
  background: var(--pv-warning-tint);
  color: var(--pv-warning);
}

.app-toast.variant-info .app-toast-icon {
  background: var(--pv-info-tint);
  color: var(--pv-info);
}

.account-card {
  padding: 20px;
}

.account-card h4 {
  color: var(--pv-green-600);
}

.account-card.selected {
  border-color: var(--pv-green-600);
  box-shadow: 0 0 0 2px var(--pv-green-600);
}

.flexxforms-catalog {
  background: var(--pv-surface-1);
  border: none;
  border-radius: var(--pv-radius-md);
}

.flexxforms-catalog-head h4 {
  color: var(--pv-green-600);
}

.flexxforms-assign-btn.is-linked {
  border-color: var(--pv-green-600);
  background: var(--pv-success-tint);
  color: var(--pv-green-600);
}

.admin-attention-nag-btn {
  background: var(--pv-highlight);
  border: 1px solid var(--pv-green-600);
  color: var(--pv-forest-900);
  border-radius: var(--pv-radius-pill);
}

.preview,
.monthly-status-performance-overview {
  background: var(--pv-surface-1);
  border: 1px solid var(--pv-line);
  color: var(--pv-ink-700);
}

/* --- Public shell inside SPA --- */
.public-shell {
  background: var(--pv-surface-0);
}

.public-header {
  max-width: 960px;
  margin: 16px auto 0;
  padding: 12px 22px;
  background: #fff;
  border-radius: var(--pv-radius-pill);
  box-shadow: var(--pv-shadow-2);
}

.public-main {
  max-width: 760px;
}

.public-article,
.public-bylaws {
  border: none;
  border-radius: var(--pv-radius-md);
  box-shadow: var(--pv-shadow-1);
}

/* --- Mobile shell --- */
@media (max-width: 1023px) {
  #appShell.app {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: relative;
    height: auto;
    max-height: none;
    padding: 12px;
    background: var(--pv-surface-0);
  }

  .sidebar-brand {
    color: var(--pv-ink-900);
    margin: 4px 4px 12px;
  }

  .sidebar-org {
    color: var(--pv-ink-700);
    border-top-color: var(--pv-line);
  }

  .nav-group-label {
    display: none;
  }

  .nav-group {
    flex-direction: row;
    flex-wrap: wrap;
    margin: 0;
  }

  #appShell .tabs {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  #appShell .tab {
    width: auto;
    background: #fff;
    border: 1px solid var(--pv-line);
    color: var(--pv-ink-700);
  }

  #appShell .tab.active {
    background: var(--pv-grad-btn);
    border-color: transparent;
    color: #fff;
  }

  .topbar {
    border-radius: 0;
    align-items: center;
    padding-top: 20px;
  }

  .app-content {
    padding: 0 20px 32px;
  }

  .topbar h1 {
    font-size: 22px;
  }
}

@media (max-width: 640px) {
  .loan-terms-schedule {
    min-width: 22rem;
    font-size: 13px;
  }

  .loan-terms-schedule th,
  .loan-terms-schedule td {
    padding: 8px 6px;
    white-space: nowrap;
  }

  .loan-terms-summary {
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
  }

  .loan-terms-inbox-card {
    padding: 14px;
  }

  .card:not(details) {
    padding: 18px;
  }

  details.card > summary,
  details.profile-disclosure > summary {
    padding-left: 16px;
    padding-right: 16px;
  }

  details.card > .profile-disclosure-body,
  details.profile-disclosure > .profile-disclosure-body {
    padding: 16px;
  }

  #appOrgSubtitle {
    display: none;
  }

  .session-user {
    display: block;
    white-space: nowrap;
  }

  .session-user-name {
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
}

/* Crisp type floor: raise leftover styles.css sizes. Layout rules unchanged. */
.photo-caption,
.loan-lot-summary-meta,
.progress-text,
.progress-member,
.statement-browse,
.login-foot,
.status,
.flexxforms-catalog-item-id,
.messages-thread-item-meta,
.messages-bubble-meta {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.status,
.photo-caption,
.loan-lot-summary-meta,
.progress-text,
.progress-member,
.statement-browse,
.login-foot,
.messages-thread-item-meta,
.messages-bubble-meta {
  color: var(--pv-ink-500);
}

.status.ok {
  color: var(--pv-success);
}

.status.err {
  color: var(--pv-danger);
}

.member-number {
  font-size: 14px;
  font-weight: 500;
  color: var(--pv-ink-700);
  font-variant-numeric: tabular-nums;
}

.account-balance {
  font-family: var(--pv-font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--pv-ink-900);
  font-variant-numeric: tabular-nums;
}

.info-tip::after {
  font-family: var(--pv-font-body);
  font-size: 14px;
  font-weight: 400;
  font-style: normal;
  color: #ffffff;
}

.profile-grid dt {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--pv-ink-500);
}

.profile-grid dd,
.profile-grid p {
  font-size: 14px;
  font-weight: 400;
  color: var(--pv-ink-700);
}

.messages-field-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--pv-ink-700);
}

.messages-format-btn-wide {
  font-size: 13px;
  font-weight: 600;
}

input::placeholder,
textarea::placeholder {
  color: var(--pv-ink-400);
}

::-webkit-input-placeholder {
  color: var(--pv-ink-400);
  opacity: 1;
}
