/* Rehearsal briefs extend the portal's ink, paper, type and spacing tokens. */
:root {
  --rehearsal-time-size: clamp(2.5rem, 7vw, 3.5rem);
  --rehearsal-section-gap: var(--space-6);
  --rehearsal-on-ink: #f6f3ee;
  --rehearsal-muted-on-ink: #d5cec6;
}

.rehearsal-content #flash:not(:has(*)) { display: none; }
@media (max-width: 1023px) {
  .rehearsal-content .admin-shortcuts { flex-wrap: nowrap; overflow-x: auto; gap: var(--space-2); padding-block: var(--space-1); }
  .rehearsal-content .admin-shortcuts a { background: var(--paper); border: 0; flex-shrink: 0; min-height: 44px; display: inline-flex; align-items: center; padding: var(--space-2) var(--space-3); font-size: .8125rem; }
}

.rehearsal-page {
  display: grid;
  gap: var(--rehearsal-section-gap);
  min-width: 0;
}

.rehearsal-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.rehearsal-header h2,
.rehearsal-header p,
.rehearsal-surface h3,
.rehearsal-surface p,
.rehearsal-section-title h3 {
  margin: 0;
}

.rehearsal-header h2 { font-size: clamp(1.75rem, 5vw, 2.25rem); }
.rehearsal-header .rehearsal-create { margin-block-start: var(--space-4); }

.rehearsal-back,
.rehearsal-inline-action {
  align-items: center;
  display: inline-flex;
  min-height: 44px;
  gap: var(--space-2);
}
.rehearsal-back::before { content: "‹"; font-size: 1.5rem; }
.rehearsal-create { border: 0; gap: var(--space-2); }

.rehearsal-surface {
  background: var(--paper);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: none;
  min-width: 0;
  padding: var(--space-5);
}

.hero-card.rehearsal-brief {
  --focus: var(--rehearsal-on-ink);
  align-items: stretch;
  background: #231f20;
  color: var(--rehearsal-on-ink);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  text-align: left;
  width: 100%;
}

.rehearsal-intro { display: grid; gap: var(--space-3); }
.rehearsal-brief .hero-kicker { color: var(--rehearsal-muted-on-ink); font-size: .875rem; font-weight: 600; }
.rehearsal-brief h3 { color: var(--rehearsal-on-ink); }
.rehearsal-brief .hero-title { font-size: clamp(1.75rem, 5vw, 2.25rem); line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.rehearsal-schedule { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-5); }
.rehearsal-time { font-size: var(--rehearsal-time-size); font-weight: 700; letter-spacing: -.06em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rehearsal-date { font-size: .875rem; line-height: 1.6; }
.rehearsal-location { display: flex; align-items: flex-start; gap: var(--space-2); font-size: .9375rem; }
.rehearsal-location svg { flex-shrink: 0; margin-block-start: .125rem; }
.rehearsal-brief .rehearsal-location { color: var(--rehearsal-muted-on-ink); }

/* Never let an author display rule expose the inactive HTML view. Alternatives
   are additionally kept outside the live DOM in a template until Change. */
.rsvp [hidden] { display: none !important; }
.rehearsal-surface .rsvp { margin-block: var(--space-2); width: 100%; }
.rsvp-summary { display: grid; gap: var(--space-2); }
.rehearsal-surface .rsvp-settled { align-items: center; gap: var(--space-2); }
.rehearsal-surface .status-badge { gap: var(--space-2); white-space: normal; }
.rehearsal-surface .rsvp-settled .status-badge { font-size: .9375rem; background: transparent; padding: .5rem 0; }
.rehearsal-brief .rsvp-settled .status-badge { color: var(--rehearsal-on-ink); }
.rsvp-settled .status-badge > span { align-items: center; display: inline-flex; justify-content: center; width: 28px; height: 28px; background: var(--surface-strong); border-radius: 50%; }
.rehearsal-brief .rsvp-settled .status-badge > span { background: #49413c; }
.rsvp-settled .status-badge > span::before { content: "✓"; }
.rsvp-settled .status-badge[data-status="justified-absence"] > span::before { content: "−"; }
.rehearsal-surface .rsvp-reason { font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.rehearsal-brief .rsvp-reason { color: var(--rehearsal-muted-on-ink); }
.rsvp-prompt { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.rsvp-prompt p { font-size: .875rem; font-weight: 600; margin: 0; }
.rsvp-choices { display: grid; gap: var(--space-3); min-width: 0; }
.rehearsal-surface .rsvp-choices .button_to button { width: 100%; min-height: 52px; }
.rehearsal-surface button,
.rehearsal-surface .button,
.rehearsal-surface input[type="submit"] { border: 0; }
.rehearsal-surface button.text-action { min-width: 60px; border-radius: var(--radius-sm); padding-inline: var(--space-2); }
.rehearsal-brief button.text-action { background: #3a342f; }
@media (hover: hover) and (pointer: fine) {
  .rehearsal-brief button.text-action:hover { background: #49413c; }
}

.rehearsal-surface .rsvp-decline { min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 0; }
.rsvp-decline summary { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; font-weight: 600; cursor: pointer; width: fit-content; padding-inline: var(--space-2); border-radius: var(--radius-sm); }
.rsvp-decline summary::after { content: "+"; font-size: 1.25rem; }
.rsvp-decline[open] summary::after { content: "−"; }
.rsvp-decline summary::-webkit-details-marker { display: none; }
.rehearsal-surface .rsvp-decline form { gap: var(--space-3); margin-block-start: var(--space-3); }
.rehearsal-brief .rsvp-decline label { color: var(--rehearsal-on-ink); }
.rehearsal-brief .rsvp-decline textarea { background: #302b29; color: var(--rehearsal-on-ink); border-color: #857b72; }
.rehearsal-brief .rsvp-decline textarea::placeholder { color: var(--rehearsal-muted-on-ink); }
.rehearsal-brief .rsvp-decline input.secondary { background: #49413c; }

.rehearsal-section-title { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.rehearsal-section-title > span { font-size: .8125rem; color: var(--muted); flex-shrink: 0; }
.rehearsal-brief .rehearsal-section-title > span { color: var(--rehearsal-muted-on-ink); }
.rehearsal-songs { display: grid; gap: var(--space-3); min-width: 0; }
.rehearsal-surface .prepare-list { gap: var(--space-1); width: 100%; min-width: 0; }
.rehearsal-surface .prepare-list li { min-width: 0; }
.rehearsal-surface .prepare-list .prepare-row {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) 18px;
  gap: var(--space-3);
  margin: 0;
  min-height: 72px;
  padding: var(--space-3) 0;
  width: 100%;
}
.rehearsal-surface .prepare-title { display: grid; gap: var(--space-1); white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.rehearsal-surface .prepare-title strong { font-size: .9375rem; font-weight: 600; line-height: 1.5; }
.practice-number { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.practice-hint { font-size: .75rem; color: var(--muted); font-weight: 400; }
.rehearsal-brief .practice-number,
.rehearsal-brief .practice-hint { color: var(--rehearsal-muted-on-ink); }
.rehearsal-notes { display: grid; gap: var(--space-2); }
.rehearsal-notes p { font-size: .9375rem; white-space: pre-line; }
.rehearsal-brief .rehearsal-notes p { color: var(--rehearsal-muted-on-ink); }
.rehearsal-empty { color: var(--muted); font-size: .9375rem; }
.rehearsal-brief .rehearsal-empty { color: var(--rehearsal-muted-on-ink); }

.rehearsal-agenda { margin-block-start: var(--space-5); gap: var(--space-5); }
.rehearsal-agenda .section-heading { align-items: flex-start; flex-direction: column; gap: var(--space-4); }
.rehearsal-agenda .section-heading h2 { margin: 0; font-size: 1.5rem; }
.rehearsal-agenda .date-strip { margin-block: 0 var(--space-5); }
.rehearsal-later { gap: var(--space-4); }
.rehearsal-later .event-heading { align-items: center; }
.rehearsal-later .event-heading h3 { margin: 0; font-size: 1.125rem; }
.rehearsal-later .date-tile { background: var(--surface-strong); color: var(--ink); }
.rehearsal-list-time { font-size: .9375rem; font-weight: 600; }
.rehearsal-history { margin-block-start: var(--space-5); }
.rehearsal-history h2 { font-size: 1.5rem; }
.rehearsal-history-table,
.rehearsal-history-table tr { border: 0; box-shadow: none; }

.rehearsal-index-list { display: grid; gap: var(--space-4); }
.rehearsal-index-row { display: grid; gap: var(--space-3); }
.rehearsal-index-link { align-items: start; color: var(--ink); display: grid; gap: var(--space-4); grid-template-columns: 48px minmax(0, 1fr) 18px; }
.rehearsal-index-copy { display: grid; gap: var(--space-1); min-width: 0; }
.rehearsal-index-copy > strong { font-size: 1.0625rem; overflow-wrap: anywhere; }
.rehearsal-index-copy > span { font-size: .875rem; font-weight: 400; }
.rehearsal-index-link .row-chevron { margin-block-start: var(--space-2); }
.rehearsal-stamp { display: grid; gap: var(--space-1); text-align: left; line-height: 1.1; }
.rehearsal-stamp > span { font-size: .8125rem; color: var(--muted); }
.rehearsal-stamp > strong { font-size: 2rem; letter-spacing: -.05em; }
.rehearsal-index-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); }
.rehearsal-index-footer .muted { font-size: .8125rem; }
.rehearsal-index-footer a { font-size: .8125rem; }

form.rehearsal-form { border: 0; display: grid; gap: var(--space-7); max-width: none; padding: var(--space-5); }
.rehearsal-form-section { display: grid; gap: var(--space-4); }
.rehearsal-form legend { margin-block-end: var(--space-4); font-size: 1.125rem; }
.rehearsal-form label { font-size: .875rem; }
.rehearsal-form input:not([type="hidden"]),
.rehearsal-form textarea { width: 100%; max-width: 100%; min-width: 0; font-size: 1rem; }
.rehearsal-form input[type="datetime-local"] { display: block; appearance: none; -webkit-appearance: none; text-align: left; }
.rehearsal-form input[type="datetime-local"]::-webkit-date-and-time-value { display: block; text-align: left; min-width: 0; }
.rehearsal-form .field-hint { margin-block-start: calc(-1 * var(--space-2)); color: var(--muted); font-size: .8125rem; }
.rehearsal-form .setlist-selected { margin: 0; }
.rehearsal-form .setlist-row { border: 0; background: transparent; gap: var(--space-3); padding-block: var(--space-3); }
.rehearsal-form .setlist-selected .setlist-row { grid-template-columns: minmax(0, 1fr) 4rem; }
.rehearsal-form .setlist-selected .setlist-song { grid-column: 1 / -1; }
.rehearsal-form .setlist-selected .setlist-position { grid-column: 2; grid-row: 2; }
.rehearsal-form .setlist-selected button { grid-column: 1; grid-row: 2; justify-self: start; }
.rehearsal-form .setlist-search-results { border: 0; background: var(--surface); box-shadow: none; border-radius: var(--radius-sm); }
.rehearsal-form-footer { display: grid; gap: var(--space-2); }
.rehearsal-form-footer input { min-height: 52px; }
.rehearsal-form-footer a { justify-content: center; }

.rehearsal-admin-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.rehearsal-admin-actions .button { background: var(--rehearsal-on-ink); color: #231f20; flex: 1 1 auto; }
.rehearsal-admin-actions .button.secondary { background: #49413c; color: var(--rehearsal-on-ink); flex: 0 1 80px; }
.rehearsal-responses { display: grid; gap: var(--space-5); }
.response-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: 0; }
.response-totals > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: var(--space-1); }
.response-totals dt { color: var(--muted); font-size: .75rem; }
.response-totals dd { font-size: 2rem; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }
.rehearsal-remove summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font-size: .875rem; font-weight: 600; }
.rehearsal-remove summary::after { content: "+"; margin-inline-start: var(--space-3); }
.rehearsal-remove summary::-webkit-details-marker { display: none; }
.rehearsal-remove p { color: var(--muted); font-size: .875rem; }
.rehearsal-remove button { color: var(--danger); border: 0; background: var(--danger-bg); }

form.rehearsal-attendance { background: transparent; border: 0; max-width: none; padding: 0; gap: var(--space-5); }
.rehearsal-attendance .attendance-list { gap: var(--space-4); }
.rehearsal-attendance .attendance-row { padding: var(--space-5); gap: var(--space-4); }
.rehearsal-attendance .record-person { flex-wrap: wrap; gap: var(--space-3); }
.rehearsal-attendance .record-person > div { flex: 1; min-width: 0; }
.rehearsal-attendance .record-person strong { overflow-wrap: anywhere; }
.rehearsal-attendance .record-person .muted { margin: 0; font-size: .8125rem; }
.rehearsal-attendance .attendance-previous { flex: 1 0 100%; }
.rehearsal-attendance .segmented { border: 0; box-shadow: none; width: 100%; padding: var(--space-1); gap: var(--space-1); }
.rehearsal-attendance .segmented-choice { min-width: 0; }
.rehearsal-attendance .segmented-choice span { border: 0; box-shadow: none; font-size: .8125rem; padding-inline: var(--space-1); }
.rehearsal-attendance .attendance-save { background: var(--paper); border: 0; bottom: calc(7.5rem + env(safe-area-inset-bottom)); padding: var(--space-4); display: grid; gap: var(--space-2); box-shadow: var(--elevation-floating); }
.rehearsal-attendance .attendance-save p { margin: 0; font-size: .8125rem; color: var(--muted); }
.rehearsal-attendance .attendance-save input { border: 0; }

@media (min-width: 640px) {
  .rehearsal-surface, form.rehearsal-form { padding: var(--space-6); }
  .rehearsal-agenda .section-heading { align-items: center; flex-direction: row; }
  .rehearsal-form .setlist-selected .setlist-row { grid-template-columns: minmax(0, 1fr) 4rem auto; }
  .rehearsal-form .setlist-selected .setlist-song { grid-column: 1; }
  .rehearsal-form .setlist-selected .setlist-position { grid-column: 2; grid-row: 1; }
  .rehearsal-form .setlist-selected button { grid-column: 3; grid-row: 1; }
  .rehearsal-form-footer { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-5); }
  .rehearsal-page { max-width: 56rem; width: 100%; }
}
@media (min-width: 1024px) {
  .rehearsal-attendance .attendance-save { bottom: var(--space-4); }
  .rehearsal-attendance .attendance-previous { flex: 0 0 auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .rsvp-choices.is-editing { animation: gc-rsvp-reveal var(--motion) var(--ease-out); }
}
@keyframes gc-rsvp-reveal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.attendance-summary td:not(:first-child),
.attendance-summary tfoot th + td {
  font-variant-numeric: tabular-nums;
  text-align: end;
}
.attendance-summary tfoot th { text-align: start; background: transparent; border-bottom: 0; }
.attendance-summary tfoot td { font-weight: 700; }
.attendance-people { display: grid; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.attendance-person {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-3);
}
.attendance-person:first-child { border-top: 0; padding-top: 0; }
.attendance-person-name { font-weight: 700; }
.attendance-when { font-size: .8125rem; margin-inline-start: auto; }
.attendance-reason {
  background: var(--paper);
  border-radius: var(--radius-sm);
  flex-basis: 100%;
  margin: 0;
  padding: var(--space-3);
}
.attendance-section h3 { margin-bottom: var(--space-4); }

@media (max-width: 1023px) {
  .attendance-summary td:first-child {
    justify-content: flex-start;
    text-align: start;
  }
  .attendance-summary td:first-child::before { display: none; }
  .attendance-person .attendance-when {
    flex-basis: 100%;
    margin-inline-start: 0;
  }
  .attendance-summary tfoot,
  .attendance-summary tfoot tr,
  .attendance-summary tfoot th,
  .attendance-summary tfoot td {
    display: block;
    width: auto;
  }
  .attendance-summary tfoot tr {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: .35rem;
    margin-top: .25rem;
    padding: .9rem 1rem;
  }
  .attendance-summary tfoot th,
  .attendance-summary tfoot td {
    align-items: center;
    border: 0;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: .15rem 0;
    text-align: end;
  }
  .attendance-summary tfoot th {
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
  }
  .attendance-summary tfoot td::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: .75rem;
    font-weight: 700;
    text-align: start;
  }
}
