/* Base styles of the public site and the dashboard. Colors come from css/tokens.css; component styles are isolated
   (*.razor.css). No inline styles anywhere: the Content-Security-Policy allows only same-origin stylesheets. */

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

html {
  font-family: var(--mb-font-body);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--mb-page);
  color: var(--mb-ink);
  font-size: 15px;
}

h1, h2, h3 {
  font-family: var(--mb-font-heading);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

h1:focus {
  outline: none;
}

p {
  margin: 0;
}

a {
  color: var(--mb-link);
}

a:hover {
  color: var(--mb-link-hover);
}

/* Keyboard focus is always visible (WCAG 2.4.7/2.4.11). */
:focus-visible {
  outline: 3px solid var(--mb-focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--mb-radius);
  background: var(--mb-forest);
  color: var(--mb-on-accent);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
  color: var(--mb-on-accent);
}

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

/* Numbers, codes and URLs keep their own direction inside RTL text. */
.ltr, bdi.num, .num {
  direction: ltr;
  unicode-bidi: isolate;
}

.num {
  font-variant-numeric: tabular-nums;
}

code, .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--mb-touch);
  padding: 0 18px;
  border-radius: var(--mb-radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:disabled, .btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-primary {
  background: var(--mb-forest);
  color: var(--mb-on-accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--mb-forest-deep);
  color: var(--mb-on-accent);
}

.btn-secondary {
  background: var(--mb-card);
  color: var(--mb-link);
  border-color: var(--mb-forest);
}

.btn-quiet {
  background: var(--mb-card);
  color: var(--mb-ink);
  border-color: var(--mb-input-border);
}

.btn-danger {
  background: var(--mb-card);
  color: var(--mb-danger);
  border-color: var(--mb-danger);
}

.btn-link {
  min-height: var(--mb-touch);
  padding: 0 4px;
  background: none;
  border: 0;
  color: var(--mb-link);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 52px;
  border-radius: 26px;
  font-size: 16px;
}

/* ----- Forms ----- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.field > label, .field-label {
  font-weight: 600;
}

.field-hint {
  font-size: 13px;
  color: var(--mb-muted);
}

.field-error {
  font-size: 13px;
  color: var(--mb-danger);
  font-weight: 600;
}

.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea {
  min-height: var(--mb-touch);
  width: 100%;
  padding: 0 12px;
  border-radius: var(--mb-radius);
  border: 1px solid var(--mb-input-border);
  background: var(--mb-card);
  color: var(--mb-ink);
  font-family: inherit;
  font-size: 15px;
}

.field textarea {
  padding: 10px 12px;
  min-height: 96px;
  resize: vertical;
}

.field input[aria-invalid="true"], .field select[aria-invalid="true"], .input[aria-invalid="true"] {
  border-color: var(--mb-danger);
  border-width: 2px;
}

.field input:disabled, .input:disabled {
  background: var(--mb-card-muted);
  color: var(--mb-muted);
  border-color: var(--mb-border-strong);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--mb-touch);
  font-weight: 600;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--mb-forest);
}

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

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

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

fieldset {
  border: 1px solid var(--mb-border);
  border-radius: var(--mb-radius-lg);
  padding: 16px;
  margin: 0;
}

legend {
  padding: 0 6px;
  font-weight: 700;
}

/* ----- Cards, sections, tables ----- */
.card {
  background: var(--mb-card);
  border: 1px solid var(--mb-border);
  border-radius: var(--mb-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.small {
  font-size: 13px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.spacer {
  flex-grow: 1;
}

.note {
  padding: 12px 14px;
  border-radius: var(--mb-radius);
  background: var(--mb-card-muted);
  color: var(--mb-ink-strong);
  font-size: 13px;
  line-height: 1.7;
}

.table-wrap {
  /* Positioned so absolutely positioned descendants (.visually-hidden headers) are clipped by the scroll area
     instead of widening the whole page in RTL. */
  position: relative;
  width: 100%;
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
}

table.data th, table.data td {
  padding: 12px 14px;
  text-align: start;
  font-size: 14px;
  border-bottom: 1px solid var(--mb-border);
  vertical-align: middle;
}

table.data th {
  font-weight: 600;
  color: var(--mb-ink-strong);
  background: var(--mb-table-head);
}

table.data td.total {
  font-weight: 700;
}

/* ----- Chips (status never by color alone: always a text label) ----- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.chip-fundraising { background: var(--mb-chip-fundraising-bg); color: var(--mb-chip-fundraising-fg); }
.chip-active { background: var(--mb-chip-active-bg); color: var(--mb-chip-active-fg); }
.chip-planting { background: var(--mb-chip-planting-bg); color: var(--mb-chip-planting-fg); }
.chip-maintenance { background: var(--mb-chip-maintenance-bg); color: var(--mb-chip-maintenance-fg); }
.chip-completed { background: var(--mb-chip-completed-bg); color: var(--mb-chip-completed-fg); }
.chip-suspended { background: var(--mb-chip-suspended-bg); color: var(--mb-chip-suspended-fg); }
.chip-draft { background: var(--mb-chip-draft-bg); color: var(--mb-chip-draft-fg); }
.chip-danger { background: var(--mb-chip-danger-bg); color: var(--mb-chip-danger-fg); }
.chip-mine { background: var(--mb-chip-mine-bg); color: var(--mb-chip-mine-fg); }

/* ----- Alerts ----- */
.alert {
  padding: 12px 14px;
  border-radius: var(--mb-radius);
  font-size: 14px;
  line-height: 1.6;
}

.alert-error { background: var(--mb-danger-bg); color: var(--mb-danger); font-weight: 600; }
.alert-warning { background: var(--mb-warning-bg); color: var(--mb-warning-fg); }
.alert-success { background: var(--mb-success-bg); color: var(--mb-success-fg); }
.alert-info { background: var(--mb-info-bg); color: var(--mb-info-fg); }

.alert ul {
  margin: 6px 0 0;
  padding-inline-start: 20px;
}

/* ----- Tabs ----- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--mb-border-strong);
  overflow-x: auto;
}

.tab {
  min-height: var(--mb-touch);
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--mb-muted);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--mb-forest);
  color: var(--mb-ink);
  font-weight: 700;
}

/* ----- Progress ----- */
progress.bar {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 5px;
  background: var(--mb-border);
  accent-color: var(--mb-forest);
  appearance: none;
}

progress.bar::-webkit-progress-bar {
  background: var(--mb-border);
  border-radius: 5px;
}

progress.bar::-webkit-progress-value {
  background: var(--mb-forest);
  border-radius: 5px;
}

progress.bar::-moz-progress-bar {
  background: var(--mb-forest);
  border-radius: 5px;
}

/* ----- Modal dialog ----- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(11, 13, 12, 0.55);
}

.modal {
  width: min(440px, 100%);
  background: var(--mb-card);
  color: var(--mb-ink);
  border-radius: var(--mb-radius-xl);
  box-shadow: var(--mb-shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ----- Public site ----- */
.site-header, .site-footer {
  padding: 12px 16px;
  background: var(--mb-surface);
  border-block-end: 1px solid var(--mb-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-footer {
  border-block-end: 0;
  border-block-start: 1px solid var(--mb-border);
  color: var(--mb-muted);
}

.brand {
  font-family: var(--mb-font-heading);
  font-weight: 700;
  font-size: 22px;
  color: var(--mb-forest);
  text-decoration: none;
}

/* FR-EXT-05: the organization's logo next to its name (header, sidebar, sign-in). */
.brand-logo {
  width: auto;
  height: 32px;
  max-width: 96px;
  object-fit: contain;
  vertical-align: middle;
  margin-inline-end: 8px;
}

.site-main {
  max-width: 72rem;
  margin-inline: auto;
  padding: 24px 16px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ----- Framework UI ----- */
.blazor-error-boundary {
  background: var(--mb-danger-bg);
  color: var(--mb-danger);
  padding: 16px;
  border-radius: var(--mb-radius);
}

#blazor-error-ui {
  background: var(--mb-warning-bg);
  color: var(--mb-warning-fg);
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  display: none;
  inset-inline: 0;
  padding: 10px 20px;
  position: fixed;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  inset-inline-end: 12px;
  top: 8px;
}

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

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

/* Donation status, receipt and verification pages (FR-DON-06/07): one centred card, readable at 320 px. */
.ds, .rc {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  padding: 24px;
  border-radius: var(--mb-radius-xl);
  background: var(--mb-card);
  border: 1px solid var(--mb-border);
  box-shadow: var(--mb-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ds h1, .rc h1 {
  margin: 0;
  font-family: var(--mb-font-heading);
  font-size: 1.75rem;
  line-height: 1.3;
}

.ds-facts, .rc-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.ds-facts dt, .rc-facts dt {
  color: var(--mb-muted);
}

.ds-facts dd, .rc-facts dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.rc-amount {
  font-size: 1.25rem;
}

.rc-eyebrow, .rc-lead, .ds-note {
  margin: 0;
  color: var(--mb-muted);
}

.ds-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 24px;
  background: var(--mb-forest);
  color: var(--mb-on-accent);
  font-weight: 700;
  text-decoration: none;
}

.ds-button:hover {
  background: var(--mb-forest-deep);
  color: var(--mb-on-accent);
}

.ds-button-secondary {
  background: var(--mb-card-muted);
  color: var(--mb-ink);
  border: 1px solid var(--mb-border-strong);
}

.ds-button-secondary:hover {
  background: var(--mb-border);
  color: var(--mb-ink);
}

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

.rc-verify {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--mb-border);
}

.rc-verify p {
  margin: 0 0 6px;
}

.rc-verify > div {
  min-width: 0;
}

.rc-code,
.rc-verify a,
.rc-facts dd {
  overflow-wrap: anywhere;
}

.rc-code {
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Two cards side by side on wide screens (dashboard donation detail). */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 16px;
  margin-block-end: 16px;
}

.timeline {
  margin: 0;
  padding-inline-start: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline li span + strong,
.timeline li strong + span {
  margin-inline-start: 8px;
}

.ds-spinner {
  inline-size: 40px;
  block-size: 40px;
  border-radius: 50%;
  border: 4px solid var(--mb-border);
  border-block-start-color: var(--mb-forest);
  animation: ds-spin 1s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .ds-spinner {
    animation: none;
  }
}

@media (max-width: 480px) {
  .rc-verify {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- P2-B: campaigns, volunteers, monthly giving, annual report ---- */

.pre-line {
  white-space: pre-line;
}

.checkin-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.checkin img {
  display: block;
  margin-block: 8px;
}

.hours-input {
  width: 5.5em;
}

.share-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  list-style: none;
  margin: 8px 0;
  padding: 0;
}

.copy-link {
  width: 100%;
  max-width: 100%;
}

.cp, .annual {
  display: grid;
  gap: 16px;
  max-width: 880px;
  margin-inline: auto;
}

.cp-progress progress {
  width: 100%;
  height: 12px;
  accent-color: var(--mb-forest);
}

.cp-raised strong {
  font-size: 22px;
}

.cohort td,
.cohort th {
  text-align: center;
}
