/* DVRA internal app — visual tone aligned with w2zq.com (club navy, warm paper) */

:root {
  --color-header-top: #2b4c7e;
  --color-header-bottom: #1a365d;
  --color-accent: #c05621;
  --color-accent-hover: #9a3412;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-border: #cbd5e1;
  --color-panel: #fffdf8;
  /* Alternate table rows — light blue stripe, visibly distinct from warm panel */
  --color-table-stripe: #a8cff2;
  --color-page: #f4f1ea;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: var(--font-sans);
  --font-ui: var(--font-sans);

  /*
   * Sort triangle — matches Tabulator 6.x defaults (members grid); reused on payment report.
   * Geometry: border-top = arrow points down; border-bottom = arrow points up.
   */
  --dvra-sorter-arrow-size: 6px;
  --dvra-sorter-arrow-muted: #bbb;
  --dvra-sorter-arrow-active: #666;
  --dvra-sorter-arrow-hover: #555;
}

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

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-page);
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.site-header {
  position: relative;
  flex: 0 0 auto;
  z-index: 1000;
  background: linear-gradient(180deg, var(--color-header-top) 0%, var(--color-header-bottom) 100%);
  color: #f8fafc;
  padding: 0.75rem 1rem 1rem;
  border-bottom: 4px solid var(--color-accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.site-header-brand-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.site-header-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  /* PNG with alpha: gold-tinted artwork (`/static/w2zq-site-icon-gold.png`). */
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.4));
}

.site-header-title-block {
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

.site-header-brand-row h1 {
  display: inline;
  margin: 0;
  max-width: 100%;
  min-width: 0;
  font-size: clamp(1.05rem, 2.8vw + 0.6rem, 1.65rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.site-header-version {
  display: inline-block;
  margin: 0 0 0 0.75rem;
  vertical-align: baseline;
  white-space: nowrap;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #d6dee8;
}

.site-header-brand-row h1 a {
  color: #fff;
  text-decoration: none;
}

.site-header-brand-row h1 a:hover {
  color: #fed7aa;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.site-nav > a {
  color: #e2e8f0;
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
}

.site-nav > a:hover {
  color: #fff;
  border-bottom-color: #fdba74;
  text-decoration: none;
}

.site-nav > a.active {
  color: #fff;
  border-bottom-color: #fdba74;
}

.logout-form {
  margin: 0 0 0 auto;
}

.logout-form button {
  font-family: var(--font-ui);
  cursor: pointer;
  background: transparent;
  color: #e2e8f0;
  border: 1px solid #64748b;
  border-radius: 4px;
  padding: 0.35rem 0.65rem;
}

.logout-form button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #94a3b8;
}

.dialog-close-corner-form {
  display: flex;
  justify-content: flex-end;
  margin: 0;
}

.dialog-close-corner-btn {
  border: none;
  background: transparent;
  color: var(--color-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
}

.dialog-close-corner-btn:hover {
  color: var(--color-header-bottom);
}

.site-main {
  flex: 1 1 auto;
  margin: 0 auto;
  padding: 1.25rem 1rem 1rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.standard-page-scroll {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: visible;
  overflow-x: hidden;
  padding-bottom: 0.5rem;
}

.grid-page {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
  height: auto;
}

.grid-page-top {
  flex: 0 0 auto;
  min-height: 0;
}

.grid-page-body {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

h2,
h3 {
  font-weight: 600;
  color: var(--color-header-bottom);
}

h2 {
  margin-top: 0;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.35rem;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-panel);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  box-shadow: none;
}

.data-table-scroll {
  width: 100%;
  height: 100%;
  max-height: min(75vh, 48rem);
  overflow: auto;
  margin-bottom: 0.75rem;
}

.data-table-scroll .data-table {
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

/* Payment report only: initial autofit (JS sets col widths), then fixed layout + drag handles */
.data-table-scroll .data-table.payments-report-table:not(.payments-report-table--columns-sized) {
  width: max-content;
  max-width: none;
  table-layout: auto;
}

.data-table-scroll .data-table.payments-report-table.payments-report-table--columns-sized {
  table-layout: fixed;
  width: auto;
}

.data-table-scroll .data-table.payments-report-table thead th .col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  margin-right: -2px;
  cursor: col-resize;
  z-index: 4;
  background: transparent;
}

.data-table-scroll .data-table.payments-report-table thead th .col-resize-handle:hover {
  background: rgba(192, 86, 33, 0.18);
}

.data-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e2e8f0;
  box-shadow: 0 1px 0 var(--color-border);
  border-right: 1px solid var(--color-border);
}

.data-table th,
.data-table td {
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: none;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table thead {
  background: #e2e8f0;
  color: #0f172a;
}

/* Match Tabulator header typography on static report tables */
.data-table thead th {
  font-weight: 600;
  letter-spacing: 0.01em;
}

/*
 * Payment report sort headers — match Tabulator: title text left, sorter glyphs in a pill to the right
 * (not “Payment date↑” as one linked string).
 */
.data-table thead th.report-sort-th {
  padding: 0;
  vertical-align: middle;
}

.data-table thead th.report-sort-th form.report-sort-form {
  margin: 0;
  padding: 0;
  width: 100%;
}

.data-table thead th.report-sort-th .report-sort-hit,
.data-table thead th.report-sort-th form.report-sort-form button.report-sort-hit {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  box-sizing: border-box;
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
  width: 100%;
  margin: 0;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.data-table thead th.report-sort-th form.report-sort-form button.report-sort-hit {
  border: none;
  background: transparent;
  font: inherit;
  text-align: inherit;
}

.data-table thead th.report-sort-th .report-sort-label {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  white-space: normal;
}

.data-table thead th.report-sort-th .report-sort-sorter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--dvra-sorter-arrow-size) * 3);
  line-height: 0;
}

/* Hover / focus styling for payment headers — arrows use shared DVRA_SORTER_ARROW block below */

.data-table thead th.report-sort-th .report-sort-hit:hover,
.data-table thead th.report-sort-th form.report-sort-form button.report-sort-hit:hover {
  background: rgba(255, 255, 255, 0.45);
  color: var(--color-header-bottom);
  text-decoration: none;
}

.data-table thead th.report-sort-th .report-sort-hit:hover .report-sort-label,
.data-table thead th.report-sort-th form.report-sort-form button.report-sort-hit:hover .report-sort-label {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.data-table thead th.report-sort-th .report-sort-hit:focus-visible,
.data-table thead th.report-sort-th form.report-sort-form button.report-sort-hit:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
  border-radius: 2px;
}

/* Paint cells (not only <tr>): some engines don’t reliably show row background with border-collapse: separate */
.data-table tbody tr:nth-child(odd) td {
  background-color: var(--color-panel);
}

.data-table tbody tr:nth-child(even) td {
  background-color: var(--color-table-stripe);
}

.members-tabulator-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.members-tabulator-wrap,
.data-table-scroll {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-panel);
}

/* Do not set height (!important): Tabulator writes inline heights for Virtual DOM scrolling */
.members-tabulator-wrap.tabulator {
  flex: 1 1 auto;
  min-height: 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  border: none;
}

.members-tabulator-wrap.tabulator .tabulator-header {
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col {
  border-right: 1px solid var(--color-border);
}

.members-tabulator-wrap.tabulator .tabulator-row .tabulator-cell {
  border-right: 1px solid var(--color-border);
}

/* Members grid: sortable column headers match payment report (label left, sorter pill right, same hit target feel) */
.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable {
  padding: 0;
  vertical-align: middle;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  box-sizing: border-box;
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
  width: 100%;
  margin: 0;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title-holder {
  flex: 1 1 auto;
  min-width: min-content;
  text-align: left;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title {
  font-weight: 600;
  white-space: nowrap;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-sorter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--dvra-sorter-arrow-size) * 3);
  line-height: 0;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover .tabulator-col-content {
  background: rgba(255, 255, 255, 0.45);
  color: var(--color-header-bottom);
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover .tabulator-col-title {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable:focus-within .tabulator-col-content {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
  border-radius: 2px;
}

/*
 * Single caret visuals for Tabulator column sorters AND payment-report HTML (Tabulator CDN loads after style.css —
 * selectors are scoped with .members-tabulator-wrap.tabulator … to beat defaults).
 *
 * Mirrors Tabulator 6 defaults: idle + ascending = border-bottom triangle (tip up);
 * descending = border-top triangle (tip down). Colors #bbb → #666, hover #555.
 */
.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-content .tabulator-col-sorter .tabulator-arrow,
.dvra-sorter-arrow {
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border-left: var(--dvra-sorter-arrow-size) solid transparent;
  border-right: var(--dvra-sorter-arrow-size) solid transparent;
  box-sizing: content-box;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort='none'] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow,
.data-table thead th.report-sort-th:not([aria-sort]) .report-sort-hit .dvra-sorter-arrow,
.data-table thead th.report-sort-th:not([aria-sort]) form.report-sort-form button.report-sort-hit .dvra-sorter-arrow {
  border-bottom: var(--dvra-sorter-arrow-size) solid var(--dvra-sorter-arrow-muted);
  border-top: none;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort='ascending'] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow,
.data-table thead th.report-sort-th[aria-sort='ascending'] .report-sort-hit .dvra-sorter-arrow,
.data-table thead th.report-sort-th[aria-sort='ascending'] form.report-sort-form button.report-sort-hit .dvra-sorter-arrow {
  border-bottom: var(--dvra-sorter-arrow-size) solid var(--dvra-sorter-arrow-active);
  border-top: none;
}

.members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort='descending'] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow,
.data-table thead th.report-sort-th[aria-sort='descending'] .report-sort-hit .dvra-sorter-arrow,
.data-table thead th.report-sort-th[aria-sort='descending'] form.report-sort-form button.report-sort-hit .dvra-sorter-arrow {
  border-bottom: none;
  border-top: var(--dvra-sorter-arrow-size) solid var(--dvra-sorter-arrow-active);
}

@media (hover: hover) and (pointer: fine) {
  .members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
    cursor: pointer;
  }

  .members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort='none']:hover .tabulator-col-content .tabulator-col-sorter .tabulator-arrow,
  .members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort='ascending']:hover .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
    border-bottom-color: var(--dvra-sorter-arrow-hover);
    border-top: none;
  }

  .members-tabulator-wrap.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort='descending']:hover .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
    border-top-color: var(--dvra-sorter-arrow-hover);
    border-bottom: none;
  }

  .data-table thead th.report-sort-th:not([aria-sort]) .report-sort-hit:hover .dvra-sorter-arrow,
  .data-table thead th.report-sort-th[aria-sort='ascending'] .report-sort-hit:hover .dvra-sorter-arrow,
  .data-table thead th.report-sort-th:not([aria-sort]) form.report-sort-form button.report-sort-hit:hover .dvra-sorter-arrow,
  .data-table thead th.report-sort-th[aria-sort='ascending'] form.report-sort-form button.report-sort-hit:hover .dvra-sorter-arrow {
    border-bottom-color: var(--dvra-sorter-arrow-hover);
    border-top: none;
  }

  .data-table thead th.report-sort-th[aria-sort='descending'] .report-sort-hit:hover .dvra-sorter-arrow,
  .data-table thead th.report-sort-th[aria-sort='descending'] form.report-sort-form button.report-sort-hit:hover .dvra-sorter-arrow {
    border-top-color: var(--dvra-sorter-arrow-hover);
    border-bottom: none;
  }
}

/* Tabulator CDN loads after this file and sets .tabulator-row { background … !important } — higher specificity + !important wins */
.members-tabulator-wrap.tabulator .tabulator-tableholder .tabulator-row.tabulator-row-odd:not(.tabulator-selected),
.members-tabulator-wrap.tabulator .tabulator-tableholder .tabulator-row.tabulator-row-odd:not(.tabulator-selected) .tabulator-cell {
  background-color: var(--color-panel) !important;
}

.members-tabulator-wrap.tabulator .tabulator-tableholder .tabulator-row.tabulator-row-even:not(.tabulator-selected),
.members-tabulator-wrap.tabulator .tabulator-tableholder .tabulator-row.tabulator-row-even:not(.tabulator-selected) .tabulator-cell {
  background-color: var(--color-table-stripe) !important;
}

.members-tabulator-wrap .tabulator-cell.members-tabulator-actions {
  white-space: nowrap;
}

.members-tabulator-wrap .tabulator-cell.members-tabulator-actions a.btn-primary,
.members-tabulator-wrap .tabulator-cell.members-tabulator-actions button.btn-primary {
  display: inline-block;
  vertical-align: middle;
  padding: 0.1rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 4px;
  background: var(--color-header-top);
  color: #fff !important;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
}

.members-tabulator-wrap .tabulator-cell.members-tabulator-actions a.btn-primary:hover,
.members-tabulator-wrap .tabulator-cell.members-tabulator-actions button.btn-primary:hover {
  background: var(--color-header-bottom);
  color: #fff !important;
  text-decoration: none;
}

.members-tabulator-wrap .tabulator-cell.members-tabulator-actions button.members-note-btn--has {
  background: #0f766e !important;
}

.members-tabulator-wrap .tabulator-cell.members-tabulator-actions button.members-note-btn--has:hover {
  background: #0d9488 !important;
}

.member-note-dialog {
  width: min(32rem, calc(100vw - 2rem));
  max-width: 100%;
  border: 1px solid var(--color-border, #cbd5e1);
  border-radius: 6px;
  padding: 0.75rem 1rem 1rem;
}

.member-note-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.member-note-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 8rem;
  font-family: var(--font-ui);
}

.covered-by-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.covered-by-picker-row .member-form-control {
  flex: 1 1 10rem;
  width: auto;
  min-width: 0;
  cursor: pointer;
  background: #fff;
}

.covered-by-choose {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--color-header-top);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
}

.covered-by-choose:hover {
  background: var(--color-header-bottom);
}

.covered-by-dialog {
  width: min(40rem, calc(100vw - 2rem));
  max-width: 100%;
  border: 1px solid var(--color-border, #cbd5e1);
  border-radius: 6px;
  padding: 0.75rem 1rem 1rem;
}

.covered-by-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.covered-by-dialog h3 {
  margin: 0 0 0.75rem;
}

.covered-by-dialog .full-width input {
  width: 100%;
  box-sizing: border-box;
}

.covered-by-results-scroll {
  max-height: 16rem;
  margin: 0.75rem 0 0.5rem;
}

.covered-by-dialog .data-table tbody tr {
  cursor: pointer;
}

.covered-by-dialog .data-table tbody tr:hover td,
.covered-by-dialog .data-table tbody tr:hover:nth-child(odd) td,
.covered-by-dialog .data-table tbody tr:hover:nth-child(even) td {
  background: #dbe7f3;
}

.covered-by-dialog .data-table tbody tr.is-selected td,
.covered-by-dialog .data-table tbody tr.is-selected:nth-child(odd) td,
.covered-by-dialog .data-table tbody tr.is-selected:nth-child(even) td {
  background: #bfdbfe;
}

.covered-by-dialog .form-actions-row {
  margin-top: 0.75rem;
}

.covered-by-dialog .form-actions-row button {
  font-family: var(--font-ui);
  cursor: pointer;
  background: var(--color-header-top);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
}

.covered-by-dialog .form-actions-row button:hover {
  background: var(--color-header-bottom);
}

.member-form-field--full {
  grid-column: 1 / -1;
}

.payment-notes-cell {
  min-width: 12rem;
  vertical-align: top;
}

.payment-inherited-row td {
  color: var(--color-muted);
}

.payment-notes-input {
  width: 100%;
  min-width: 10rem;
  box-sizing: border-box;
  resize: vertical;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  line-height: 1.35;
}

.data-table input[type="date"].payment-row-input {
  min-width: 9.5rem;
}

.payment-row-save {
  font-family: var(--font-ui);
  cursor: pointer;
  background: var(--color-header-top);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
}

.payment-row-save:disabled {
  opacity: 0.45;
  cursor: default;
}

.payment-row-save:not(:disabled):hover {
  background: var(--color-header-bottom);
}

.payment-unsaved-dialog {
  width: min(28rem, calc(100vw - 2rem));
  max-width: 100%;
  border: 1px solid var(--color-border, #cbd5e1);
  border-radius: 6px;
  padding: 0.75rem 1rem 1rem;
}

.payment-unsaved-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.payment-unsaved-dialog h3 {
  margin-top: 0;
}

.payment-unsaved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.payment-unsaved-actions button {
  font-family: var(--font-ui);
  cursor: pointer;
  background: var(--color-header-top);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
}

.payment-unsaved-actions button:hover {
  background: var(--color-header-bottom);
}

.members-tabulator-wrap.tabulator .tabulator-row .tabulator-cell.members-col-fixed-data {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.members-tabulator-wrap.tabulator .tabulator-row .tabulator-cell.members-col-ref-data {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

.grid-page-body > .data-table-scroll,
.grid-page-body > .members-tabulator-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  margin-bottom: 0;
}

.grid-page-body > .data-table-scroll {
  max-height: none;
}

.filter-form,
.inline-form,
.stacked-form {
  font-family: var(--font-ui);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.members-scope-panel {
  margin-bottom: 0.75rem;
}

.members-scope-switch {
  font-family: var(--font-ui);
  max-width: 28rem;
}

.members-scope-switch-row {
  display: flex;
  align-items: center;
  gap: 0.65rem 0.85rem;
  flex-wrap: wrap;
}

.members-scope-caption {
  font-size: 0.9rem;
  color: var(--color-muted);
  font-weight: 500;
  transition: color 0.15s ease, font-weight 0.15s ease;
  white-space: nowrap;
}

.members-scope-switch:has(.switch-widget-input:checked) .members-scope-caption--current {
  color: var(--color-header-top);
  font-weight: 650;
}

.members-scope-switch:has(.switch-widget-input:not(:checked)) .members-scope-caption--all {
  color: var(--color-header-top);
  font-weight: 650;
}

.switch-widget {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  cursor: pointer;
  vertical-align: middle;
}

.switch-widget-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.switch-widget-track {
  display: flex;
  align-items: center;
  width: 3.35rem;
  height: 1.7rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: var(--color-border);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: background 0.2s ease;
}

.switch-widget-input:focus-visible + .switch-widget-track {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.switch-widget-input:checked + .switch-widget-track {
  background: var(--color-header-top);
  justify-content: flex-start;
}

.switch-widget-input:not(:checked) + .switch-widget-track {
  justify-content: flex-end;
}

.switch-widget-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.members-scope-panel .filter-hint {
  margin: 0.35rem 0 0;
  font-size: 0.9em;
}

.filter-grid .members-include-deceased {
  flex-direction: row;
  align-items: center;
  align-self: end;
  justify-content: flex-start;
  gap: 0.45rem;
  white-space: nowrap;
  cursor: pointer;
  padding-bottom: 0.45rem;
}

.filter-grid .members-include-deceased input[type="checkbox"] {
  margin: 0;
  width: 1rem;
  height: 1rem;
}

.filter-grid .filter-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.9em;
}

.filter-form-actions,
.inline-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

a.filter-clear,
button.filter-clear {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

a.filter-clear:hover,
button.filter-clear:hover {
  background: #fff;
  border-color: var(--color-muted);
  color: var(--color-text);
  text-decoration: none;
}

.filter-form button:not(.filter-clear),
.inline-form button,
.stacked-form button {
  font-family: var(--font-ui);
  cursor: pointer;
  background: var(--color-header-top);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
}

.filter-form button:not(.filter-clear):hover,
.inline-form button:hover,
.stacked-form button:hover {
  background: var(--color-header-bottom);
}

.stacked-form,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.stacked-form {
  flex-direction: row;
  align-items: flex-end;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  gap: 0.25rem;
}

input,
select,
textarea,
button {
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

input,
select,
textarea {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
}

/* Optional numeric fields that should not show browser spin controls. */
input.no-spinner[type="number"]::-webkit-outer-spin-button,
input.no-spinner[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input.no-spinner[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
  text-align: right;
}

.full-width {
  width: 100%;
  min-width: 200px;
}

.results-and-export-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.25rem;
  margin-block: 0 1rem;
}

.filter-form + .results-and-export-row {
  margin-block-start: 0.75rem;
}

.inline-form + .results-and-export-row {
  margin-block-start: 0;
}

.report-export-row--after-heading {
  margin-block-start: 0.35rem;
}

.results-and-export-row .results-meta,
.results-and-export-row .export-links {
  margin: 0;
}

.results-meta,
.muted {
  color: var(--color-muted);
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.actions-cell {
  white-space: nowrap;
}

.actions-cell a {
  margin-right: 0.65rem;
}

.member-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.member-page-header h2 {
  margin: 0;
  border-bottom: none;
  padding-bottom: 0;
  flex: 1;
  min-width: min(100%, 240px);
}

.member-page-actions {
  font-family: var(--font-ui);
  flex-shrink: 0;
}

.member-page-actions .btn-primary {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: var(--color-header-top);
  color: #fff !important;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
}

.member-page-actions .btn-primary:hover {
  background: var(--color-header-bottom);
  text-decoration: none;
  color: #fff !important;
}

/* Member edit / create: conventional vertical form + scroll pane */
.member-detail-page,
.member-new-page {
  --member-form-border: #94a3b8;
  padding-bottom: 1.5rem;
}

.member-detail-page input,
.member-detail-page select,
.member-detail-page textarea,
.member-new-page input,
.member-new-page select,
.member-new-page textarea {
  border-color: var(--member-form-border);
}

.member-detail-page .member-edit-form,
.member-new-page .member-edit-form {
  max-width: min(34rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 1.45rem;
  margin: 0 0 1.25rem 0;
}

.member-detail-page fieldset.member-form-fieldset.member-address-fields,
.member-new-page fieldset.member-form-fieldset.member-address-fields {
  border: 1px solid var(--member-form-border);
  border-radius: 4px;
  padding: 0.85rem 1rem 1rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  background: rgba(255, 255, 255, 0.4);
}

.member-detail-page fieldset.member-address-fields legend,
.member-new-page fieldset.member-address-fields legend {
  padding: 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-header-bottom);
}

.member-detail-page .member-form-field,
.member-new-page .member-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: stretch;
  padding-block: 0.5rem;
}

.member-detail-page .member-form-field label,
.member-detail-page .member-form-field .member-form-field-label,
.member-new-page .member-form-field label,
.member-new-page .member-form-field .member-form-field-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
}

/* Create member: address stacks vertically (same as other fields) */
.member-new-page fieldset.member-address-fields .member-form-field {
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding-block: 0.5rem;
}

.member-new-page fieldset.member-address-fields .member-form-field label {
  flex: unset;
  width: auto;
  margin: 0;
}

.member-new-page fieldset.member-address-fields .member-form-control {
  flex: unset;
  width: 100%;
  min-width: 0;
}

/* Member edit: address label + control on one row */
.member-detail-page fieldset.member-address-fields .member-form-field {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-block: 0.55rem;
}

.member-detail-page fieldset.member-address-fields .member-form-field label {
  flex: 0 0 5.25rem;
  margin: 0;
}

.member-detail-page fieldset.member-address-fields .member-form-control {
  flex: 1 1 10rem;
  min-width: 0;
  width: auto;
}

.member-detail-page .member-form-field--readonly .member-form-field-label {
  display: block;
}

.member-detail-page .member-form-control,
.member-new-page .member-form-control {
  width: 100%;
  max-width: 100%;
}

.member-detail-page .member-form-control:disabled,
.member-new-page .member-form-control:disabled {
  opacity: 0.55;
  background: rgba(241, 245, 249, 0.95);
  color: var(--color-muted);
  border-color: var(--color-border);
  cursor: not-allowed;
  -webkit-text-fill-color: var(--color-muted);
}

/* Read-only mode: keep controls non-editable but visually normal. */
.member-detail-page .member-edit-fieldset--readonly .member-form-control:disabled,
.member-detail-page .member-edit-fieldset--readonly .member-form-control[disabled],
.member-detail-page .member-edit-fieldset--readonly select.member-form-control:disabled,
.member-detail-page .member-edit-fieldset--readonly textarea.member-form-control:disabled {
  opacity: 1;
  background: #fff;
  color: var(--color-text);
  border-color: var(--member-form-border);
  cursor: default;
  -webkit-text-fill-color: var(--color-text);
}

.member-detail-page .member-form-readonly-text {
  margin: 0;
  font-size: 0.98rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--member-form-border);
  border-radius: 4px;
  background: rgba(248, 250, 252, 0.9);
  color: var(--color-text);
  min-height: 2.4rem;
  display: flex;
  align-items: center;
}

.member-detail-page .member-form-help {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.member-detail-page .member-form-help a {
  font-weight: 500;
}

.member-detail-page .member-form-actions-row,
.member-new-page .member-form-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  max-width: min(34rem, 100%);
  margin-top: 0.35rem;
}

.member-new-page .member-edit-form .member-form-actions-row {
  margin-top: 0.25rem;
  margin-bottom: 0;
}

.member-detail-page .member-delete-form-inline {
  margin: 0;
  padding: 0;
  border: none;
  display: inline-flex;
}

.member-detail-page .member-form-submit,
.member-new-page .member-form-submit {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--color-header-top);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
}

.member-detail-page .member-form-submit:hover,
.member-new-page .member-form-submit:hover {
  background: var(--color-header-bottom);
}

.member-detail-page .member-form-submit:disabled,
.member-new-page .member-form-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--color-muted);
}

.member-detail-page .member-form-submit:disabled:hover,
.member-new-page .member-form-submit:disabled:hover {
  background: var(--color-muted);
}

.member-detail-page .member-form-delete-submit {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  cursor: pointer;
  background: #b91c1c;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
}

.member-detail-page .member-form-delete-submit:hover {
  background: #991b1b;
}

.reference-row,
.reference-block {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--color-border);
}

/* Admin page: extra space between sections (license, membership, admins, managers) */
.admin-reference-page .reference-block {
  margin-bottom: 2.25rem;
  padding-bottom: 1rem;
}

.admin-reference-page .reference-block:last-child {
  margin-bottom: 0;
}

/* Admin reference tables (license classes, membership types) */
.admin-reference-page .admin-ref-section .admin-ref-table-wrap.data-table-scroll {
  max-height: none;
  height: auto;
  margin-bottom: 0;
}

.admin-reference-page .admin-ref-row-form {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem 0.65rem;
  margin: 0;
}

.admin-reference-page .admin-ref-item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem 0.65rem;
}

.admin-reference-page .admin-ref-item-row > .admin-ref-row-form:first-child {
  flex: 0 1 auto;
  min-width: 0;
}

.admin-reference-page .admin-ref-item-row > .admin-ref-delete-form,
.admin-reference-page .admin-ref-item-row > .admin-ref-action-form {
  flex: 0 0 auto;
}

.admin-reference-page .admin-ref-row-form.admin-ref-delete-form,
.admin-reference-page .admin-ref-row-form.admin-ref-action-form {
  justify-content: flex-start;
}

.admin-reference-page .admin-ref-item-hidden .admin-ref-name-input,
.admin-reference-page .admin-ref-item-hidden .admin-ref-protected-name {
  color: var(--color-muted);
}

.admin-reference-page .admin-ref-hidden-label {
  font-size: 0.85rem;
}

.admin-reference-page .admin-ref-name-input {
  flex: 0 0 16rem;
  width: 16rem;
  min-width: 10rem;
  max-width: 16rem;
}

.admin-reference-page .admin-ref-protected-name {
  font-weight: 600;
}

.admin-reference-page .admin-ref-add-row td {
  background: rgba(248, 250, 252, 0.85);
}

.admin-reference-page .admin-ref-add-form {
  padding: 0.15rem 0;
}

.admin-reference-page .admin-ref-row-form button {
  font-family: var(--font-ui);
  cursor: pointer;
  background: var(--color-header-top);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
}

.admin-reference-page .admin-ref-row-form button:hover {
  background: var(--color-header-bottom);
}

.payment-card {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.inline-delete-form {
  margin: 0;
}

.form-actions-row {
  width: 100%;
}

.btn-danger {
  background: #b91c1c !important;
  color: #fff !important;
}

.btn-danger:hover {
  background: #991b1b !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.error {
  color: #b91c1c;
  font-family: var(--font-ui);
}

.login-form {
  flex-direction: column;
  align-items: flex-start;
  max-width: 22rem;
}

.login-form > label {
  width: 20rem;
  max-width: 100%;
}

.login-form input {
  width: 100%;
}

.login-password-wrap,
.password-reveal-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.login-password-wrap input,
.password-reveal-wrap input {
  padding-right: 2.4rem;
  width: 100%;
  box-sizing: border-box;
}

.stacked-form button.login-password-toggle,
.stacked-form button.password-reveal-toggle,
.inline-form button.password-reveal-toggle,
button.password-reveal-toggle {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--color-muted);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.stacked-form button.login-password-toggle:hover,
.stacked-form button.password-reveal-toggle:hover,
.inline-form button.password-reveal-toggle:hover,
button.password-reveal-toggle:hover {
  background: #f1f5f9;
  color: var(--color-header-bottom);
}

.stacked-form button.login-password-toggle:focus-visible,
.stacked-form button.password-reveal-toggle:focus-visible,
.inline-form button.password-reveal-toggle:focus-visible,
button.password-reveal-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.login-password-toggle svg,
.password-reveal-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.login-password-toggle svg.is-hidden,
.password-reveal-toggle svg.is-hidden {
  display: none;
}

/* Membership report dashboard */
.membership-report-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 0.75rem;
}

.membership-report-tables {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.membership-report-summary {
  width: 100%;
  margin: 0;
}

.membership-report-summary thead {
  background: #6b7280;
  color: #fff;
}

.membership-report-summary thead th {
  background: #6b7280;
  color: #fff;
  border-color: #6b7280;
}

.membership-report-summary th.membership-report-total,
.membership-report-summary th.membership-report-num,
.membership-report-summary td.membership-report-num,
.membership-report-summary td:last-child {
  text-align: right;
  white-space: nowrap;
}

.membership-report-charts {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.membership-report-chart-card {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  padding: 0.75rem 1rem 1rem;
}

.membership-report-chart-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
}

.membership-report-chart-card canvas {
  width: 100% !important;
  max-height: 16rem;
}

@media (max-width: 900px) {
  .membership-report-layout {
    grid-template-columns: 1fr;
  }
}
