:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #182235;
  --muted: #68758a;
  --line: #d7e0ec;
  --blue: #0d63c7;
  --blue-dark: #07488f;
  --green: #14865a;
  --amber: #b87900;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: var(--blue);
  text-decoration: none;
}

.app-header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.page {
  margin: 0 auto;
  max-width: 1220px;
  padding: 32px 24px 56px;
}

/* Wider canvas for template / project config editors */
.page:has(.generator-stack),
.page:has(.generator-grid) {
  max-width: 1480px;
}

.section-head {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 22px;
}

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

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

.helper-text {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
}

.track-fieldset,
.ticket-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  text-align: left;
}

.track-fieldset legend,
.ticket-fieldset legend {
  font-weight: 700;
  padding: 0 6px;
  text-align: left;
}

/* Override global label { display:grid } so radios stay compact and left-aligned */
.radio-row {
  align-items: center;
  display: flex !important;
  flex-direction: row !important;
  gap: 10px;
  grid-template-columns: none !important;
  justify-content: flex-start;
  margin: 8px 0;
  max-width: 100%;
  width: auto;
}

.radio-row input[type="radio"] {
  accent-color: var(--blue);
  flex: 0 0 auto;
  height: 1.05rem;
  margin: 0;
  max-height: 1.05rem;
  max-width: 1.05rem;
  min-height: 1.05rem !important;
  min-width: 1.05rem;
  width: 1.05rem !important;
}

.radio-row {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.ticket-other input[type="number"] {
  max-width: 100px;
  min-height: 34px;
}

/* Slot rows: checkbox + text left-aligned (not grid-stretched) */
.slot {
  align-items: flex-start;
  display: flex !important;
  flex-direction: row !important;
  gap: 12px;
  grid-template-columns: none !important;
  text-align: left;
}

.slot input[type="checkbox"] {
  flex: 0 0 auto;
  height: 1.05rem;
  margin-top: 3px;
  max-height: 1.05rem;
  max-width: 1.05rem;
  min-height: 1.05rem !important;
  min-width: 1.05rem;
  width: 1.05rem !important;
}

.slot > span {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.slot[hidden] {
  display: none !important;
}

.filter-bar {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  min-width: 200px;
}

.filter-bar select {
  font-weight: 400;
  min-width: 220px;
  padding: 8px 10px;
}

.filter-actions {
  padding-bottom: 2px;
}

.status-chip {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}

.status-pending_payment,
.status-slip_uploaded {
  background: #fff4d6;
  color: #8a5a00;
}

.status-payment_checked,
.status-paid {
  background: #e4f7ec;
  color: #0f6b3c;
}

.status-cancelled {
  background: #fde8e6;
  color: #9b1c1c;
}

.status-unknown {
  background: #eef2f7;
  color: var(--muted);
}

.report-summary {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
}

.auto-number-bar {
  align-items: end;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 16px;
  padding-top: 16px;
}

.auto-number-bar label {
  margin-bottom: 0;
}

.contestant-group {
  margin-top: 1.25rem;
}

.contestant-group-head {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.contestant-group-head h2 {
  margin-bottom: 4px;
}

.contestant-num-input {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

.contestant-table .col-number {
  width: 5.5rem;
}

@media print {
  .app-header,
  .filter-bar,
  .auto-number-bar,
  .button-row,
  .section-head .button-row {
    display: none !important;
  }

  .contestant-group {
    break-inside: avoid;
  }

  .page {
    max-width: none;
    padding: 0;
  }
}

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

h1 {
  font-size: 34px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

.eyebrow {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.panel,
.card,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(32, 48, 75, 0.06);
  padding: 22px;
}

.grid {
  display: grid;
  gap: 18px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.layout.two-col {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.generator-grid {
  /* Legacy name — still stacks top-to-bottom for readable wide tables */
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  margin-bottom: 20px;
}

.generator-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
  margin-top: 1.5rem;
}

.generator-stack > .panel,
.generator-grid > .panel {
  min-width: 0;
  width: 100%;
}

.table-scroll {
  margin: 0 -4px;
  overflow-x: auto;
  padding: 0 4px 4px;
  width: 100%;
}

.table-scroll table {
  min-width: 100%;
  width: max-content;
}

/* Config editor column widths (Name, Type, Level, Song titles, etc.) */
.editable-table th,
.editable-table td {
  vertical-align: middle;
  white-space: nowrap;
}

.editable-table .col-name input,
.editable-table input.col-name {
  min-width: 12rem;
  width: 14rem;
}

.editable-table .col-type select,
.editable-table .col-type input,
.editable-table select.col-type,
.editable-table input.col-type {
  min-width: 8rem;
  width: 9rem;
}

.editable-table .col-level input,
.editable-table input.col-level {
  min-width: 9rem;
  width: 11rem;
}

.editable-table .col-song input,
.editable-table input.col-song {
  min-width: 12rem;
  width: 14rem;
}

.editable-table .col-artist input,
.editable-table input.col-artist {
  min-width: 10rem;
  width: 12rem;
}

.editable-table .col-category select,
.editable-table select.col-category {
  min-width: 12rem;
  width: 14rem;
}

.editable-table .col-narrow input,
.editable-table input.col-narrow {
  min-width: 4.5rem;
  width: 5rem;
}

.editable-table .col-check {
  text-align: center;
  width: 4rem;
}

.editable-table th {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: normal;
  max-width: 10rem;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
  margin-bottom: 14px;
}

input,
textarea {
  border: 1px solid #cbd6e4;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.button {
  background: var(--blue);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  padding: 13px 18px;
}

.button.secondary {
  background: #eaf2ff;
  color: var(--blue-dark);
}

.details {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.details div {
  display: flex;
  justify-content: space-between;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
}

.slot-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.slot {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: flex !important;
  flex-direction: row !important;
  gap: 12px;
  grid-template-columns: none !important;
  margin: 0;
  padding: 12px;
  text-align: left;
}

.slot input {
  min-height: auto;
  width: auto;
}

.slot input[type="checkbox"] {
  flex: 0 0 auto;
  height: 1.05rem;
  margin-top: 3px;
  max-height: 1.05rem;
  max-width: 1.05rem;
  min-height: 1.05rem !important;
  min-width: 1.05rem;
  width: 1.05rem !important;
}

.slot small {
  color: var(--muted);
  display: block;
  font-weight: 400;
  margin-top: 4px;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

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

.amount {
  background: #e8f7ef;
  border: 1px solid #b8e5c9;
  border-radius: 8px;
  color: var(--green);
  font-size: 26px;
  font-weight: 800;
  padding: 14px 18px;
}

.status-pill {
  background: #fff6e1;
  border: 1px solid #f0d48b;
  border-radius: 999px;
  color: var(--amber);
  font-weight: 800;
  padding: 10px 14px;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.message {
  border-radius: 8px;
  padding: 12px 14px;
}

.message.success {
  background: #e8f7ef;
  color: var(--green);
}

.message.error {
  background: #fff0ed;
  color: var(--red);
}

.narrow {
  margin: 0 auto;
  max-width: 520px;
}

@media (max-width: 800px) {
  .app-header,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout.two-col {
    grid-template-columns: 1fr;
  }
}

.registration-form {
  display: grid;
  gap: 20px;
  max-width: 1020px;
}

.registration-form .panel {
  width: 100%;
}

.registration-form .slot-list {
  max-height: none;
  overflow: visible;
}

.slot.age-mismatch {
  background: #fffaf0;
  border-color: #efd38b;
  opacity: 0.95;
}

.slot.age-mismatch small::after {
  content: " · outside contestant age (optional)";
  color: var(--amber);
  font-weight: 700;
}

.stepper {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 720px;
}

@media (max-width: 700px) {
  .stepper {
    grid-template-columns: 1fr;
  }
}

.step {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  padding: 12px 14px;
}

.step span {
  align-items: center;
  background: #eaf2ff;
  border-radius: 50%;
  color: var(--blue-dark);
  display: inline-flex;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.step.active {
  border-color: #8dbcf0;
  box-shadow: 0 8px 24px rgba(13, 99, 199, 0.12);
  color: var(--ink);
}

.step.active span {
  background: var(--blue);
  color: #ffffff;
}

.registration-phase[hidden] {
  display: none;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 18px;
}

.helper-text {
  color: var(--muted);
  margin-bottom: 16px;
}

.detail-panel {
  margin-bottom: 20px;
}

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

.detail-grid div {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.detail-grid dd {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

@media (max-width: 800px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.config-form {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.config-form h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.config-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.age-config-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.config-fields label {
  font-size: 12px;
  margin-bottom: 0;
}

.config-fields input {
  min-height: 38px;
}

.check-label {
  align-items: center;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 10px 12px;
}

.check-label input {
  min-height: auto;
  width: auto;
}

@media (max-width: 900px) {
  .config-fields,
  .age-config-fields {
    grid-template-columns: 1fr;
  }
}

.editable-row input {
  font-size: 14px;
  min-height: 36px;
  padding: 6px 10px;
}

.editable-row input[type="text"],
.editable-row input:not([type]) {
  min-width: 8rem;
}

.editable-row input[type="number"] {
  min-width: 4.5rem;
  width: 5.5rem;
}

.editable-row input[type="checkbox"] {
  min-height: auto;
  width: auto;
}

.small-button {
  padding: 9px 12px;
}

.config-fields select,
.editable-row select {
  border: 1px solid #cbd6e4;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 38px;
  padding: 6px 8px;
  width: 100%;
}

.config-fields select[multiple],
.editable-row select[multiple] {
  min-height: 92px;
}

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

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

.generator-grid .panel,
.generator-stack .panel {
  overflow-x: visible;
}

@media (max-width: 900px) {
  .music-config-fields,
  .pricing-config-fields {
    grid-template-columns: 1fr;
  }
}

/* ── Client environments ─────────────────────────────────────────────────── */

.client-badge {
  background: #eef5ff;
  border: 1px solid #b7d0f0;
  border-radius: 999px;
  color: var(--blue-dark);
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
  padding: 3px 10px;
  vertical-align: middle;
}

.client-switcher {
  align-items: center;
  background: #f7fafc;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 28px;
}

.client-pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
}

.client-pill.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.card-highlight {
  border-color: #b7d0f0;
  box-shadow: 0 0 0 2px #eef5ff;
}

/* ── Admin disclosure panel ───────────────────────────────────────────────── */

.admin-trigger {
  align-items: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue-dark);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  gap: 6px;
  padding: 6px 14px;
  transition: background 0.15s;
}

.admin-trigger:hover,
.admin-trigger[aria-expanded="true"] {
  background: #eaf2ff;
}

.admin-trigger .chevron {
  transition: transform 0.25s ease;
}

.admin-trigger[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.admin-panel {
  background: #f7fafc;
  border-bottom: 1px solid var(--line);
  max-height: 0;
  overflow: hidden;
  padding: 0 28px;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.admin-panel.open {
  max-height: 500px;
  padding: 16px 28px;
}

.admin-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  max-width: 900px;
}

.admin-item {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 14px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.admin-item:hover {
  background: #eef5ff;
  border-color: #b7d0f0;
}

.admin-icon {
  font-size: 18px;
  flex: 0 0 auto;
  line-height: 1;
}

.admin-label {
  flex: 1 1 auto;
}

.admin-logout {
  color: var(--muted);
}

.admin-logout:hover {
  color: var(--red);
  background: #fff0ed;
  border-color: #f5c6c0;
}

/* ── Demo / hosting overview ─────────────────────────────────────────────── */

.lede {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
  margin: 8px 0 0;
  max-width: 52rem;
}

.callout {
  background: #fff;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 12px;
  margin-bottom: 22px;
  padding: 16px 18px;
}

.callout p {
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 0 0;
}

.callout-amber {
  border-left-color: var(--amber);
  background: #fffaf0;
}

.callout-blue {
  border-left-color: var(--blue);
  background: #f3f8ff;
}

.compact-callout {
  margin-top: 0;
  margin-bottom: 22px;
}

.compact-callout a {
  font-weight: 700;
  margin-left: 4px;
}

.flow-panel h2,
.panel h2 {
  margin-top: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 20px;
  padding: 22px 22px 18px;
}

.panel > .muted {
  margin-top: -6px;
  margin-bottom: 18px;
}

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

.flow-row {
  align-items: stretch;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.flow-row-wrap {
  flex-wrap: wrap;
}

.flow-step {
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  flex: 1 1 140px;
  min-width: 132px;
  padding: 14px 12px;
}

.flow-step.highlight {
  background: #eef5ff;
  border-color: #b7d0f0;
}

.flow-step h3 {
  font-size: 15px;
  margin: 0 0 6px;
}

.flow-step p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

.flow-num {
  background: var(--blue);
  border-radius: 999px;
  color: #fff;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
  min-width: 22px;
  padding: 5px 8px;
  text-align: center;
}

.flow-arrow {
  align-self: center;
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 700;
}

.two-col {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.two-col h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

.check-list,
.x-list,
.plain-list {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  padding-left: 1.2rem;
}

.check-list li::marker {
  content: "✓ ";
  color: var(--green);
  font-weight: 700;
}

.x-list li::marker {
  content: "✗ ";
  color: var(--red);
  font-weight: 700;
}

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

.info-table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

.info-table th,
.info-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.info-table th {
  background: #f7fafc;
  font-weight: 700;
}

.compare-table td:first-child,
.compare-table th:first-child {
  font-weight: 700;
  white-space: nowrap;
}

.cost-note {
  font-size: 14px;
  line-height: 1.5;
  margin: 14px 0 0;
}

.path-list {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
  padding-left: 1.25rem;
}

.path-list li {
  margin-bottom: 8px;
}

.path-list strong {
  color: var(--ink);
}

.flow-panel code,
.panel code {
  background: #eef2f7;
  border-radius: 4px;
  font-size: 0.92em;
  padding: 1px 5px;
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .flow-row {
    flex-wrap: wrap;
  }

  .flow-arrow {
    display: none;
  }
}

