/*
  Coordinator Portal 2.0 - Eventivate look and feel (matches eventivate.com).

  Brand: crimson #dc0243, near-black #111, body grey #444, 4px corners, white header with a soft shadow,
  #111 footer, and a soft crimson-tinted hero band. Type: Raleway for headings and navigation, Open Sans
  for text. Both are bundled in /fonts (the portal's Content-Security-Policy only allows fonts from this
  origin), exactly as on the public site; the stacks fall back to the system sans-serif while they load.

  All colours are tokens in :root; the dark theme only overrides tokens.
*/

@font-face { font-family: "Open Sans"; src: url("/fonts/open-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 300 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("/fonts/open-sans-latin-wght-italic.woff2") format("woff2"); font-weight: 300 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Raleway"; src: url("/fonts/raleway-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;

  --brand: #dc0243;
  --brand-strong: #b8023a;
  --brand-tint: #fde8ee;
  --brand-tint-text: #9d0230;
  --brand-text: #dc0243;          /* brand colour used as text/links on the page surface (5.1:1 on white) */
  --on-brand: #ffffff;

  --page: #f3f1f1;
  --surface: #ffffff;
  --surface-alt: #f8f8f8;
  --surface-hover: #fdf3f6;
  --border: #dfdfdf;
  --border-strong: #c9c9c9;

  --ink: #111111;
  --text: #444444;
  --muted: #666666;

  --info-bg: #f1f1f1;
  --info-text: #333333;
  --ok-bg: #e8f5ee;
  --ok-text: #0b5a35;
  --err-bg: #fdecec;
  --err-text: #9b1c1c;
  --warn-bg: #fff6dd;
  --warn-border: #e5b800;
  --warn-text: #6b4e00;

  --footer-bg: #111111;
  --footer-text: #aaaaaa;

  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.08);
  --focus-ring: 0 0 0 3px rgba(220, 2, 67, 0.28);

  --radius: 10px;
  --radius-card: 16px;
  --radius-pill: 999px;

  --font-body: "Open Sans", Arial, Helvetica, sans-serif;
  --font-head: Raleway, "Open Sans", Arial, Helvetica, sans-serif;

  font-family: var(--font-body);
  background: var(--page);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --brand-strong: #f0356a;
    --brand-tint: #3a0f1b;
    --brand-tint-text: #ffb3c6;
    --brand-text: #ff5c86;           /* 5.8:1 on the dark surface */

    --page: #0d0d0d;
    --surface: #1a1a1a;
    --surface-alt: #222222;
    --surface-hover: #2a1820;
    --border: #333333;
    --border-strong: #4a4a4a;

    --ink: #f4f4f4;
    --text: #d6d6d6;
    --muted: #a8a8a8;

    --info-bg: #262626;
    --info-text: #e6e6e6;
    --ok-bg: #0f2a1d;
    --ok-text: #9be3bc;
    --err-bg: #3a1212;
    --err-text: #ffb4b4;
    --warn-bg: #3a2e08;
    --warn-border: #a37f00;
    --warn-text: #f4de92;

    --footer-bg: #000000;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.5);
    --focus-ring: 0 0 0 3px rgba(255, 92, 134, 0.4);
  }
}

/* Same overrides when the person picked Dark in their profile. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --brand-strong: #f0356a;
  --brand-tint: #3a0f1b;
  --brand-tint-text: #ffb3c6;
  --brand-text: #ff5c86;           /* 5.8:1 on the dark surface */

  --page: #0d0d0d;
  --surface: #1a1a1a;
  --surface-alt: #222222;
  --surface-hover: #2a1820;
  --border: #333333;
  --border-strong: #4a4a4a;

  --ink: #f4f4f4;
  --text: #d6d6d6;
  --muted: #a8a8a8;

  --info-bg: #262626;
  --info-text: #e6e6e6;
  --ok-bg: #0f2a1d;
  --ok-text: #9be3bc;
  --err-bg: #3a1212;
  --err-text: #ffb4b4;
  --warn-bg: #3a2e08;
  --warn-border: #a37f00;
  --warn-text: #f4de92;

  --footer-bg: #000000;
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.5);
  --focus-ring: 0 0 0 3px rgba(255, 92, 134, 0.4);
}


* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

[hidden] {
  display: none !important;
}

/* ---------- Site chrome (matches the eventivate.com header and footer) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 16px;
  min-height: 64px;
  padding: 0 clamp(14px, 3vw, 32px);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.brand img {
  display: block;
  width: 175px;
  max-width: 46vw;
  height: auto;
}

/* The wordmark is crimson on a transparent background, so it reads on dark as it is; a small lift keeps it crisp. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand img {
    filter: brightness(1.12);
  }
}

:root[data-theme="dark"] .brand img {
  filter: brightness(1.12);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 28px;
  margin-top: auto;
  padding: 22px clamp(14px, 3vw, 32px);
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
}

.site-footer a {
  color: #ffffff;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--brand-text);
  text-decoration: underline;
}

.site-footer a:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
  border-radius: 2px;
}

.site-footer p {
  margin: 0;
}

/* ---------- Contact Us dialog (opened from the footer) ---------- */

.contact-dialog {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.contact-dialog::backdrop {
  background: rgba(17, 17, 17, 0.55);
}

.contact-form {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 4vw, 32px);
}

.contact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contact-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
}

.contact-form .help {
  margin: 0;
}

.contact-optional {
  color: var(--muted);
  font-weight: 400;
}

.contact-message {
  min-height: 140px;
  resize: vertical;
  font: inherit;
}

.contact-status {
  margin: 0;
}

.contact-actions .button {
  width: 100%;
}

/* The hidden field that catches simple bots: off the screen and out of the tab order, but still in the page. */
.contact-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Page layout ---------- */

.shell {
  display: block;
  padding: 0 clamp(12px, 3vw, 24px) 40px;
}

.card {
  width: min(100%, 560px);
  margin: 40px auto 0;
  padding: clamp(24px, 5vw, 44px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

/* Wide layout once the signed-in area is visible (no script needed: [hidden] is toggled by app.js). */
.card:has(#signed-in:not([hidden])) {
  width: min(100%, 1240px);
  margin-top: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-text);
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  line-height: 1.15;
}

h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

h3 {
  font-size: 1.1rem;
}

h4 {
  font-size: 1rem;
}

.intro {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.status {
  margin: 24px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--info-text);
}

.status[hidden] {
  display: none;
}

/* The status bar normally separates the intro from the sign-in buttons; keep the gap when it is hidden. */
#signed-out,
#signed-out-staff,
#pending-activation {
  margin-top: 24px;
}

#pending-activation .intro {
  margin-top: 0;
}

.status[data-type="success"] {
  border-left-color: #1b8a55;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.status[data-type="error"] {
  border-left-color: #c62828;
  background: var(--err-bg);
  color: var(--err-text);
}

.actions {
  display: grid;
  gap: 12px;
}

/* ---------- Buttons (eventivate.com: filled brand button inverts to hollow on hover) ---------- */

.button {
  width: 100%;
  min-height: 46px;
  padding: 10px 25px;
  border: 2px solid var(--brand);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.button:focus-visible,
.report-tab:focus-visible,
.sort-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.primary {
  background: var(--brand);
  color: var(--on-brand);
}

.primary:hover {
  background: var(--surface);
  color: var(--brand-text);
}

.secondary {
  background: var(--surface);
  border-color: var(--brand);
  color: var(--brand-text);
}

.secondary:hover {
  background: var(--brand);
  color: var(--on-brand);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.danger {
  background: var(--surface);
  border-color: #c62828;
  color: #c62828;
}

.button.danger:hover {
  background: #c62828;
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .button.danger {
    border-color: #ff7a7a;
    color: #ff9a9a;
  }

  :root:not([data-theme="light"]) .button.danger:hover {
    background: #c62828;
    border-color: #c62828;
    color: #ffffff;
  }
}

/* Same overrides when the person picked Dark in their profile. */
:root[data-theme="dark"] .button.danger {
  border-color: #ff7a7a;
  color: #ff9a9a;
}

:root[data-theme="dark"] .button.danger:hover {
  background: #c62828;
  border-color: #c62828;
  color: #ffffff;
}


.compact {
  width: auto;
  min-height: 42px;
  padding: 8px 20px;
}

.help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.help a {
  color: var(--brand-text);
  text-underline-offset: 2px;
}

/* ---------- Portal agreement (shown after sign-in until accepted) ---------- */

#agreement-title {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 1.25rem;
}

#agreement .intro {
  margin: 0;
}

.agreement-text {
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.agreement-text:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.agreement-text ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 22px;
}

.agreement-text strong {
  color: var(--ink);
}

.agreement-accept {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.agreement-accept input {
  flex: none;
  width: 22px;
  height: 22px;
  accent-color: var(--brand);
}

/* ---------- Profile and event picker ---------- */

.profile dl {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 1.5fr;
  gap: 10px 16px;
  max-width: 720px;
  margin: 18px 0 24px;
}

.profile dt {
  color: var(--muted);
  font-weight: 600;
}

.profile dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Bottom action buttons (Manage users, View logs, MFA, Sign out) sit in a row instead of stretching. */
.profile > .button {
  width: auto;
  min-width: 150px;
  margin: 0 10px 12px 0;
}

.event-picker,
.dashboard,
.admin-users,
.admin-logs {
  width: 100%;
  margin: 28px 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.event-picker label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 600;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
select {
  color: var(--ink);
}

.search-row input,
.report-header select,
.logs-field input,
.logs-field select {
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-row input:focus,
.report-header select:focus,
.logs-field input:focus,
.logs-field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.results-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.event-list {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow-y: auto;
  padding-right: 4px;
}

.event-card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.event-card strong {
  font-family: var(--font-head);
  font-weight: 700;
}

.event-card:hover {
  border-color: var(--brand);
  border-left-color: var(--brand);
  background: var(--surface-hover);
}

.event-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.event-card > span {
  color: var(--muted);
  font-size: 0.84rem;
}

.event-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  width: fit-content;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--brand-tint);
  color: var(--brand-tint-text) !important;
  font-size: 0.75rem !important;
  font-weight: 700;
}

.badge.published {
  background: var(--ok-bg);
  color: var(--ok-text) !important;
}

.badge.muted {
  background: var(--info-bg);
  color: var(--muted) !important;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* ---------- Dashboard ---------- */

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-header h2 {
  margin-bottom: 8px;
}

.dashboard-header p {
  margin-top: 0;
  color: var(--muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 28px;
}

.kpi-card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.kpi-card h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.chart-section {
  margin: 26px 0;
}

.chart-section h3 {
  margin-bottom: 16px;
}

.monthly-chart {
  display: grid;
  gap: 16px;
}

.mchart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mchart-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.mchart-toggle {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.mchart-tab {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.mchart-tab[aria-pressed="true"] {
  background: var(--brand);
  color: #ffffff;
}

.mchart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mchart-stat {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.9rem;
}

.mchart-scroll {
  overflow-x: auto;
}

.mchart-inner {
  display: grid;
  gap: 8px;
}

.mchart-plot {
  position: relative;
  margin-left: 56px;
}

.mchart-tick {
  position: absolute;
  right: 0;
  left: -56px;
  display: flex;
  align-items: center;
  height: 0;
}

.mchart-tick-label {
  width: 48px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.mchart-tick-line {
  flex-grow: 1;
  height: 1px;
  background: var(--border);
}

.mchart-cols {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.mchart-col {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.mchart-col:hover {
  background: var(--surface-alt);
}

.mchart-col[aria-pressed="true"] {
  background: var(--brand-tint);
}

.mchart-value {
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.mchart-bar {
  width: 56%;
  max-width: 88px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}

.mchart-bar-zero {
  background: var(--muted);
}

.mchart-axis {
  display: flex;
  gap: 8px;
  margin-left: 56px;
}

.mchart-month {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  color: var(--text);
}

.mchart-month-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.mchart-month-year {
  color: var(--muted);
  font-size: 0.75rem;
}

.mchart-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--brand-tint);
  color: var(--brand-tint-text);
  font-size: 0.9rem;
}

.mchart-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.availability-note {
  padding: 12px 14px;
  border: 1px solid var(--warn-border);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.86rem;
  line-height: 1.5;
}

/* ---------- Disbursements ---------- */

.registrations-table.disbursements-table {
  min-width: 0;
}

.disbursements-table th.amount,
.disbursements-table td.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.disbursements-table tfoot td {
  font-weight: 700;
  background: var(--surface-alt);
}

.kpi-card.kpi-card-action {
  cursor: pointer;
}

.kpi-card.kpi-card-action:hover {
  border-color: var(--brand);
}

.disbursements-view .registration-detail {
  margin-top: 8px;
}

.kpi-card.kpi-card-action:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Report tabs ---------- */

.report-tabs {
  display: flex;
  gap: 4px;
  margin-top: 32px;
  border-bottom: 2px solid var(--brand);
}

.report-tab {
  min-width: 14rem;
  min-height: 42px;
  padding: 9px 20px;
  text-align: center;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s;
}

.report-tab:hover {
  color: var(--brand-text);
}

.report-tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}

.registrations-section,
.additional-items-section {
  margin-top: 0;
  padding-top: 24px;
}

.additional-items-section {
  border-top: 0;
}

.report-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.report-header h3 {
  margin: 0;
}

.report-header label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.report-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.report-actions .button {
  min-width: 118px;
}

.report-actions .button:disabled {
  cursor: progress;
  opacity: 0.65;
}

/* Registration details: the three actions can wrap on a narrow screen. */
#registration-detail .report-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* "Send confirmation": a confirm step with the language choice, shown under the detail header. */
.send-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
}

.send-panel-title {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.send-panel-language {
  display: grid;
  gap: 6px;
  max-width: 280px;
  font-size: 0.9rem;
}

.send-panel-language select {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.send-panel-language select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.send-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.send-panel-actions .button {
  width: auto;
  min-width: 118px;
}

.send-panel-actions .button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.registrations-controls {
  margin-top: 18px;
}

.registrations-controls > label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 600;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

/* ---------- Tables ---------- */

.table-scroll {
  width: 100%;
  max-width: 100%;
  max-height: 680px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.registrations-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: var(--surface);
  color: var(--text);
}

.registrations-table th,
.registrations-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.84rem;
}

.registrations-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 2px solid var(--brand);
  background: var(--surface-alt);
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.registrations-table tbody tr:hover {
  background: var(--surface-hover);
}

.sort-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-button:hover {
  color: var(--brand-text);
}

/* People table: the arrow shows which way a column is sorted; the faint double arrow marks a column you can sort. */
.registrations-table th .sort-button {
  white-space: nowrap;
}

/* People fits the page width (the other report tables keep their 1180px minimum and scroll sideways). */
.registrations-table.people-table {
  min-width: 0;
}

/* People has nine columns, so it uses tighter cell padding to fit without scrolling on a laptop screen. */
.people-table th,
.people-table td {
  padding-right: 9px;
  padding-left: 9px;
}

.people-table th {
  letter-spacing: 0.03em;
}

.sort-indicator {
  display: inline-block;
  min-width: 1.1em;
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.8em;
  letter-spacing: 0;
}

th.is-sorted .sort-indicator,
th.is-sorted .sort-button {
  color: var(--brand-text);
}

.empty-table {
  padding: 28px !important;
  color: var(--muted);
  text-align: center !important;
}

/* The Events count column keeps its full heading instead of being covered by the sticky Actions column. */
.registrations-table .col-count {
  min-width: 112px;
  white-space: nowrap;
}

/* Keep the Actions column visible while scrolling. */
.registrations-table th:last-child,
.registrations-table td:last-child {
  position: sticky;
  right: 0;
  min-width: 126px;
  background: var(--surface);
  box-shadow: -8px 0 14px rgba(0, 0, 0, 0.06);
}

.registrations-table th:last-child {
  z-index: 3;
  background: var(--surface-alt);
}

.registrations-table tbody tr:hover td:last-child {
  background: var(--surface-hover);
}

.registrations-table td:last-child .button {
  white-space: nowrap;
}

/* ---------- Registration detail and admin panels ---------- */

.registration-detail,
.admin-assignments {
  width: 100%;
  margin-top: 26px;
  padding: 22px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface-alt);
  scroll-margin-top: 80px;
}

.detail-header,
.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.detail-header h3,
.admin-header h2 {
  margin: 0;
}

.admin-header {
  margin-bottom: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}

.detail-item {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.detail-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.detail-section {
  margin-top: 22px;
}

.detail-section h4 {
  margin: 0 0 10px;
}

.detail-section > p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.form-data-list {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(200px, 1.2fr);
  gap: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.form-data-list dt,
.form-data-list dd {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.form-data-list dt {
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 600;
}

.form-data-list dd {
  background: var(--surface);
  white-space: pre-wrap;
}

#admin-users-open,
#admin-logs-open {
  margin-bottom: 12px;
}

.assignment-columns {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
  gap: 24px;
  margin-top: 20px;
}

.assignment-columns h4 {
  margin-top: 0;
}

.assignment-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.assignment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.assignment-item strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.assignment-item > span:not(.badge) {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.8rem;
}

.assignment-item .badge {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.assignment-item-content {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.assignment-item-content > span {
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.assignment-toggle {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px;
  min-width: 118px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.assignment-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.assignment-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--brand-tint);
}

.assignment-save-actions {
  display: flex;
  gap: 10px;
}

.user-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* Every row button (Edit, Events, Enable / Disable) is the same size, so the Actions column lines up. */
.user-actions .row-action {
  width: 104px;
  min-height: 38px;
  padding: 6px 10px;
  text-align: center;
  white-space: nowrap;
}

/* ---------- People, Logs and Disbursements: spacing above the table ---------- */

/* The count / title and the action buttons above these tables (Invite, Export CSV, Order, Rows per page, Export PDF) sat flush against the table's top edge. */
.admin-users .report-header,
.admin-logs .report-header,
#disbursements-panel .detail-header {
  margin-bottom: 12px;
}

/* ---------- People: filters ---------- */

.people-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin: 14px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.people-filters-title {
  flex-basis: 100%;
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.people-filter {
  display: grid;
  gap: 6px;
  min-width: 160px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.people-filter select {
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}

.people-filter select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

/* A chosen filter is outlined in the brand colour so it is easy to see what is narrowing the list. */
.people-filter select.is-set {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.people-filters .button {
  min-height: 42px;
}

/* The email and name columns wrap instead of pushing the Events column under the sticky Actions column. */
.people-table td:nth-child(2) {
  max-width: 180px;
  overflow-wrap: anywhere;
}

.people-table td:nth-child(3) {
  max-width: 270px;
  overflow-wrap: anywhere;
}

/* Long headings (Legacy status, Assigned Role) wrap onto two lines so the nine columns fit a laptop screen. */
.people-table th .sort-button {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.people-table td:last-child {
  min-width: 124px;
}

/* ---------- Logs ---------- */

.logs-filters {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.logs-filter-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.logs-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.logs-filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.log-detail-row td,
.log-detail-row td:last-child {
  position: static;
  min-width: 0;
  background: var(--surface-alt);
  box-shadow: none;
}

.log-detail-row pre {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

@media (max-width: 700px) {
  .report-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .report-tab {
    min-width: 0;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .report-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .card {
    padding: 22px 16px;
  }

  .card:has(#signed-in:not([hidden])) {
    margin-top: 16px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .detail-header,
  .admin-header,
  .assignment-save-bar,
  .assignment-save-actions,
  .report-actions {
    display: grid;
  }

  .detail-header .button,
  .admin-header .button,
  .assignment-save-actions,
  .assignment-save-actions .button,
  .report-actions .button,
  .report-actions label,
  .report-actions select {
    width: 100%;
  }

  .detail-grid,
  .form-data-list {
    grid-template-columns: 1fr;
  }

  .form-data-list dt {
    border-bottom: 0;
  }

  .registrations-table th:last-child,
  .registrations-table td:last-child {
    position: static;
    box-shadow: none;
  }

  .profile > .button {
    width: 100%;
    margin-right: 0;
  }
}

@media (max-width: 520px) {
  .search-row {
    grid-template-columns: 1fr;
  }

  .search-row .compact {
    width: 100%;
  }

  .dashboard-header {
    display: grid;
  }

  .dashboard-header .button {
    width: 100%;
  }

  .mchart-toggle {
    width: 100%;
  }

  .mchart-tab {
    flex: 1 1 0;
  }

  .report-header {
    display: grid;
  }

  .report-header select {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* =====================================================================================================
   Profile, people and roles
   ===================================================================================================== */

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

.icon {
  flex: none;
}

.muted {
  color: var(--muted);
}

.span-all {
  grid-column: 1 / -1;
}

/* ---------- Avatar and chips ---------- */

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1;
}

/* A photo fills the circle; the brand colour behind it only shows while the picture loads. */
.avatar-photo {
  overflow: hidden;
}

.avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.78rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.95rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.15rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 1.9rem; box-shadow: 0 0 0 4px var(--surface); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 3px;
  background: var(--info-bg);
  color: var(--info-text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.chip-brand { background: var(--brand-tint); color: var(--brand-tint-text); }
.chip-good { background: var(--ok-bg); color: var(--ok-text); }
.chip-warn { background: var(--warn-bg); color: var(--warn-text); }
.chip-bad { background: var(--err-bg); color: var(--err-text); }

/* ---------- Header account menu ---------- */

.account {
  position: relative;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Refresh is a quiet icon in the top bar. The word stays in the page for screen readers (and the title shows it on hover). */
.refresh-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s;
}

.refresh-button:hover {
  background: var(--surface-hover);
  color: var(--brand-text);
}

.refresh-button-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.refresh-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.refresh-button[aria-busy="true"] {
  cursor: progress;
  opacity: 0.7;
}

/* Language pill (EN | ES), the same segmented control as cloudonize.com: a quiet track with a "thumb" on the current language. Shown on every screen. */
.lang {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--info-bg);
  box-shadow: inset 0 0 0 1px var(--border);
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
}

.lang button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.lang button:hover {
  color: var(--ink);
}

.lang button[aria-current],
.lang button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  cursor: default;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.theme-switch button {
  min-width: 34px;
  padding: 0 8px;
}

.lang button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.lang[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

/* On phones the header has the logo, the pill, Refresh and the account menu: the logo and the gaps give way so nothing overflows. */
@media (max-width: 520px) {
  .site-header {
    gap: 8px;
  }

  .brand img {
    max-width: 26vw;
  }

  .header-actions {
    gap: 4px;
  }

  .lang button {
    min-width: 28px;
    padding: 0 5px;
  }

  .theme-switch button {
    min-width: 26px;
    padding: 0 4px;
  }
}

/* Small phones (360px and below): the header gives up a little more room so the account menu is never cut off. */
@media (max-width: 400px) {
  .site-header {
    gap: 6px;
    padding: 0 10px;
  }

  .brand img {
    max-width: 22vw;
  }

  .header-actions {
    gap: 3px;
  }

  .lang button {
    min-width: 25px;
    padding: 0 3px;
  }

  .theme-switch button {
    min-width: 24px;
    padding: 0 3px;
  }

  .account-button {
    padding-left: 5px;
    padding-right: 5px;
    gap: 4px;
  }
}

/* The narrowest phones (320px): the account menu's chevron goes, the avatar alone opens it. */
@media (max-width: 340px) {
  .account-button > .icon:last-child {
    display: none;
  }
}

.refresh-button-icon {
  display: inline-grid;
  place-items: center;
}

.refresh-button[aria-busy="true"] .refresh-button-icon {
  animation: refresh-spin 0.9s linear infinite;
}

@keyframes refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .refresh-button[aria-busy="true"] .refresh-button-icon {
    animation: none;
  }
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  max-width: 280px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.2s;
}

.account-button:hover {
  border-color: var(--brand);
}

.account-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.account-button[aria-expanded="true"] .icon:last-child {
  transform: rotate(180deg);
}

.account-button-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: min(300px, 92vw);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.account-menu-head {
  display: grid;
  gap: 2px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.account-menu-head strong {
  color: var(--ink);
  font-family: var(--font-head);
}

.account-menu-head span {
  color: var(--muted);
  font-size: 0.85rem;
}

.account-menu-group {
  padding: 10px 12px 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.account-menu-divider {
  height: 1px;
  margin: 6px 0;
  background: var(--border);
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  text-decoration: none;
}

.account-menu-item:hover,
.account-menu-item:focus-visible {
  outline: none;
  background: var(--surface-hover);
}

.account-menu-item:focus-visible {
  box-shadow: var(--focus-ring);
}

.account-menu-item[aria-current="page"] {
  border-left-color: var(--brand);
  color: var(--brand-text);
  font-weight: 600;
}

.account-menu-label {
  flex: 1;
}

/* ---------- Views ---------- */

.profile-view,
.roles-view {
  width: 100%;
  margin: 28px 0 0;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.view-head h2 {
  margin: 0 0 4px;
}

.view-head .help {
  margin: 0;
}

/* ---------- Identity header ---------- */

.identity {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand-tint);
}

.identity-text {
  min-width: 0;
}

.identity-name {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.identity-email {
  margin: 4px 0 12px;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Change / remove / refresh the profile photo, under the email. */
.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-actions .button {
  width: auto;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  margin-bottom: -1px;
  padding: 12px 20px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-head);
  font-size: 0.98rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--brand);
  color: var(--ink);
}

.tab:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

.tab-panel:focus {
  outline: none;
}

/* ---------- Settings layout ---------- */

.settings-section {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 2.3fr);
  gap: 12px 40px;
  padding: 30px 0;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-intro h3 {
  margin: 0 0 6px;
}

.settings-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-body {
  min-width: 0;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

/* The action buttons in these rows (Disable, Sign out, Turn off MFA...) share one width so they line up. */
.settings-row > .button {
  flex: none;
  width: 11rem;
}

.settings-row h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.settings-row .help {
  margin: 0;
}

.facts {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 8px 16px;
  margin: 22px 0 0;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.inline-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.inline-action p {
  margin: 0;
  color: var(--text);
}

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

.form-grid > .field-error,
.form-grid > .help {
  grid-column: 1 / -1;
  margin: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  align-items: center;
  gap: 12px;
}

.form-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.field {
  min-width: 0;
}

.field label,
.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.input:disabled,
input.input[readonly] {
  background: var(--surface-alt);
  color: var(--muted);
}

.input[aria-invalid="true"] {
  border-color: #c62828;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.field-error {
  margin: 6px 0 0;
  color: var(--err-text);
  font-size: 0.86rem;
  font-weight: 600;
}

.grid-spacer {
  display: block;
}

/* Segmented radio group (appearance) */

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.segment {
  position: relative;
  display: flex;
}

.segment + .segment {
  border-left: 1px solid var(--border-strong);
}

.segment input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.segment label {
  display: block;
  margin: 0;
  padding: 10px 18px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s;
}

.segment input:checked + label {
  background: var(--brand);
  color: var(--on-brand);
}

.segment input:focus-visible + label {
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 5px var(--brand);
}

.segment input:disabled + label {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Checkbox rows (roles and permissions) */

.check-list {
  display: grid;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.check-row input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.check-row input:disabled {
  cursor: not-allowed;
}

.check-row label {
  display: grid;
  flex: 1;
  gap: 2px;
  margin: 0;
  cursor: pointer;
}

.check-row label .chip {
  justify-self: start;
  margin-top: 4px;
}

.check-label {
  color: var(--ink);
  font-weight: 600;
}

.check-description {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
}

/* ---------- Notices ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--info-text);
}

.notice p {
  margin: 0;
}

.notice .icon {
  margin-top: 3px;
}

.notice-warn {
  border-left-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
}

.notice-error {
  border-left-color: #c62828;
  background: var(--err-bg);
  color: var(--err-text);
}

/* ---------- MFA ---------- */

.mfa-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--warn-border);
  border-radius: var(--radius);
}

.mfa-state.mfa-on {
  border-left-color: #1b8a55;
}

.mfa-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--warn-bg);
  color: var(--warn-text);
}

.mfa-on .mfa-icon {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.mfa-copy strong {
  color: var(--ink);
  font-family: var(--font-head);
}

.mfa-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Dialogs ---------- */

.dialog {
  width: min(92vw, 480px);
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--text);
  overflow: auto;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.dialog-body {
  padding: 28px 28px 8px;
}

.dialog-body h2 {
  margin: 0 0 12px;
}

.dialog-body p {
  margin: 0 0 10px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 28px 24px;
}

.button.danger-solid {
  border-color: #c62828;
  background: #c62828;
  color: #ffffff;
}

.button.danger-solid:hover {
  border-color: #a31f1f;
  background: #a31f1f;
}

.dialog-mfa {
  width: min(94vw, 640px);
}

.mfa-steps {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 28px;
}

.step-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-weight: 700;
}

.qr-frame {
  width: 212px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.qr {
  display: block;
  width: 100%;
  height: auto;
}

.secret-key {
  display: block;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.02rem;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.mfa-verify {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.mfa-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 600;
}

.code-input {
  max-width: 220px;
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.35em;
  text-align: center;
}

.mfa-form .dialog-actions {
  padding: 18px 0 4px;
}

.icon-button {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.icon-button.small {
  width: 28px;
  height: 28px;
}

/* A value with a small copy icon right beside it (a read-only input in a form, or text in a facts list). */
.input-with-action,
.facts dd.copyable {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-with-action .input {
  flex: 1;
  min-width: 0;
}

.icon-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- Person editor (side sheet) ---------- */

.sheet {
  width: min(100vw, 720px);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  border-width: 0 0 0 1px;
  border-radius: 0;
}

.sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.22s ease-out;
}

@keyframes sheet-in {
  from {
    transform: translateX(28px);
    opacity: 0;
  }
}

.sheet-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px;
  border-left: 4px solid var(--brand);
  background: var(--brand-tint);
}

.sheet-title {
  flex: 1;
  min-width: 0;
}

.sheet-title h2 {
  margin: 0;
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.sheet-title p {
  margin: 2px 0 10px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.sheet .tabs {
  margin-top: 0;
  padding: 0 24px;
}

.sheet-body {
  flex: 1;
  padding: 24px;
  overflow: auto;
}

.access-edit h3,
.security-edit h3,
.events-edit h3 {
  margin: 22px 0 8px;
  font-size: 1rem;
}

.access-edit h3:first-child,
.events-edit h3:first-child {
  margin-top: 0;
}

.access-edit .form-actions {
  margin-top: 14px;
}

/* ---------- Permissions and activity lists ---------- */

.access-count {
  margin: 0 0 4px;
  color: var(--ink);
  font-weight: 700;
}

.perm-group h4 {
  margin: 18px 0 8px;
}

.perm-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.perm-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.perm-list .icon {
  margin-top: 3px;
  color: var(--ok-text);
}

.perm-description {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Role manager ---------- */

.roles-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
  gap: 32px;
}

.role-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.role-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.2s, background-color 0.2s;
}

.role-item:hover {
  border-color: var(--brand);
  border-left-color: var(--brand);
}

.role-item.selected {
  border-left-color: var(--brand);
  background: var(--surface-hover);
}

.role-item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.role-item-name {
  font-family: var(--font-head);
  font-weight: 700;
}

.role-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.role-new {
  margin-top: 12px;
}

.role-editor {
  min-width: 0;
}

.role-editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.role-editor-head h3 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.role-editor-head .help {
  margin: 0;
}

.role-editor-actions {
  display: flex;
  gap: 10px;
}

.matrix-title {
  margin: 28px 0 12px;
}

.matrix {
  display: grid;
  gap: 18px;
}

.perm-fieldset {
  min-width: 0;
  margin: 0;
  padding: 6px 18px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.perm-fieldset legend {
  padding: 0 8px;
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
}

.perm-fieldset > .help {
  margin: 0 0 4px;
}

.perm-fieldset .check-row {
  padding: 12px 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.perm-fieldset .help + .check-row {
  border-top: 0;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.change-summary {
  display: grid;
  gap: 2px;
  max-width: 560px;
  font-size: 0.9rem;
}

.diff-add {
  color: var(--ok-text);
}

.diff-remove {
  color: var(--err-text);
}

.role-members {
  margin-top: 32px;
}

.member-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.member-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.member-text {
  display: grid;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.member-text span {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Toasts ---------- */

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(92vw, 380px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  box-shadow: var(--shadow-card);
  color: var(--page);
  font-size: 0.92rem;
  transition: opacity 0.25s, transform 0.25s;
}

.toast-error {
  border-left: 4px solid #ff5c86;
}

.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .roles-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .settings-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .account-button-name {
    display: none;
  }

  .account-button {
    padding-right: 8px;
  }

  .identity {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 22px 20px;
  }

  .avatar-xl {
    width: 64px;
    height: 64px;
    font-size: 1.4rem;
  }

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

  .grid-spacer {
    display: none;
  }

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

  .mfa-state .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .mfa-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .qr-frame {
    width: min(212px, 100%);
  }

  .settings-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .facts dd {
    margin-bottom: 10px;
  }

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

  .activity-item time {
    grid-column: 2;
  }

  .sheet-head,
  .sheet-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .sheet .tabs {
    padding: 0 8px;
  }

  .dialog-body {
    padding: 22px 20px 6px;
  }

  .dialog-actions {
    padding: 14px 20px 20px;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open] {
    animation: none;
  }

  .toast.leaving {
    transform: none;
  }
}

/* Once signed in the page is a workspace, not a landing page: shrink the welcome block. */
.card:has(#signed-in:not([hidden])) .intro,
.card:has(#signed-in:not([hidden])) .eyebrow:first-child {
  display: none;
}

.card:has(#signed-in:not([hidden])) h1 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
}

.card:has(#signed-in:not([hidden])) .status {
  margin: 14px 0 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

[data-view-heading]:focus {
  outline: none;
}

/* ---------- Registrations: choose columns ---------- */

.columns-panel {
  margin-top: 18px;
  padding: 18px 20px 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.columns-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.columns-panel-head h4 {
  margin: 0;
  color: var(--ink);
}

.columns-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.columns-search {
  display: block;
  max-width: 360px;
  margin-top: 14px;
  color: var(--ink);
  font-weight: 600;
}

.columns-search input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 400;
}

.columns-search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.columns-group {
  min-width: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.columns-group legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 0.86rem;
  font-weight: 700;
}

.columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 20px;
}

.columns-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.columns-item input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.columns-item input:disabled {
  cursor: not-allowed;
}

.columns-empty {
  display: none;
  margin: 14px 0 0;
  color: var(--muted);
}

.columns-list[data-empty="true"] ~ .columns-empty {
  display: block;
}

/* The registrations table now has as many columns as the person chose, so it only needs room for a few. */
.registrations-table.reg-columns-table {
  min-width: 640px;
}

.registrations-table.reg-columns-table th {
  white-space: nowrap;
}

.registrations-table.reg-columns-table td {
  max-width: 340px;
  overflow-wrap: break-word;
}

@media (max-width: 620px) {
  .columns-panel {
    padding: 16px 14px 18px;
  }

  .columns-panel-actions {
    width: 100%;
  }
}

/* ---------- Create an event / event reviews ---------- */

.submit-view {
  width: 100%;
  margin: 28px 0 0;
}

.submission-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.submission-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.submission-title {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.submission-title:hover {
  color: var(--brand-text);
  text-decoration: underline;
}

.submission-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.filter-tab {
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
}

.filter-tab.active {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-tint-text);
}

.review-search {
  max-width: 420px;
  margin: 0 0 16px;
}

.event-form {
  display: grid;
  gap: 18px;
}

.form-card {
  min-width: 0;
  margin: 0 0 18px;
  padding: 18px 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.event-form .form-card {
  margin: 0;
}

.form-card legend,
.form-card h3 {
  padding: 0 6px;
  margin: 0 0 12px;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
}

.form-card h3 {
  padding: 0;
}

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

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.req {
  color: var(--brand-text);
  font-weight: 700;
}

.textarea {
  min-height: 140px;
  resize: vertical;
  font: inherit;
  line-height: 1.5;
}

.image-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  margin: 0 0 10px;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
}

.image-preview img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  border-radius: 4px;
}

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

.place-search {
  display: flex;
  gap: 8px;
}

.place-search .input {
  flex: 1;
}

.place-results {
  margin-top: 10px;
}

.place-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.place-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.place-address {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.place-link {
  color: var(--brand-text);
  font-weight: 600;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.submit-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1 1 280px;
}

.submit-summary[data-state="ready"] {
  color: var(--ok-text);
  font-weight: 600;
}

.form-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 22px;
}

.form-buttons-main {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Buttons are full width by default; in the form's action bar they are as wide as their text. */
.form-buttons .button {
  width: auto;
}

/* Delete draft: a quiet text-style button, set apart from Save and Submit so it is not hit by accident. */
.button.danger-quiet {
  padding-right: 14px;
  padding-left: 14px;
  border-color: transparent;
  background: transparent;
  color: #c62828;
}

.button.danger-quiet:hover {
  background: rgba(198, 40, 40, 0.1);
  color: #c62828;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .button.danger-quiet {
    color: #ff9a9a;
  }

  :root:not([data-theme="light"]) .button.danger-quiet:hover {
    background: rgba(255, 122, 122, 0.14);
    color: #ffb3b3;
  }
}

:root[data-theme="dark"] .button.danger-quiet {
  color: #ff9a9a;
}

:root[data-theme="dark"] .button.danger-quiet:hover {
  background: rgba(255, 122, 122, 0.14);
  color: #ffb3b3;
}

.review-note {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.review-note p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

/* The portal page is a .profile, whose dl rules would otherwise apply here. */
.profile dl.review-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  max-width: none;
  margin: 0;
}

.review-line {
  display: grid;
  grid-template-columns: minmax(120px, 200px) minmax(0, 1fr);
  gap: 12px;
}

.review-line dt {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.review-line dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 620px) {
  .submission-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

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

  .review-line {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .place-search {
    flex-direction: column;
  }

  .form-buttons,
  .form-buttons-main {
    width: 100%;
  }

  .form-buttons .button {
    flex: 1 1 100%;
  }

  /* On a phone Delete draft goes last, under Save and Submit. */
  .form-buttons .danger-quiet {
    order: 2;
  }
}

/* ---------- Event management: tickets, other images, terms ---------- */

.input-prefix {
  position: relative;
}

.input-prefix::before {
  content: attr(data-prefix);
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input-prefix .input {
  padding-left: 26px;
}

.ticket-list {
  display: grid;
  gap: 14px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.ticket-card {
  padding: 14px 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.ticket-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.ticket-actions .button,
.image-actions .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ticket-count,
.gallery-count {
  margin: 0;
}

.gallery-grid,
.gallery-review {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.gallery-grid[hidden] {
  display: none;
}

.gallery-item {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  overflow: hidden;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-wait {
  color: var(--muted);
  font-size: 0.8rem;
}

.gallery-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  cursor: pointer;
}

.gallery-remove[hidden] {
  display: none;
}

.gallery-remove:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.gallery-review .image-preview {
  min-height: 0;
  margin: 0;
  aspect-ratio: 4 / 3;
}

.gallery-review .image-preview img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

.review-tickets {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-ticket {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.review-ticket-price {
  color: var(--ink);
  font-weight: 700;
}

.review-ticket-window {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.88rem;
}

.terms-text {
  margin-bottom: 14px;
}

.terms-version {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Date and time picker ---------- */

.dt-control {
  position: relative;
}

.dt-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.dt-trigger:disabled {
  cursor: not-allowed;
}

.dt-trigger[aria-expanded="true"] {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.dt-trigger svg {
  flex: none;
  color: var(--muted);
}

.dt-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dt-text.is-placeholder {
  color: var(--muted);
}

.dt-control:has(.dt-clear:not([hidden])) .dt-trigger {
  padding-right: 76px;
}

.dt-clear {
  position: absolute;
  top: 50%;
  right: 40px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.dt-clear[hidden] {
  display: none;
}

.dt-clear:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.dt-clear:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.dt-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: min(348px, 92vw);
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.dt-popover[hidden] {
  display: none;
}

.dt-popover.dt-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.dt-backdrop {
  display: none;
}

.dt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
}

.dt-month {
  color: var(--ink);
  font-weight: 700;
  text-align: center;
}

.dt-nav {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.dt-nav svg {
  transform: rotate(90deg);
}

.dt-nav-next svg {
  transform: rotate(-90deg);
}

.dt-nav:hover:not(:disabled) {
  background: var(--surface-hover);
}

.dt-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dt-nav:focus-visible,
.dt-chip:focus-visible,
.dt-day:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.dt-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.dt-weekday {
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.dt-cell {
  display: flex;
  justify-content: center;
}

.dt-day {
  width: 100%;
  max-width: 44px;
  min-height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.dt-day:hover {
  background: var(--surface-hover);
}

.dt-day.is-outside {
  color: var(--muted);
  opacity: 0.65;
}

.dt-day.is-today {
  box-shadow: inset 0 0 0 2px var(--border-strong);
}

.dt-day.is-selected,
.dt-day.is-selected:hover {
  background: var(--brand);
  box-shadow: none;
  color: var(--on-brand);
  font-weight: 700;
  opacity: 1;
}

.dt-day.is-selected:focus-visible {
  box-shadow: var(--focus-ring);
}

.dt-day[aria-disabled="true"],
.dt-day[aria-disabled="true"]:hover {
  background: transparent;
  cursor: not-allowed;
  opacity: 0.3;
}

.dt-time {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dt-time-label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.dt-selects {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dt-select {
  flex: 1;
  width: auto;
  min-width: 0;
}

.dt-colon {
  color: var(--muted);
  font-weight: 700;
}

.dt-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.dt-chip {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.dt-chip:hover {
  background: var(--surface-hover);
}

.dt-summary {
  min-height: 1.3em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.dt-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.dt-foot .primary {
  margin-left: auto;
}

@media (max-width: 620px) {
  /* On a phone the calendar opens as a sheet at the bottom of the screen. */
  .dt-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: block;
    background: rgba(0, 0, 0, 0.5);
  }

  .dt-popover,
  .dt-popover.dt-up {
    position: fixed;
    inset: auto 0 0;
    z-index: 91;
    width: auto;
    max-height: 92vh;
    padding: 16px 16px 22px;
    border-radius: 14px 14px 0 0;
    overflow-y: auto;
  }
}

/* One-tap ticket name suggestions under the name box. */
.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
}

.suggestion-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.suggestion-chip {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.suggestion-chip:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-tint-text);
}

.suggestion-chip:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* The bank behind the routing number. */
.bank-lookup {
  margin: 6px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.bank-lookup[hidden] {
  display: none;
}

.bank-lookup.is-found {
  color: var(--ok-text);
  font-weight: 600;
}

.bank-lookup.is-warn {
  color: var(--warn-text);
}

/* The main links in the top bar: Dashboard, Registrations, Check-in, Virtual events. Shown once signed in; the open screen's link is dark with a crimson underline, like the links on eventivate.com. */
.nav-pills {
  display: none;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  margin: 0 0 0 clamp(8px, 2vw, 28px);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-pills::-webkit-scrollbar {
  display: none;
}

body:has(#signed-in:not([hidden])) .nav-pills {
  display: flex;
}

.nav-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 64px;
  padding: 0 14px;
  border-bottom: 3px solid transparent;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nav-pill-icon {
  display: none;
}

.nav-pill[hidden] {
  display: none;
}

.nav-pill:hover {
  color: var(--ink);
  border-bottom-color: var(--border-strong);
}

.nav-pill[aria-current="page"],
.nav-pill[aria-current="page"]:hover {
  border-bottom-color: var(--brand);
  color: var(--ink);
}

.nav-pill:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

/* Narrow screens: the links take their own row under the logo and the controls. */
@media (max-width: 880px) {
  .site-header {
    padding-top: 6px;
  }

  body:has(#signed-in:not([hidden])) .nav-pills {
    order: 3;
    flex: 1 0 100%;
    margin: 0 -4px;
    border-top: 1px solid var(--border);
  }

  .nav-pill {
    min-height: 44px;
    padding: 0 12px;
  }
}

/* Phones: four equal links, each an icon over its label, so all of them are in view without scrolling. */
@media (max-width: 620px) {
  .nav-pills {
    gap: 0;
    overflow-x: visible;
  }

  .nav-pill {
    flex: 1 1 0;
    flex-direction: column;
    justify-content: flex-start;
    gap: 3px;
    min-height: 64px;
    padding: 8px 2px 4px;
    font-size: 0.72rem;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }

  .nav-pill-icon {
    display: block;
  }
}

/* The Registrations page: the table that used to sit under the event dashboard. */
.registrations-view {
  display: block;
}

.registrations-view .dashboard-header .report-actions {
  flex-wrap: wrap;
}

.registrations-picker {
  margin-top: 16px;
}

.registrations-month-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.registrations-view .registrations-section {
  padding-top: 8px;
}

.review-ticket-quantity {
  grid-column: 1 / -1;
}

/* A secret number that is already saved shows as a darker "xxxx1234" placeholder, so the box does not look unfilled. */
.input.is-saved::placeholder {
  color: var(--ink);
  opacity: 1;
  letter-spacing: 0.04em;
}

/* ---------- Sign-in screen (login-ui.js): the portal's own sign-in, create account and reset steps ---------- */

.login-view {
  display: grid;
  gap: 16px;
}

.login-view form {
  display: grid;
  gap: 16px;
}

.login-view .help {
  margin: 0;
}

.login-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
}

/* Plain status line above the buttons, as on eventivate.com's My account page. */
.login-message {
  margin: 0;
  color: var(--info-text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
}

.login-message[data-type="success"] {
  color: var(--ok-text);
}

.login-message[data-type="error"] {
  color: var(--err-text);
}

.login-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-link:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: var(--focus-ring);
}

/* Show / Hide sits inside the password box. */
.password-row {
  position: relative;
}

.password-row .input {
  padding-right: 5rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  padding: 4px 2px;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--brand-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
}

.password-toggle:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: var(--focus-ring);
}

/* "Forgot your password?" on the left, "Create an account" on the right, under the button. */
.login-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.login-actions .button {
  width: auto;
  flex: 1 1 11rem;
}

/* The quieter of two buttons: outlined in ink, filling on hover (eventivate.com's quiet button). */
.button.quiet {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.button.quiet:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-social,
.login-choices {
  display: grid;
  gap: 12px;
}

/* Google / Apple: the quiet pill button, full width. */
.login-provider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.login-provider:hover,
.login-provider:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.login-provider-icon {
  flex: none;
}

/* Apple's logo is black on a light page and white on a dark one (--ink does both), not the brand colour of the button text. On hover
   the button fills with the brand colour, so the logo follows the text then. */
.login-provider-icon-apple {
  color: var(--ink);
}

.login-provider:hover .login-provider-icon-apple,
.login-provider:focus-visible .login-provider-icon-apple {
  color: var(--surface);
}

/* ---------- Signed-out pages: the same look as eventivate.com's My account page ----------
   A big page title and a lead line on the page itself, then the form in a white panel with a crimson top edge. */

.card:not(:has(#signed-in:not([hidden]))) {
  width: min(100%, 46rem);
  margin: clamp(28px, 6vw, 56px) auto 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.card:not(:has(#signed-in:not([hidden]))) h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.1;
  text-align: center;
}

.card:not(:has(#signed-in:not([hidden]))) #portal-intro {
  margin: 12px 0 0;
  font-size: 1.15rem;
  text-align: center;
}

/* A notice ("Your session ended...") is a soft note, centred and as wide as the sign-in panel below it. */
.card:not(:has(#signed-in:not([hidden]))) .status {
  max-width: 30rem;
  margin: 20px auto 0;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.card:not(:has(#signed-in:not([hidden]))) .status[data-type="success"] {
  border-color: transparent;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.card:not(:has(#signed-in:not([hidden]))) .status[data-type="error"] {
  border-color: transparent;
  background: var(--err-bg);
  color: var(--err-text);
}

.card:not(:has(#signed-in:not([hidden]))) :is(#signed-out, #signed-out-staff, #pending-activation, #agreement) {
  margin-top: 24px;
  padding: clamp(1rem, 4vw, 1.5rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand);
  border-radius: var(--radius-card);
}

.card:not(:has(#signed-in:not([hidden]))) :is(#signed-out, #signed-out-staff) {
  max-width: 30rem;
  margin-inline: auto;
}

@media (max-width: 620px) {
  .card:not(:has(#signed-in:not([hidden]))) {
    padding: 0;
  }
}

.agreement-docs {
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.agreement-docs a {
  font-weight: 600;
  text-decoration: underline;
}
