:root {
  color-scheme: light;
  --background: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #fff6fa;
  --text: #1d2433;
  --muted: #667085;
  --border: #d9dee8;
  --border-strong: #b8c0cf;
  --brand: #c21869;
  --brand-dark: #92134f;
  --brand-soft: #fce7f1;
  --blue: #087ca7;
  --success: #147a4b;
  --success-soft: #eaf8f1;
  --warning: #8a5a00;
  --warning-soft: #fff5d9;
  --danger: #a32d2d;
  --danger-soft: #fdecec;
  --shadow: 0 12px 32px rgba(29, 36, 51, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--brand-dark);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.header-inner {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
  text-decoration: none;
}

.text-link {
  font-weight: 700;
  text-underline-offset: 3px;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.page-content {
  padding-top: 48px;
  padding-bottom: 72px;
}

.hero {
  padding: 48px;
  border: 1px solid #edb4d1;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffffff 0%, var(--surface-soft) 100%);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 820px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.hero-copy {
  max-width: 720px;
  margin-bottom: 32px;
  color: var(--muted);
  font-size: 1.08rem;
}

.event-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.fact-card {
  min-height: 112px;
  padding: 18px;
  border: 1px solid #efd4e2;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
}

.fact-card strong {
  display: block;
  line-height: 1.35;
}

.fact-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.notice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin: 24px 0;
  padding: 24px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice-card h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.notice-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.notice-card li + li {
  margin-top: 4px;
}

.contact-block {
  display: grid;
  min-width: 280px;
  gap: 3px;
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

.contact-block span {
  color: var(--muted);
  font-size: 0.82rem;
}

.contact-block a {
  font-weight: 700;
}

.application-card,
.admin-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.application-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 38px 16px;
}

.application-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.application-heading > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.required {
  color: var(--brand);
  font-weight: 800;
}

.form-intro {
  margin: 0;
  padding: 0 38px 28px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.field-section {
  padding: 34px 38px 40px;
  border-bottom: 1px solid var(--border);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 26px;
}

.section-heading h3 {
  margin-bottom: 3px;
  font-size: 1.18rem;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.section-number {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.field-grid {
  display: grid;
  gap: 20px;
}

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

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

.span-two {
  grid-column: span 2;
}

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

.field {
  display: grid;
  align-content: start;
  gap: 7px;
  color: #343b4a;
  font-size: 0.9rem;
  font-weight: 680;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  font-weight: 450;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field input,
.field select {
  min-height: 44px;
  padding: 9px 11px;
}

.field textarea {
  min-height: 76px;
  padding: 11px;
  resize: vertical;
}

.field input[type="file"] {
  padding: 7px;
  background: #fafbfc;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(194, 24, 105, 0.13);
}

.field small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 450;
}

.payment-qr-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
}

.payment-qr-copy {
  max-width: 500px;
}

.payment-qr-copy strong {
  display: block;
  margin-bottom: 6px;
}

.payment-qr-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.payment-qr-image {
  display: block;
  width: min(100%, 360px);
  height: auto;
  flex: 0 1 360px;
  border-radius: 8px;
  background: #ffffff;
}

.choice-group {
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
}

.choice-label {
  margin-bottom: 12px;
  color: #343b4a;
  font-size: 0.9rem;
  font-weight: 700;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
}

.choice input,
.declaration-choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.declaration-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
  cursor: pointer;
  font-size: 0.92rem;
}

.declaration-choice input {
  flex: 0 0 18px;
  margin-top: 2px;
}

.submission-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 28px 38px;
  background: #fafbfc;
}

.submission-bar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.primary-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.view-link:focus-visible,
.text-link:focus-visible,
.brand:focus-visible {
  outline: 3px solid rgba(8, 124, 167, 0.35);
  outline-offset: 3px;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.submission-result {
  margin: 0 38px 38px;
  padding: 20px;
  border: 1px solid #aadac2;
  border-radius: 10px;
  background: var(--success-soft);
  color: #115c3b;
}

.submission-result.is-error {
  border-color: #efb1b1;
  background: var(--danger-soft);
  color: var(--danger);
}

.submission-result h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.submission-result p {
  margin: 0;
}

.site-footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer p {
  margin: 0;
}

/* Admin */

.admin-login-dialog {
  width: min(460px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(21, 26, 34, 0.28);
}

.admin-login-dialog::backdrop {
  background: rgba(21, 26, 34, 0.62);
}

.admin-login-card {
  padding: 30px;
}

.admin-login-card h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.admin-login-card > p:not(.eyebrow):not(.admin-login-error) {
  margin-bottom: 22px;
  color: var(--muted);
}

.admin-login-fields {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-login-field {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

.admin-login-field input,
.status-editor select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.admin-login-field input {
  padding: 10px 12px;
}

.admin-login-field input:focus-visible,
.status-editor select:focus-visible {
  border-color: var(--brand);
  outline: 3px solid rgba(8, 124, 167, 0.2);
  outline-offset: 1px;
}

.admin-login-error {
  margin-bottom: 16px;
  color: var(--danger);
  font-size: 0.88rem;
}

.admin-login-card .primary-button {
  width: 100%;
}

.admin-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.admin-heading h1 {
  margin-bottom: 5px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
}

.admin-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.admin-panel-header h2 {
  margin-bottom: 3px;
  font-size: 1.2rem;
}

.admin-panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.admin-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-detail-actions .admin-pdf-message {
  flex-basis: 100%;
  color: var(--danger);
  text-align: right;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.summary-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.summary-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-card strong {
  font-size: 1.4rem;
}

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

.applications-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.applications-table th,
.applications-table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.applications-table th {
  background: #fafbfc;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.applications-table td {
  font-size: 0.9rem;
}

.applications-table tr:last-child td {
  border-bottom: 0;
}

.candidate-cell {
  display: grid;
  gap: 2px;
}

.candidate-cell span {
  color: var(--muted);
  font-size: 0.8rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: capitalize;
}

.status-badge[data-status="approved"] {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge[data-status="needs_changes"],
.status-badge[data-status="rejected"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.view-link {
  font-weight: 750;
  text-underline-offset: 3px;
}

.detail-content {
  padding: 28px;
}

.metadata-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metadata-grid {
  margin-bottom: 24px;
}

.status-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px 28px;
  margin-bottom: 26px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
}

.status-editor h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.status-editor p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.status-editor-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-editor select {
  min-width: 210px;
  padding: 9px 34px 9px 11px;
}

.status-update-message {
  grid-column: 1 / -1;
  color: var(--success) !important;
  font-weight: 700;
}

.status-update-message.is-error {
  color: var(--danger) !important;
}

.metadata-item,
.detail-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fafbfc;
}

.metadata-item dt,
.detail-item dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.metadata-item dd,
.detail-item dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 0.92rem;
}

.detail-image-container {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-start;
}

.detail-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 36rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  object-fit: contain;
}

.detail-image-fallback {
  color: var(--muted);
  font-style: italic;
}

.detail-section + .detail-section {
  margin-top: 26px;
}

.detail-section h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.detail-item.wide {
  grid-column: span 2;
}

.detail-item.full {
  grid-column: 1 / -1;
}

.config-value {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #151a22;
  color: #f5f7fa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.empty-state,
.error-state {
  padding: 54px 28px;
  text-align: center;
}

.empty-state p,
.error-state p {
  max-width: 560px;
  margin-right: auto;
  margin-left: auto;
  color: var(--muted);
}

.error-state h2 {
  color: var(--danger);
}

@media (max-width: 900px) {
  .event-facts,
  .three-columns,
  .metadata-grid,
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .event-facts .fact-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .three-columns .span-three {
    grid-column: 1 / -1;
  }

  .notice-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .contact-block {
    width: 100%;
    min-width: 0;
    padding-top: 18px;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 24px);
    max-width: 1180px;
  }

  .header-inner {
    min-height: 58px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
  }

  .header-links {
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  .page-content {
    padding-top: 20px;
    padding-bottom: 40px;
  }

  .hero {
    padding: 28px 22px;
    border-radius: 14px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .event-facts,
  .three-columns,
  .two-columns,
  .summary-row,
  .metadata-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .event-facts .fact-card:last-child:nth-child(odd),
  .span-two,
  .span-three,
  .detail-item.wide,
  .detail-item.full {
    grid-column: auto;
  }

  .fact-card {
    min-height: 0;
  }

  .notice-card {
    padding: 22px;
  }

  .application-heading,
  .field-section,
  .submission-bar,
  .admin-panel-header,
  .detail-content {
    padding-right: 20px;
    padding-left: 20px;
  }

  .application-heading,
  .submission-bar,
  .admin-heading,
  .admin-panel-header,
  .status-editor,
  .status-editor-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .status-editor {
    display: flex;
  }

  .admin-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-detail-actions .admin-pdf-message {
    text-align: left;
  }

  .status-editor select {
    min-width: 0;
  }

  .application-heading {
    padding-top: 26px;
  }

  .form-intro {
    padding-right: 20px;
    padding-bottom: 24px;
    padding-left: 20px;
  }

  .field-section {
    padding-top: 28px;
    padding-bottom: 32px;
  }

  .choice-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .payment-qr-card {
    align-items: stretch;
    flex-direction: column;
  }

  .payment-qr-image {
    align-self: center;
    flex-basis: auto;
  }

  .choice {
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .submission-result {
    margin-right: 20px;
    margin-left: 20px;
  }

  .summary-row {
    padding-right: 20px;
    padding-left: 20px;
  }

  .applications-table th,
  .applications-table td {
    padding: 13px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .field input,
  .field select,
  .field textarea {
    transition: none;
  }
}
