/* ══════════════════════════════════════════════════════════════════════════
   Management list pages: Applications, Member List, Payments.
   Same tokens as the dashboard; text colours meet WCAG AA on their backgrounds.
   ══════════════════════════════════════════════════════════════════════════ */
.mlist {
  --ml-teal:      #1b6055;
  --ml-teal-600:  #154d44;
  --ml-teal-50:   #e8f3f1;
  --ml-ink:       #1f2a37;
  --ml-muted:     #5b6675;
  --ml-line:      #e6e9ee;
  --ml-surface:   #ffffff;
  --ml-soft:      #f6f8fa;
  --ml-green:     #047857;
  --ml-green-50:  #e7f6ef;
  --ml-amber:     #a14a07;
  --ml-amber-50:  #fff4e0;
  --ml-blue:      #1d4ed8;
  --ml-blue-50:   #eaf1ff;
  --ml-violet:    #6d28d9;
  --ml-violet-50: #f3eeff;
  --ml-red:       #b91c1c;
  --ml-red-50:    #fdecec;
  --ml-grey:      #4b5563;
  --ml-grey-50:   #f1f3f5;
  --ml-radius:    14px;
  --ml-shadow:    0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  color: var(--ml-ink);
}
body.dark-only .mlist {
  --ml-teal:      #4fb3a2;
  --ml-teal-600:  #6cc4b5;
  --ml-teal-50:   rgba(79, 179, 162, .14);
  --ml-ink:       #e5e9f0;
  --ml-muted:     #a3adbb;
  --ml-line:      #2c3440;
  --ml-surface:   #1d232c;
  --ml-soft:      #161b22;
  --ml-green:     #5fd3a8;
  --ml-green-50:  rgba(95, 211, 168, .14);
  --ml-amber:     #f5b35c;
  --ml-amber-50:  rgba(245, 179, 92, .14);
  --ml-blue:      #8fb1ff;
  --ml-blue-50:   rgba(143, 177, 255, .14);
  --ml-violet:    #c4a7ff;
  --ml-violet-50: rgba(196, 167, 255, .14);
  --ml-red:       #ff8a8a;
  --ml-red-50:    rgba(255, 138, 138, .14);
  --ml-grey:      #c3cad4;
  --ml-grey-50:   rgba(195, 202, 212, .12);
  --ml-shadow:    none;
}
body.dark-only .mlist .btn-close { filter: invert(1); }

.ml-views-bar { position: relative; display: flex; align-items: center; gap: .25rem; margin-bottom: 1rem; padding-right: .3rem; background: var(--ml-surface); border: 1px solid var(--ml-line); border-radius: 12px; box-shadow: var(--ml-shadow); }
.ml-views-bar .ml-tabs { flex: 1; min-width: 0; margin-bottom: 0; border: 0; box-shadow: none; }
.ml-count-help { flex: 0 0 auto; color: var(--ml-muted); font-size: .85rem; }
.ml-count-help summary { cursor: pointer; color: var(--ml-teal); display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 9px; list-style: none; font-size: 1.1rem; }
.ml-count-help summary::-webkit-details-marker { display: none; }
.ml-count-help summary:hover { background: var(--ml-soft); }
.ml-count-help summary:focus-visible { outline: 3px solid var(--ml-teal); outline-offset: 2px; }
.ml-count-help-body { position: absolute; top: calc(100% + .4rem); right: 0; z-index: 20; width: min(520px, 100%); max-height: 65vh; overflow-y: auto; padding: 1rem; background: var(--ml-surface); border: 1px solid var(--ml-line); border-radius: var(--ml-radius); box-shadow: var(--ml-shadow); }
.ml-count-help dt { color: var(--ml-ink); font-weight: 700; }
.ml-count-help dd { margin: .2rem 0 .75rem; }
.ml-count-help p:last-child { margin-bottom: 0; }

.mlist a:focus-visible,
.mlist button:focus-visible,
.mlist input:focus-visible,
.mlist select:focus-visible,
.mlist textarea:focus-visible,
.mlist [tabindex]:focus-visible {
  outline: 3px solid var(--ml-teal);
  outline-offset: 2px;
}
.mlist .ml-muted { color: var(--ml-muted); font-size: .78rem; }
.mlist .ml-num { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.mlist code { color: var(--ml-ink); font-size: .8rem; }

/* ── Header ───────────────────────────────────────────────────────────── */
.ml-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem 1rem; margin-bottom: 1rem;
}
.ml-sub { margin: 0; color: var(--ml-muted); font-size: .88rem; max-width: 720px; }
.ml-head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.ml-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: 10px; border: 1px solid var(--ml-line);
  background: var(--ml-surface); color: var(--ml-ink); font-size: .82rem; font-weight: 700;
  line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.ml-btn:hover { background: var(--ml-soft); color: var(--ml-ink); }
.ml-btn[disabled] { opacity: .55; cursor: not-allowed; }
.ml-btn.sm { padding: .32rem .65rem; font-size: .76rem; border-radius: 8px; }
.ml-btn.primary { background: var(--ml-teal); border-color: var(--ml-teal); color: #fff; }
.ml-btn.primary:hover { background: var(--ml-teal-600); border-color: var(--ml-teal-600); color: #fff; }
.ml-btn.ghost { border-color: transparent; background: transparent; color: var(--ml-muted); }
.ml-btn.ghost:hover { background: var(--ml-soft); color: var(--ml-ink); }
.ml-btn.approve { background: var(--ml-green-50); border-color: transparent; color: var(--ml-green); }
.ml-btn.revise  { background: var(--ml-violet-50); border-color: transparent; color: var(--ml-violet); }
.ml-btn.reject  { background: var(--ml-red-50); border-color: transparent; color: var(--ml-red); }
.ml-btn.approve:hover, .ml-btn.revise:hover, .ml-btn.reject:hover { filter: brightness(.96); }
.ml-btn.solid-approve { background: #047857; border-color: #047857; color: #fff; }
.ml-btn.solid-revise  { background: #6d28d9; border-color: #6d28d9; color: #fff; }
.ml-btn.solid-reject  { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.ml-btn.solid-approve:hover, .ml-btn.solid-revise:hover, .ml-btn.solid-reject:hover { filter: brightness(.92); color: #fff; }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.ml-tabs {
  display: flex; gap: .25rem; padding: .3rem; margin-bottom: 1rem; overflow-x: auto;
  background: var(--ml-surface); border: 1px solid var(--ml-line); border-radius: 12px; box-shadow: var(--ml-shadow);
}
.ml-tab {
  display: inline-flex; align-items: center; gap: .45rem; flex-shrink: 0;
  border: 0; background: transparent; padding: .5rem .85rem; border-radius: 9px;
  font-size: .82rem; font-weight: 700; color: var(--ml-muted); cursor: pointer;
}
.ml-tab:hover { background: var(--ml-soft); color: var(--ml-ink); }
.ml-tab[aria-selected="true"] { background: var(--ml-teal-50); color: var(--ml-teal); }
.ml-count {
  min-width: 22px; padding: 0 .45rem; border-radius: 999px; line-height: 20px; text-align: center;
  font-size: .72rem; font-weight: 800; background: var(--ml-grey-50); color: var(--ml-grey);
}
.ml-count.is-urgent { background: var(--ml-red-50); color: var(--ml-red); }

/* ── Cards & toolbar ──────────────────────────────────────────────────── */
.ml-card {
  background: var(--ml-surface); border: 1px solid var(--ml-line); border-radius: var(--ml-radius);
  box-shadow: var(--ml-shadow); margin-bottom: 1rem; overflow: hidden;
}
.ml-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .65rem; padding: .85rem 1rem; overflow: visible; }
.ml-search { position: relative; flex: 1 1 260px; max-width: 380px; margin: 0; }
.ml-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--ml-muted); font-size: .8rem; }
.ml-search input,
.ml-field input,
.ml-field select {
  width: 100%; height: 38px; border: 1px solid var(--ml-line); border-radius: 10px;
  background: var(--ml-surface); color: var(--ml-ink); font-size: .84rem; padding: 0 .7rem;
}
.ml-search input { padding-left: 2.1rem; }
.ml-field { display: flex; flex-direction: column; gap: .2rem; margin: 0; min-width: 140px; }
.ml-field > span { font-size: .7rem; font-weight: 700; color: var(--ml-muted); text-transform: uppercase; letter-spacing: .04em; }
.ml-seg { display: inline-flex; border: 1px solid var(--ml-line); border-radius: 10px; overflow: hidden; height: 38px; }
.ml-seg button {
  border: 0; background: var(--ml-surface); color: var(--ml-muted); padding: 0 .8rem;
  font-size: .8rem; font-weight: 700; cursor: pointer;
}
.ml-seg button + button { border-left: 1px solid var(--ml-line); }
.ml-seg button[aria-pressed="true"] { background: var(--ml-teal); color: #fff; }
.ml-summary { margin: 0 0 .6rem .15rem; font-size: .82rem; color: var(--ml-muted); }
.ml-summary strong { color: var(--ml-ink); }

/* ── Table ────────────────────────────────────────────────────────────── */
.ml-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.ml-table th {
  position: sticky; top: 0; z-index: 1; background: var(--ml-soft); color: var(--ml-muted);
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  padding: .7rem 1rem; border-bottom: 1px solid var(--ml-line); white-space: nowrap; text-align: left;
}
.ml-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--ml-line); vertical-align: middle; color: var(--ml-ink); }
.ml-table tbody tr:last-child td { border-bottom: 0; }
.ml-table tbody tr:hover td,
.ml-table tbody tr.is-active td { background: var(--ml-teal-50); }
.ml-table .ml-row-actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: wrap; }
.ml-name { font-weight: 700; }

/* ── Badges & chips ───────────────────────────────────────────────────── */
.ml-badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 800; white-space: nowrap;
}
.tone-green  { background: var(--ml-green-50);  color: var(--ml-green); }
.tone-amber  { background: var(--ml-amber-50);  color: var(--ml-amber); }
.tone-blue   { background: var(--ml-blue-50);   color: var(--ml-blue); }
.tone-violet { background: var(--ml-violet-50); color: var(--ml-violet); }
.tone-red    { background: var(--ml-red-50);    color: var(--ml-red); }
.tone-grey   { background: var(--ml-grey-50);   color: var(--ml-grey); }
.ml-type { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ml-type.membership { color: var(--ml-teal); }
.ml-type.donation   { color: var(--ml-amber); }
.ml-chip {
  display: inline-block; padding: .08rem .45rem; border-radius: 6px; font-size: .68rem; font-weight: 800;
  background: var(--ml-teal-50); color: var(--ml-teal);
}
.ml-waiting.warn { color: var(--ml-amber); font-weight: 700; }
.ml-waiting.late { color: var(--ml-red); font-weight: 700; }

/* ── Pagination ───────────────────────────────────────────────────────── */
.ml-pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .7rem 1rem; border-top: 1px solid var(--ml-line);
}
.ml-pager ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.ml-pager li button,
.ml-pager li span {
  min-width: 34px; height: 34px; padding: 0 .5rem; border-radius: 8px; border: 1px solid var(--ml-line);
  background: var(--ml-surface); color: var(--ml-ink); font-size: .8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.ml-pager li span { border-color: transparent; color: var(--ml-muted); }
.ml-pager li button[aria-current="page"] { background: var(--ml-teal); border-color: var(--ml-teal); color: #fff; }
.ml-pager li button[disabled] { opacity: .45; cursor: not-allowed; }
.ml-pager select { height: 34px; border: 1px solid var(--ml-line); border-radius: 8px; background: var(--ml-surface); color: var(--ml-ink); font-size: .8rem; padding: 0 .5rem; }

/* ── States ───────────────────────────────────────────────────────────── */
.ml-empty { text-align: center; padding: 3rem 1rem; color: var(--ml-muted); }
.ml-empty i { font-size: 2rem; display: block; margin-bottom: .6rem; }
.ml-empty p { margin: 0 auto; max-width: 420px; font-size: .9rem; }
.ml-error {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin: 1rem; padding: .75rem 1rem; border-radius: 10px; background: var(--ml-red-50); color: var(--ml-red);
  font-size: .85rem; font-weight: 600;
}
.ml-skel {
  height: 18px; border-radius: 6px;
  background: linear-gradient(90deg, var(--ml-soft) 25%, var(--ml-line) 50%, var(--ml-soft) 75%);
  background-size: 200% 100%; animation: ml-shimmer 1.3s infinite linear;
}
@keyframes ml-shimmer { to { background-position: -200% 0; } }

/* ── Drawer ───────────────────────────────────────────────────────────── */
.ml-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1060; }
.ml-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 540px; max-width: 100vw; z-index: 1061;
  background: var(--ml-surface); box-shadow: -8px 0 40px rgba(15, 23, 42, .18);
  display: flex; flex-direction: column;
}
.ml-drawer-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ml-drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--ml-line);
}
.ml-drawer-head h2 { font-size: 1.15rem; font-weight: 800; margin: 0; color: var(--ml-ink); }
.ml-drawer-head h2:focus { outline: none; }
.ml-eyebrow { margin: 0 0 .15rem; font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ml-muted); }
.ml-drawer-body { flex: 1; overflow-y: auto; padding: 1.2rem 1.4rem; }
.ml-drawer-foot { border-top: 1px solid var(--ml-line); padding: 1rem 1.4rem; background: var(--ml-soft); }
.ml-amount {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem; border-radius: 12px; background: var(--ml-soft); margin-bottom: 1rem;
}
.ml-amount strong { display: block; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ml-warn {
  display: flex; gap: .5rem; align-items: flex-start; padding: .6rem .8rem; border-radius: 10px;
  background: var(--ml-amber-50); color: var(--ml-amber); font-size: .82rem; font-weight: 600; margin-bottom: 1rem;
}
.ml-section {
  font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ml-muted);
  margin: 1.1rem 0 .55rem; padding-bottom: .35rem; border-bottom: 1px solid var(--ml-line);
}
.ml-proof img {
  display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px;
  border: 1px solid var(--ml-line); background: var(--ml-soft);
}
.ml-dl { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1rem; margin: 0; }
.ml-dl > div { min-width: 0; }
.ml-dl dt { font-size: .72rem; font-weight: 700; color: var(--ml-muted); margin: 0 0 .1rem; }
.ml-dl dd { font-size: .87rem; margin: 0; overflow-wrap: anywhere; }
.ml-dl .full { grid-column: 1 / -1; }
.ml-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.ml-confirm label { font-size: .82rem; font-weight: 700; margin-bottom: .35rem; display: block; }
.ml-confirm textarea { margin-bottom: .6rem; }
.ml-check { display: flex !important; align-items: center; gap: .45rem; font-weight: 600 !important; color: var(--ml-muted); margin-bottom: .6rem !important; }
.ml-err { color: var(--ml-red); font-size: .82rem; font-weight: 600; margin: 0 0 .6rem; }
.ml-link { color: var(--ml-teal); font-weight: 700; text-decoration: none; }
.ml-link:hover { color: var(--ml-teal-600); text-decoration: underline; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.ml-modal-wrap {
  position: fixed; inset: 0; z-index: 1070; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.ml-modal {
  width: 100%; max-width: 460px; background: var(--ml-surface); color: var(--ml-ink);
  border-radius: 16px; padding: 1.5rem; box-shadow: 0 24px 64px rgba(15, 23, 42, .25);
}
.ml-modal h2 { font-size: 1.1rem; font-weight: 800; margin: 0 0 .35rem; }
.ml-modal h2.approve { color: var(--ml-green); }
.ml-modal h2.revise  { color: var(--ml-violet); }
.ml-modal h2.reject  { color: var(--ml-red); }

/* ── Toast ────────────────────────────────────────────────────────────── */
.ml-toast {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 2000; max-width: calc(100vw - 32px);
  background: #065f46; color: #fff; padding: .75rem 1.1rem; border-radius: 10px;
  font-size: .86rem; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.ml-toast.is-error { background: #991b1b; }

@media (max-width: 575.98px) {
  .ml-search { max-width: none; }
  .ml-field { flex: 1 1 140px; }
  .ml-dl { grid-template-columns: 1fr; }
  .ml-toast { right: 16px; left: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .mlist *, .mlist *::before { animation: none !important; transition: none !important; }
}
