:root {
  color-scheme: light;
  --primary-color: #1d4ed8;
  --secondary-color: #0f766e;
  --background-color: #eef3f8;
  --surface-color: #ffffff;
  --surface-muted-color: #f7fafc;
  --text-color: #111827;
  --muted-text-color: #667085;
  --border-color: #d8e1ea;
  --success-color: #168a4a;
  --warning-color: #b7791f;
  --error-color: #c2413d;
  --focus-ring: rgba(29, 78, 216, .16);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 16px 42px rgba(15, 23, 42, .12);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --control-height: 42px;
  --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: Georgia, "Times New Roman", Times, serif;
  --ink: var(--text-color);
  --muted: var(--muted-text-color);
  --line: var(--border-color);
  --paper: var(--surface-color);
  --panel: var(--surface-color);
  --accent: var(--primary-color);
  --blue: var(--primary-color);
  font-family: var(--font-sans);
  font-size: 15px;
}
* { box-sizing: border-box; }
html { min-height: 100%; scrollbar-color: var(--primary-color) transparent; scrollbar-width: thin; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-color);
  display: grid;
  place-items: center;
  background: var(--background-color);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--primary-color) 54%, var(--border-color)); border-radius: 999px; border: 2px solid var(--background-color); }
button, input, select, textarea { font: inherit; }
button {
  min-height: var(--control-height);
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-color);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  box-shadow: var(--shadow-sm);
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
button:hover { border-color: color-mix(in srgb, var(--primary-color) 44%, var(--border-color)); box-shadow: 0 7px 18px rgba(15, 23, 42, .08); }
button:active { transform: translateY(1px); }
button.primary { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
button.secondary { background: var(--secondary-color); border-color: var(--secondary-color); color: #fff; }
button.outline, button.ghost { background: transparent; color: var(--primary-color); }
button.muted { background: var(--surface-muted-color); color: var(--muted-text-color); }
button.danger { background: var(--error-color); border-color: var(--error-color); color: #fff; }
input, select, textarea {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: var(--surface-color);
  color: var(--text-color);
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, .03);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted-text-color) 70%, transparent); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus-ring); border-color: var(--primary-color); }
textarea { resize: vertical; }
.member-shell {
  width: min(460px, 100%);
  min-height: min(850px, 100vh);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
}
.app-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-color); background: var(--surface-color); }
.brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--primary-color); color: #fff; font-weight: 800; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-family: var(--font-heading); color: var(--text-color); font-size: 18px; line-height: 1.1; }
.brand-lockup small { color: var(--muted-text-color); font-size: 12px; margin-top: 1px; }
.bar-actions, .split-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.screen { display: none; padding: 20px; min-height: calc(min(850px, 100vh) - 67px); background: var(--surface-muted-color); }
.screen.active { display: flex; flex-direction: column; gap: 14px; }
.hero-copy { margin-top: 20px; }
.eyebrow { margin: 0 0 7px; color: var(--secondary-color); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; }
h1 { font-family: var(--font-heading); margin: 0; color: var(--text-color); font-size: clamp(34px, 9vw, 46px); line-height: 1.02; font-weight: 800; letter-spacing: 0; }
h2 { font-family: var(--font-heading); margin: 0; color: var(--text-color); font-size: 23px; line-height: 1.14; font-weight: 780; }
h3 { font-family: var(--font-heading); margin: 4px 0; color: var(--text-color); font-size: 17px; line-height: 1.2; font-weight: 750; }
.lede { color: var(--muted-text-color); line-height: 1.55; max-width: 34ch; font-size: 15px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.action-grid, .form-stack, .list-stack { display: grid; gap: 11px; }
.action-grid.two { grid-template-columns: 1fr 1fr; margin-top: auto; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 5px; color: var(--muted-text-color); font-size: 13px; font-weight: 650; }
.check-line { display: flex; align-items: center; gap: 8px; color: var(--text-color); }
.check-line input { width: auto; min-height: auto; accent-color: var(--primary-color); }
.conditional { display: none; }
.conditional.visible { display: grid; }
.event-card, .notice-card, .detail-panel, .receipt-panel, .empty-state {
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  border-radius: var(--radius-md);
  padding: 15px;
  box-shadow: var(--shadow-sm);
}
.event-card { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.event-card span, .notice-card span, .detail-panel span, .receipt-panel span, .payment-summary span { color: var(--secondary-color); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.event-card p, .notice-card p, .detail-panel p, .empty-state p { color: var(--muted-text-color); line-height: 1.5; margin: 6px 0 0; }
.notice-link { color: var(--primary-color); font-weight: 750; }
.card-actions { display: grid; gap: 8px; justify-items: end; white-space: nowrap; }
.detail-panel dl, .receipt-panel dl, .profile-list { margin: 12px 0 0; display: grid; gap: 8px; }
.detail-panel div, .receipt-panel div, .profile-list div { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border-color); padding-top: 8px; }
dt { color: var(--muted-text-color); }
dd { margin: 0; font-weight: 750; text-align: right; color: var(--text-color); }
.payment-summary strong { display: block; font-size: 28px; margin: 5px 0; color: var(--text-color); }
.bottom-nav { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.status-output { margin: 0 20px 16px; max-height: 170px; overflow: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px; background: var(--surface-color); color: var(--success-color); font-size: 12px; }
.status-output.error { color: var(--error-color); }
.cli-output { color: var(--warning-color); }
.rule-list { display: grid; gap: 8px; margin-top: 4px; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px; background: var(--surface-color); }
.rule-row strong, .rule-row small { display: block; }
.rule-row small { color: var(--muted-text-color); margin-top: 2px; }
.rule-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.compact-box { padding: 10px; }
.inline-fieldset { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px; display: grid; gap: 8px; background: var(--surface-color); }
.inline-fieldset legend { color: var(--muted-text-color); font-size: 12px; font-weight: 750; padding: 0 4px; }
.inline-fieldset label { display: flex; align-items: center; gap: 8px; color: var(--text-color); }
.inline-fieldset input[type="radio"], .inline-fieldset input[type="checkbox"] { width: auto; min-height: auto; accent-color: var(--primary-color); }
.media-panel { display: grid; gap: 9px; }
.media-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.media-actions a, .media-actions button { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border-radius: var(--radius-sm); padding: 0 12px; font-size: 13px; font-weight: 700; color: #fff; background: var(--primary-color); border: 1px solid var(--primary-color); }
.chat-thread { display: grid; gap: 8px; max-height: 380px; overflow: auto; padding-right: 3px; }
.chat-message { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px 11px; background: var(--surface-color); }
.chat-message header { display: flex; justify-content: space-between; gap: 10px; color: var(--muted-text-color); font-size: 12px; margin-bottom: 4px; }
.chat-message p { margin: 0; color: var(--text-color); }
.chat-message.private { border-color: color-mix(in srgb, var(--warning-color) 38%, var(--border-color)); }
.chat-form-closed { opacity: .58; pointer-events: none; }

.bulk-search-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 11px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  box-shadow: var(--shadow-sm);
}
.bulk-search-panel label { margin: 0; }
.bulk-search-panel input { min-height: 38px; }
.bulk-search-panel button { min-height: 38px; align-self: center; }
.bulk-search-panel p { grid-column: 1 / -1; margin: 0; color: var(--muted-text-color); font-size: 11px; }
.bulk-payment-list { display: grid; gap: 8px; max-height: 430px; overflow: auto; padding-right: 2px; }
.bulk-payment-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  box-shadow: var(--shadow-sm);
  color: var(--text-color);
}
.bulk-payment-row input { width: auto; min-height: auto; accent-color: var(--primary-color); }
.bulk-payment-row span { display: grid; gap: 2px; min-width: 0; }
.bulk-payment-row small { color: var(--muted-text-color); font-size: 11px; }
.bulk-payment-row b { color: var(--text-color); white-space: nowrap; }

@media (max-width: 520px) {
  body { place-items: stretch; }
  .member-shell { border-radius: 0; border: 0; min-height: 100vh; width: 100%; box-shadow: none; }
  .screen { min-height: calc(100vh - 67px); padding: 18px; }
  .field-row, .action-grid.two, .event-card, .bulk-search-panel { grid-template-columns: 1fr; display: grid; }
  .card-actions { justify-items: stretch; }
  h1 { font-size: 34px; }
  h2 { font-size: 22px; }
  .bar-actions button { min-height: 34px; padding: 0 10px; font-size: 12px; }
}

.admin-only-field input { background: var(--surface-muted-color); color: var(--muted-text-color); border-style: dashed; }
.admin-only-field small { color: var(--muted-text-color); font-size: 11px; }
.status-button { min-width: 128px; }
.helper-text { color: var(--muted-text-color); font-size: 11px; }

[hidden] { display: none !important; }
.boot-fallback {
  margin: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  color: var(--muted-text-color);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.boot-fallback strong { display: block; color: var(--text-color); margin-bottom: 3px; }
.boot-fallback p { margin: 3px 0; }
.boot-fallback a { color: var(--primary-color); font-weight: 700; }
.boot-error { border-color: color-mix(in srgb, var(--error-color) 36%, var(--border-color)); color: var(--error-color); }
@media (max-width: 480px) {
  input, select, textarea { font-size: 16px; }
  .boot-fallback { margin: 10px; }
}
