:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #637083;
  --line: #d8dee8;
  --surface: #fff;
  --canvas: #f5f7fa;
  --brand: #e9632c;
  --brand-dark: #bd4317;
  --navy: #19275d;
  --danger: #b42318;
  --success: #087443;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.5; }
a { color: #174ea6; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

.app-header { min-height: 64px; display: flex; align-items: center; gap: 28px; padding: 0 32px; color: #fff; background: var(--navy); }
.brand { color: #fff; font-weight: 750; text-decoration: none; white-space: nowrap; }
.app-header nav { display: flex; gap: 20px; flex: 1; }
.app-header nav a { color: #e9edff; text-decoration: none; }
.app-header nav a:hover { color: #fff; text-decoration: underline; }
.account { display: flex; align-items: center; gap: 12px; font-size: 0.875rem; }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 36px auto 72px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1, .login-card h1 { margin: 0; line-height: 1.15; }
.page-heading p { margin: 6px 0 0; color: var(--muted); }
.eyebrow { color: var(--brand-dark); font-size: 0.8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; padding: 8px 15px; font-weight: 700; text-decoration: none; cursor: pointer; }
.button.primary { color: #fff; background: var(--brand-dark); }
.button.primary:hover { background: #99330f; }
.button.secondary { color: var(--navy); border-color: #aeb8cb; background: #fff; }
.button.ghost { color: var(--navy); background: transparent; }
.button.danger { color: #fff; background: var(--danger); }
.button.small { min-height: 34px; padding: 5px 10px; font-size: .875rem; }
.button:disabled { opacity: .55; cursor: wait; }
.link-button { padding: 0; border: 0; color: inherit; background: transparent; text-decoration: underline; cursor: pointer; }
.link-button.danger { color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

.card, fieldset, .review-card, .login-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 3px 14px rgba(25,39,93,.05); }
.card, .review-card { padding: 24px; }
.card h2 { margin-top: 0; }
.login-card { width: min(520px, 100%); margin: 72px auto; padding: 36px; text-align: center; }
.login-letterhead { width: 100%; max-width: 460px; }
.google-button { margin-top: 14px; }

fieldset { margin: 0 0 22px; padding: 22px; }
legend { padding: 0 8px; font-size: 1.05rem; font-weight: 750; }
.fieldset-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fieldset-heading legend { float: left; }
.form-grid { display: grid; gap: 16px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.donation-columns { grid-template-columns: 1fr 1.4fr 1.4fr .8fr; }
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #aeb8c8; border-radius: 7px; padding: 9px 10px; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus, button:focus, a:focus { outline: 3px solid rgba(23,78,166,.26); outline-offset: 2px; }
textarea { min-height: 90px; resize: vertical; }
.optional { color: var(--muted); font-size: .8rem; font-weight: 400; }
.donation-row { padding: 16px 0; border-top: 1px solid var(--line); }
.donation-row:first-child { border-top: 0; }
.donation-row-heading { display: flex; align-items: center; justify-content: space-between; }
.donation-row-heading h3 { margin: 0 0 10px; }
.live-total { margin-top: 12px; text-align: right; font-size: 1.2rem; }
.step-title { display: flex; align-items: center; gap: 10px; margin-top: 0; }
.step-title span { display: inline-grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #fff; background: var(--navy); font-size: .9rem; }

.filter-bar, .inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; margin-bottom: 22px; }
.filter-bar label:first-child { flex: 1; }
.inline-form label:first-child { flex: 1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: #39465a; background: #f1f4f8; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table.compact th, .data-table.compact td { padding: 9px 11px; }
.numeric { text-align: right !important; white-space: nowrap; }
.status-pill { display: inline-flex; border-radius: 999px; padding: 3px 9px; font-size: .75rem; font-weight: 800; }
.status-pill.finalized { color: #075f38; background: #dff6e9; }
.status-pill.void { color: #8f1d14; background: #fee7e5; }
.pagination { display: flex; justify-content: center; gap: 18px; margin-top: 18px; }
.empty-state { padding: 52px 24px; border: 1px dashed #aeb8c8; border-radius: 12px; text-align: center; background: #fff; }

.alert { margin: 12px 0; border-radius: 8px; padding: 12px 14px; }
.alert.error { color: #7a160f; border: 1px solid #f2a7a0; background: #fff0ef; }
.alert.warning { color: #684600; border: 1px solid #e9c567; background: #fff7da; }
.success-message { color: var(--success); font-weight: 750; }
.review-section { margin-bottom: 22px; }
.review-section p { white-space: pre-line; }
.review-section h3 { margin-bottom: 7px; }
.review-table { width: 100%; border-collapse: collapse; }
.review-table th, .review-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
.review-table .numeric { text-align: right; }
.pdf-preview { display: block; width: 100%; height: 760px; border: 1px solid var(--line); border-radius: 8px; background: #ddd; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr); gap: 22px; align-items: start; }
.detail-preview { height: 600px; margin-bottom: 14px; }
.metadata-list { margin: 0 0 24px; }
.metadata-list div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.metadata-list dt { color: var(--muted); font-weight: 700; }
.metadata-list dd { margin: 0; }
.hash { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
.danger-zone { margin-top: 24px; border-color: #e5a29c; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 800px) {
  .app-header { flex-wrap: wrap; padding: 14px 18px; gap: 14px; }
  .app-header nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .account { margin-left: auto; }
  .page-shell { margin-top: 24px; }
  .page-heading, .filter-bar, .inline-form { align-items: stretch; flex-direction: column; }
  .two-columns, .donation-columns, .detail-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .pdf-preview { height: 560px; }
}
