:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #1f1f1f;
  background: #ece7dc;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: #002554; }
button, .button {
  display: inline-block;
  border: 0;
  border-radius: .25rem;
  background: #075c9c;
  color: #fff;
  padding: .65rem 1rem;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.admin { background: #f4f6f8; font-size: 14px; }
.link-button { padding: 0; background: none; color: #fff; }
.adminbar { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.25rem; background: #172b3a; color: #fff; }
.adminbar a { color: #fff; }
.wide { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; }
.narrow { max-width: 600px; margin: 4rem auto; }
.card { background: #fff; border: 1px solid #dce2e7; border-radius: .5rem; padding: 1.25rem; margin: 1rem 0; box-shadow: 0 2px 8px #0000000a; }
.title-row, .inline { display: flex; align-items: end; gap: 1rem; flex-wrap: wrap; }
.title-row { justify-content: space-between; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; min-width: 12rem; }
label.checkbox { min-width: auto; flex-direction: row; align-items: center; padding-bottom: .7rem; }
input, select, textarea { border: 1px solid #aab5bd; border-radius: .3rem; padding: .55rem; font: inherit; background: #fff; }
textarea { min-height: 5rem; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.admin-search { margin: 1rem 0; }
.admin-search label { margin-bottom: .35rem; }
.search-controls { display: flex; align-items: center; gap: .65rem; }
.search-controls input { width: min(32rem, 100%); }
.data-management-card { margin-top: 2rem; }
.data-management-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.data-management-grid form { padding: 1rem; border: 1px solid #dce3e8; border-radius: .5rem; background: #fafbfc; }
.data-management-grid h3 { margin: 0; color: #294657; }
.data-management-grid p { min-height: 2.5rem; color: #687680; }
.data-management-grid label { margin: 0 0 .75rem; }
.data-management-grid input[type="file"] { width: 100%; background: #fff; }
.button-danger { background: #a52323; }
.race-row { display: grid; grid-template-columns: 2fr 2fr 6rem repeat(3, auto) auto auto; gap: .6rem; align-items: end; padding: .8rem 0; border-bottom: 1px solid #e2e7eb; }
.race-row label { min-width: 0; }
.race-row code { align-self: center; }
.branding-control { padding: .8rem; border: 1px solid #e2e7eb; border-radius: .35rem; }
.branding-control form { margin-top: .75rem; }
.branding-control .clear-image { padding-top: .75rem; border-top: 1px solid #e2e7eb; }
.race-editor { padding: 1rem 0; border-bottom: 1px solid #e2e7eb; }
.race-fields { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 420px) 5rem repeat(2, auto); gap: .65rem; align-items: end; }
.race-fields label { min-width: 0; }
.race-fields input[type="text"], .race-fields input:not([type]) { width: 100%; }
.race-token { margin-top: .65rem; }
.autosave-hint { margin-left: .75rem; color: #59636b; }
.error { background: #ffe8e8; color: #8a1515; padding: .8rem; border-radius: .3rem; }
.hint { color: #59636b; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: .75rem; border-bottom: 1px solid #dde3e8; }
.section-table-wrap { overflow-x: auto; border: 1px solid #dce2e7; border-radius: .55rem; background: #fff; box-shadow: 0 2px 8px #0000000a; }
.section-table { min-width: 850px; }
.section-table th { background: #eef2f5; color: #43535e; font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; }
.section-table tr:last-child td { border-bottom: 0; }
.section-table tbody tr:hover { background: #f8fafb; }
.section-table th:first-child, .section-header-cell { width: 28%; max-width: 280px; }
.section-header-cell { font-weight: 700; white-space: pre-line; }
.updated-cell { color: #65737c; white-space: nowrap; }
.actions-heading { width: 154px; }
.section-actions { display: flex; flex-wrap: nowrap; gap: 5px; white-space: nowrap; }
.button-small { padding: .46rem .72rem; font-size: .82rem; font-weight: 700; }

/* Admin section editor */
.adminbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 56px;
  padding: .85rem 1.5rem;
  box-shadow: 0 2px 10px #0b172033;
}
.adminbar-brand { display: flex; align-items: center; gap: 1rem; }
.adminbar-brand span { padding-left: 1rem; border-left: 1px solid #ffffff3d; font-weight: 700; }
.editor-shell { max-width: 1280px; margin-top: 2.5rem; margin-bottom: 5rem; }
.editor-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; margin-bottom: 1.5rem; }
.editor-heading h1 { max-width: 850px; margin: .15rem 0 .65rem; font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1.18; white-space: pre-line; }
.eyebrow { margin: 0; color: #61707b; font-size: .75rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.editor-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem 1rem; color: #66737c; }
.editor-meta code { padding: .28rem .5rem; border: 1px solid #d7dfe5; border-radius: .3rem; background: #fff; color: #27343d; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: .25rem .65rem; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.status-active { background: #daf4e5; color: #17653a; }
.status-draft { background: #fff0c7; color: #765500; }
.status-disabled { background: #eceff2; color: #5c6770; }
.button-secondary { border: 1px solid #075c9c; background: #fff; color: #075c9c; white-space: nowrap; }
.button-quiet { padding: .45rem .7rem; border: 1px solid #c4ced5; background: #fff; color: #33434e; font-size: .82rem; }
.editor-card { margin: 1.25rem 0; padding: 1.5rem; border-color: #d7e0e6; border-radius: .7rem; box-shadow: 0 4px 18px #1529380a; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid #e5eaee; }
.card-heading h2, .card-heading p, .brand-title h3, .brand-title p, .race-section-heading h3, .race-section-heading p { margin: 0; }
.card-heading h2 { color: #1d3545; font-size: 1.2rem; }
.card-heading p, .race-section-heading p { margin-top: .3rem; color: #687680; }
.section-details-grid { display: grid; grid-template-columns: minmax(0, 820px); gap: 1.1rem; }
.section-details-grid label { min-width: 0; }
.section-details-grid input, .section-details-grid select, .section-details-grid textarea { width: 100%; }
.field-url, .field-footer-url { grid-column: 1; }
.field-help { color: #697780; font-size: .78rem; font-weight: 400; }
.form-actions { display: flex; justify-content: flex-start; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e5eaee; }
.branding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.brand-panel { overflow: hidden; border: 1px solid #dce3e8; border-radius: .6rem; background: #fafbfc; }
.brand-preview { display: grid; place-items: center; height: 190px; overflow: hidden; border-bottom: 1px solid #dce3e8; background: repeating-conic-gradient(#eef1f3 0 25%, #f8f9fa 0 50%) 50% / 24px 24px; color: #67757f; }
.brand-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.background-preview img { object-fit: cover; }
.brand-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1rem 0; }
.brand-title h3 { font-size: 1rem; }
.brand-title p { margin-top: .3rem; color: #61707a; }
.brand-upload { display: flex; align-items: end; gap: .75rem; padding: 1rem; }
.brand-upload label { flex: 1; min-width: 0; }
.brand-upload input[type="file"] { width: 100%; padding: .42rem; background: #fff; }
.upload-feedback { margin-top: 1rem; padding: .8rem 1rem; border: 1px solid; border-radius: .4rem; font-weight: 600; }
.upload-feedback.is-success { border-color: #a8d9bb; background: #e9f7ee; color: #17653a; }
.upload-feedback.is-error { border-color: #efbcbc; background: #fff0f0; color: #8a1515; }
.add-meeting-card { border-left: 4px solid #075c9c; }
.meeting-settings { display: grid; grid-template-columns: minmax(320px, 1fr) 6rem auto; align-items: end; gap: 1rem; }
.meeting-settings label { min-width: 0; }
.meeting-settings textarea { min-height: 4.5rem; }
.meetings-heading { display: flex; justify-content: space-between; align-items: end; margin: 2.5rem 0 1rem; }
.meetings-heading h2 { margin: .2rem 0 0; color: #243b4a; }
.meetings-heading > span, .race-section-heading > span { color: #687680; font-size: .85rem; }
.meeting-card { padding: 0; overflow: hidden; border-top: 4px solid #294f68; }
.meeting-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.5rem; background: #f7f9fa; border-bottom: 1px solid #e0e6ea; }
.meeting-card-heading h2 { margin: .3rem 0 0; color: #203847; font-size: 1.15rem; white-space: pre-line; }
.meeting-order { color: #6c7881; font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.meeting-settings-form { padding: 1.25rem 1.5rem; border-bottom: 1px solid #e0e6ea; }
.race-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.5rem; }
.race-editors { border-top: 1px solid #e5eaee; }
.race-editor { padding: 1rem 1.5rem; background: #fff; }
.race-editor:nth-child(even) { background: #fafbfc; }
.race-editor:last-child { border-bottom: 0; }
.race-token { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; color: #5e6c76; font-size: .8rem; }
.race-token code { padding: .18rem .4rem; border-radius: .25rem; background: #edf2f5; color: #243844; }
.race-token em { color: #77838b; }
.autosave-hint { margin-left: auto; color: #34734c; }
.add-race-form { margin: 0; padding: 1.25rem 1.5rem 1.5rem; border-top: 1px solid #dbe3e8; background: #f2f6f8; }
.add-race-form h3 { margin: 0 0 1rem; color: #294657; font-size: 1rem; }
.meeting-save-actions { display: flex; justify-content: flex-start; padding: 1rem 1.5rem 1.35rem; border-top: 1px solid #dbe3e8; background: #f2f6f8; }
.status-toggle-form { margin: 0; }
.status-toggle { min-width: 0; flex-direction: row; align-items: center; gap: .55rem; cursor: pointer; }
.status-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-track { display: inline-flex; align-items: center; width: 38px; height: 22px; padding: 3px; border-radius: 999px; background: #9ca8af; transition: background .15s ease; }
.toggle-track span { width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0004; transition: transform .15s ease; }
.status-toggle input:checked + .toggle-track { background: #23834b; }
.status-toggle input:checked + .toggle-track span { transform: translateX(16px); }
.status-toggle input:focus-visible + .toggle-track { outline: 3px solid #7db5dd; outline-offset: 2px; }
.status-toggle strong { color: #53616a; font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; }
.status-toggle input:checked ~ strong { color: #17653a; }
.empty-state { padding: 1.5rem; color: #687680; text-align: center; }
.error { border: 1px solid #efbcbc; }

@media (max-width: 980px) {
  .section-details-grid, .branding-grid { grid-template-columns: 1fr; }
  .field-url, .field-status, .field-footer-url { grid-column: 1; }
  .meeting-settings, .race-fields { grid-template-columns: 1fr 7rem auto; }
  .meeting-header-field, .race-name, .doc-id { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .adminbar { padding: .75rem 1rem; }
  .adminbar-brand span { display: none; }
  .editor-shell { margin-top: 1.25rem; }
  .editor-heading, .card-heading, .meetings-heading { align-items: stretch; flex-direction: column; }
  .editor-card { padding: 1.1rem; }
  .branding-grid, .meeting-settings, .race-fields { grid-template-columns: 1fr; }
  .data-management-grid { grid-template-columns: 1fr; }
  .brand-upload { align-items: stretch; flex-direction: column; }
  .meeting-card-heading, .meeting-settings-form, .race-section-heading, .race-editor, .add-race-form { padding-right: 1rem; padding-left: 1rem; }
  .autosave-hint { width: 100%; margin-left: 0; }
}

body.public {
  min-height: 100vh;
  padding-top: 50px;
  background-color: #ece7dc;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  font-size: 12px;
}

.campaign {
  width: min(968px, 100%);
  min-height: 800px;
  margin: 0 auto 50px;
  padding: 0 28px 28px;
  background: #fff;
}

.hero {
  display: block;
  width: calc(100% + 56px);
  max-height: 360px;
  margin: 0 -28px 24px;
  border: 0;
  object-fit: contain;
  background: #fff;
}

.campaign h1,
.campaign h2 {
  color: #a08032;
}

.campaign h1 {
  margin: 18px 0 30px;
  text-align: center;
  font-size: 1.5rem;
  white-space: pre-line;
}

.meeting-columns.multiple-meetings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 54px;
}
.meeting-column { min-width: 0; }
.meeting-columns.single-meeting {
  width: calc(50% - 27px);
  margin-right: auto;
  margin-left: auto;
}

.public-meeting {
  display: inline-block;
  width: 100%;
  margin: 0 0 24px;
  break-inside: avoid;
}

.public-meeting h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  text-align: center;
  white-space: pre-line;
  break-after: avoid;
}

.race-link {
  min-height: 20px;
  line-height: 20px;
  text-align: center;
  break-inside: avoid;
}

.race-link a { color: #002554; text-decoration: none; }
.race-link a:hover, .race-link a:focus { text-decoration: underline; }
.race-link span { color: #666; }
.cache-select { width: 14px; height: 14px; margin: 0 0 0 .35rem; vertical-align: -2px; }
.cache-controls { margin: 0 auto 20px; text-align: center; }
.cache-controls button { min-width: 5rem; }
.campaign footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid #ddd; text-align: center; }
.campaign footer a { white-space: pre-line; }
.document { padding-top: 28px; }
.notice { padding: 1rem; border-left: 4px solid #e0a800; background: #fff7dc; }

@media (max-width: 800px) {
  .race-row { grid-template-columns: 1fr; }
  .race-fields { grid-template-columns: 1fr; }
  .wide { margin: 1rem auto; }
  body.public { padding-top: 0; }
  .campaign { margin: 0 auto; padding: 0 18px 24px; }
  .hero { width: calc(100% + 36px); margin: 0 -18px 20px; }
  .meeting-columns.multiple-meetings { grid-template-columns: 1fr; }
  .meeting-columns.single-meeting { width: 100%; }
}
