:root {
  color-scheme: light;
  --ink: #1d2733;
  --muted: #617283;
  --line: #d8e0e8;
  --paper: #fffdf9;
  --surface: #ffffff;
  --blue: #22577a;
  --green: #2d6a4f;
  --gold: #b7791f;
  --rose: #a23e48;
  --focus: #1f7a8c;
  --shadow: 0 24px 70px rgba(29, 39, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(34, 87, 122, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(45, 106, 79, 0.12), transparent 34%),
    #f4f7f8;
}

button,
input,
select {
  font: inherit;
}

p {
  margin: 0;
}

.page-shell,
.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.form-panel {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 28px;
  background: var(--paper);
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-header,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.form-header {
  justify-content: flex-start;
}

.brand-mark {
  display: grid;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.brand-mark svg {
  width: 46px;
  height: 46px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(1.7rem, 2vw + 1rem, 2.6rem);
  line-height: 1.08;
}

.event-description {
  max-width: 720px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

h2 {
  font-size: 1.1rem;
}

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

.field,
.choice-group,
.breakdown-section,
.sessions-section {
  display: grid;
  gap: 8px;
}

.field span,
legend {
  color: #2f3f4d;
  font-weight: 760;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #bdcad5;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

.field input:focus,
.field select:focus,
.segmented input:focus-visible + span,
.session-card input:focus-visible + span,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(31, 122, 140, 0.28);
  outline-offset: 2px;
}

.phone-field {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(160px, 1.1fr);
  gap: 8px;
}

small {
  min-height: 18px;
  color: var(--rose);
  font-size: 0.82rem;
}

fieldset {
  min-width: 0;
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}

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

.segmented label,
.session-card {
  cursor: pointer;
}

.segmented input,
.session-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span,
.session-card span {
  display: grid;
  min-height: 46px;
  place-items: center;
  padding: 10px;
  border: 1px solid #bdcad5;
  border-radius: 6px;
  background: #fff;
  color: #2f3f4d;
  font-weight: 720;
  text-align: center;
}

.segmented input:checked + span {
  border-color: var(--blue);
  background: #e7f0f5;
  color: var(--blue);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

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

.breakdown-total {
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.breakdown-total.is-mismatch {
  color: var(--rose);
}

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

.session-card span {
  min-height: 58px;
  justify-items: start;
  padding: 12px;
  text-align: left;
}

.session-card span::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-bottom: 6px;
  border: 2px solid #91a1af;
  border-radius: 5px;
}

.session-card strong,
.session-card em,
.session-card b,
.session-card small {
  display: block;
  width: 100%;
  line-height: 1.28;
}

.session-card strong {
  font-size: 0.98rem;
}

.session-card em {
  margin-top: 4px;
  color: var(--blue);
  font-size: 0.86rem;
  font-style: normal;
}

.session-card b {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.session-card small {
  min-height: 0;
  margin-top: 5px;
  color: var(--green);
  font-size: 0.78rem;
}

.session-card input:checked + span {
  border-color: var(--green);
  background: #e8f4ee;
  color: #1f513a;
}

.session-card input:checked + span::before {
  border-color: var(--green);
  background:
    linear-gradient(135deg, transparent 40%, #fff 40% 55%, transparent 55%),
    var(--green);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary-button,
.secondary-button {
  padding: 0 18px;
}

.primary-button {
  color: #fff;
  background: var(--blue);
}

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

.secondary-button {
  color: var(--ink);
  border-color: #bdcad5;
  background: #fff;
}

.text-button {
  min-height: 34px;
  padding: 0 8px;
  color: var(--blue);
  background: transparent;
}

.danger-text {
  color: var(--rose);
}

.icon-button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #bdcad5;
  border-radius: 6px;
  color: var(--blue);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.primary-button svg,
.secondary-button svg {
  width: 19px;
  height: 19px;
}

.form-message {
  display: none;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 6px;
  font-weight: 720;
}

.form-message.is-success {
  display: block;
  color: #174b34;
  background: #e8f4ee;
  border: 1px solid #b7dcc8;
}

.form-message.is-error {
  display: block;
  color: #7a1f2a;
  background: #fff0f2;
  border: 1px solid #ecc1c8;
}

.admin-shell {
  display: grid;
  gap: 22px;
}

.is-hidden {
  display: none !important;
}

.admin-access {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(29, 39, 51, 0.08);
}

.admin-access p {
  margin-top: 6px;
  color: var(--muted);
}

.token-form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.token-field {
  width: min(340px, 44vw);
}

.verify-field {
  width: min(220px, 34vw);
}

.password-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.password-wrap input {
  min-width: 0;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.summary-item {
  min-height: 94px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-item span {
  font-size: 1.8rem;
  font-weight: 850;
}

.table-wrap {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(29, 39, 51, 0.08);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading p {
  margin-top: 6px;
  color: var(--muted);
}

.upload-form {
  display: flex;
  align-items: end;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e7edf2;
}

.file-field {
  display: grid;
  flex: 1 1 420px;
  gap: 8px;
  color: #2f3f4d;
  font-weight: 760;
}

.file-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px;
  border: 1px dashed #9fb0bf;
  border-radius: 6px;
  background: #fbfcfd;
}

.event-details-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

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

.session-editor-header,
.session-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.session-editor-header h3 {
  margin: 0;
  font-size: 1rem;
}

.session-editor {
  display: grid;
  gap: 12px;
}

.session-edit-row {
  padding: 14px;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  background: #fbfcfd;
}

.session-row-title {
  margin-bottom: 12px;
}

.session-row-title strong {
  overflow-wrap: anywhere;
}

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

.wide-field {
  grid-column: span 2;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 14px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e7edf2;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.session-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #dbe4ec;
  border-radius: 6px;
  background: #fbfcfd;
  color: #314354;
  font-weight: 700;
}

.inline-check input {
  width: 16px;
  height: 16px;
}

.breakdown-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.breakdown-list span {
  display: inline-flex;
  min-width: 44px;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 999px;
  background: #edf7f2;
  color: #22543d;
  font-size: 0.8rem;
  font-weight: 800;
}

.pill {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  background: #f1f4f7;
  color: #314354;
  font-size: 0.82rem;
  font-weight: 700;
}

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

@media (max-width: 760px) {
  .page-shell,
  .admin-shell {
    width: min(100% - 20px, 1120px);
    padding: 16px 0;
  }

  .form-panel {
    padding: 18px;
  }

  .form-header,
  .admin-header,
  .admin-access,
  .token-form {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-grid,
  .phone-field,
  .breakdown-grid,
  .segmented,
  .session-grid,
  .summary-band,
  .session-edit-grid {
    grid-template-columns: 1fr;
  }

  .upload-form,
  .section-heading,
  .session-editor-header,
  .session-row-title {
    align-items: stretch;
    flex-direction: column;
  }

  .wide-field {
    grid-column: auto;
  }

  .actions,
  .actions button,
  .token-field,
  .verify-field,
  .token-form,
  .token-form button,
  .admin-header .secondary-button,
  .upload-form .primary-button {
    width: 100%;
  }
}
