:root {
  color-scheme: light;
  --paper: #fbfaf7;
  --ink: #25211e;
  --muted: #716b65;
  --line: #ddd6cd;
  --soft: #f0ebe3;
  --accent: #7f1d2d;
  --accent-ink: #ffffff;
  --gold: #b88a2b;
  --green: #286b4b;
  --orange: #9a5a16;
  --red: #9b2634;
  --shadow: 0 18px 50px rgba(64, 50, 40, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(127, 29, 45, 0.04), transparent 280px),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(37, 33, 30, 0.035) 32px),
    var(--paper);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-wrap {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--accent);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.logo-img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
}

.logo-fallback {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 800;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

.brand p {
  color: var(--muted);
  margin-top: 5px;
}

.program-title {
  display: inline-grid;
  gap: 2px;
  border-left: 3px solid var(--gold);
  margin-top: 9px !important;
  padding-left: 10px;
  color: var(--ink) !important;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.08;
}

.program-title span {
  color: var(--muted);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.9);
  box-shadow: 0 10px 28px rgba(64, 50, 40, 0.08);
  color: var(--ink);
  font-size: 14px;
  padding: 8px;
}

.build-mark {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.62;
  white-space: nowrap;
}

.avatar {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--soft);
}

.user-identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.user-identity strong {
  overflow: hidden;
  max-width: 220px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity span {
  overflow: hidden;
  max-width: 220px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(127, 29, 45, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.role-pill.demo {
  background: rgba(184, 138, 43, 0.16);
  color: #6d4c0c;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  background: rgba(255, 254, 250, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-panel h1 {
  margin: 12px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  letter-spacing: 0;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.login-panel .build-mark {
  display: inline-block;
  margin-top: 12px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffefa;
  color: var(--ink);
  padding: 10px 12px;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.field textarea.tall {
  min-height: 180px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--ink);
  font-weight: 750;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 7px;
  padding: 0 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
}

.button.secondary {
  border: 1px solid var(--line);
  background: #fffefa;
  color: var(--ink);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button.ghost {
  background: transparent;
  color: var(--accent);
}

.button.danger {
  background: var(--red);
  color: white;
}

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

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: 0 10px 30px rgba(64, 50, 40, 0.08);
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.panel-head h2,
.panel-head p {
  margin: 0;
}

.panel-head h2 {
  font-size: 21px;
  letter-spacing: 0;
}

.panel-head p {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

.panel-body {
  padding: 18px 20px 20px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tab {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffefa;
  color: var(--ink);
  padding: 0 12px;
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.event-list,
.resource-list,
.summary-list {
  display: grid;
  gap: 12px;
}

.month-actions {
  display: flex;
  gap: 8px;
}

.month-actions .button {
  width: 42px;
  padding: 0;
  font-size: 22px;
}

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

.weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.month-cell {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.82);
  color: var(--ink);
  padding: 9px;
  text-align: left;
}

.month-cell.empty {
  border-style: dashed;
  background: rgba(240, 235, 227, 0.45);
}

.month-cell.has-events {
  background: #fffefa;
  box-shadow: 0 8px 24px rgba(64, 50, 40, 0.06);
}

.month-cell.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.day-number {
  font-weight: 850;
}

.day-events {
  display: grid;
  gap: 5px;
}

.day-dot {
  display: block;
  overflow: hidden;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-dot.ensayo {
  color: var(--green);
}

.day-dot.concierto {
  color: var(--accent);
}

.day-dot.late {
  background: #f2d58f;
  color: #5c3405;
}

.day-dot.absent {
  background: #7f1d2d;
  color: #fffefa;
}

.event {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.datebox {
  display: grid;
  place-items: center;
  align-self: start;
  min-height: 74px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--accent);
  font-weight: 800;
}

.datebox small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.event h3 {
  margin: 0 0 5px;
  font-size: 18px;
  letter-spacing: 0;
}

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

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pill.ensayo {
  color: var(--green);
}

.pill.concierto {
  color: var(--accent);
}

.attendance {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.segmented button {
  min-height: 38px;
  background: #fffefa;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active[data-status="coming"] {
  background: rgba(40, 107, 75, 0.12);
  color: var(--green);
}

.segmented button.active[data-status="late"] {
  background: rgba(154, 90, 22, 0.13);
  color: var(--orange);
}

.segmented button.active[data-status="absent"] {
  background: rgba(155, 38, 52, 0.12);
  color: var(--red);
}

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

.attendance-state {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.resource {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.resource h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.resource-heading {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.resource-heading h3 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  letter-spacing: 0;
}

.resource-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.playlist-links {
  display: grid;
  gap: 8px;
}

.playlist-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 34px;
  color: var(--ink);
  font-weight: 800;
}

.playlist-link:hover span:last-child {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.playlist-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 7px;
}

.playlist-icon svg {
  width: 20px;
  height: 20px;
}

.playlist-apple-music .playlist-icon {
  background: #fb2d5f;
  color: #fff;
}

.playlist-apple-music svg {
  fill: currentColor;
}

.playlist-spotify .playlist-icon {
  background: #1db954;
  color: #102116;
}

.playlist-spotify circle {
  fill: currentColor;
}

.playlist-spotify path {
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.playlist-youtube .playlist-icon {
  background: #ff0033;
  color: #fff;
}

.playlist-youtube rect {
  fill: currentColor;
}

.playlist-youtube path {
  fill: #fff;
}

.material-browser,
.material-file-group,
.material-files {
  display: grid;
  gap: 8px;
}

.material-file-group + .material-file-group {
  margin-top: 12px;
}

.material-file-group h4 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.material-file-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  font-weight: 750;
}

.material-file-link span {
  border-radius: 5px;
  background: var(--soft);
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 6px;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.35fr) minmax(0, 1fr);
  gap: 16px;
}

.practice-work-list {
  display: grid;
  gap: 8px;
}

.practice-work-list button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
}

.practice-work-list button.active {
  border-color: rgba(155, 38, 52, 0.35);
  background: rgba(155, 38, 52, 0.07);
}

.practice-work-list span,
.practice-work-list small {
  display: block;
}

.practice-work-list span {
  font-weight: 850;
}

.practice-work-list small {
  margin-top: 3px;
  color: var(--muted);
}

.practice-detail,
.practice-audios,
.practice-score {
  display: grid;
  gap: 12px;
}

.practice-audio {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  padding: 12px;
}

.practice-audio strong {
  display: block;
  margin-bottom: 8px;
}

.practice-audio audio {
  width: 100%;
}

.practice-score-actions {
  display: flex;
  justify-content: flex-end;
}

.practice-score iframe {
  width: 100%;
  min-height: min(78vh, 900px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.inline-flash {
  margin: 0;
}

.works-list {
  margin-top: 10px;
  line-height: 1.65;
}

.markdown {
  line-height: 1.65;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown > :last-child {
  margin-bottom: 0;
}

.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote {
  margin: 0 0 10px;
}

.markdown ul,
.markdown ol {
  padding-left: 1.25rem;
}

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

.markdown h3,
.markdown h4,
.markdown h5 {
  margin: 16px 0 8px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

.markdown h4 {
  font-size: 17px;
}

.markdown h5 {
  font-size: 15px;
}

.markdown blockquote {
  border-left: 3px solid var(--gold);
  padding-left: 12px;
  color: var(--muted);
}

.markdown code {
  border-radius: 4px;
  background: var(--soft);
  padding: 1px 5px;
  color: var(--ink);
  font-size: 0.92em;
}

.event-notes {
  margin-top: 10px;
  color: var(--muted);
}

.admin {
  margin-top: 20px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.summary-event {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  padding: 14px;
}

.summary-event h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.event-edit-form {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

.summary-columns-primary {
  margin-bottom: 10px;
}

.summary-box {
  background: var(--soft);
  border-radius: 7px;
  padding: 10px;
}

.summary-box-coming {
  background: rgba(40, 107, 75, 0.1);
}

.summary-box-pending {
  background: rgba(113, 107, 101, 0.12);
}

.summary-box-absent {
  background: rgba(155, 38, 52, 0.08);
}

.summary-box-late {
  background: rgba(184, 138, 43, 0.12);
}

.summary-box strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.summary-box strong span {
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.72);
  color: var(--muted);
  font-size: 12px;
  padding: 2px 7px;
}

.voice-group {
  margin: 8px 0 10px;
}

.voice-group strong {
  color: var(--ink);
  font-size: 13px;
}

.person {
  display: block;
  padding: 4px 0;
  color: var(--muted);
  font-size: 14px;
}

.choir-list {
  display: grid;
  gap: 14px;
}

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

.score-summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  padding: 12px 14px;
}

.score-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.score-summary-item strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.choir-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.choir-group header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.choir-group h3 {
  margin: 0;
  font-size: 17px;
}

.choir-group header span {
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
}

.choir-members {
  display: grid;
}

.choir-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
}

.choir-member + .choir-member {
  border-top: 1px solid var(--line);
}

.choir-member strong,
.choir-member span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choir-member span {
  color: var(--muted);
  font-size: 13px;
}

.choir-member-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.choir-member-meta .button {
  min-height: 34px;
}

.danger-zone {
  border: 1px solid rgba(155, 38, 52, 0.28);
  border-radius: 8px;
  background: rgba(155, 38, 52, 0.05);
  padding: 14px;
}

.danger-zone h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.flash {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 7px;
  background: rgba(184, 138, 43, 0.15);
  color: #6d4c0c;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(155, 38, 52, 0.24);
  border-radius: 8px;
  background: #fffefa;
  box-shadow: var(--shadow);
  color: var(--red);
  font-weight: 750;
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast[data-type="success"] {
  border-color: rgba(45, 110, 82, 0.24);
  color: #245d44;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .panel-head,
  .userbar {
    align-items: start;
    flex-direction: column;
  }

  .grid,
  .form-grid,
  .summary-columns,
  .score-summary,
  .practice-layout {
    grid-template-columns: 1fr;
  }

  .panel-body {
    overflow-x: auto;
  }

  .weekdays,
  .month-grid {
    min-width: 680px;
  }

  .event {
    grid-template-columns: 1fr;
  }

  .datebox {
    min-height: 54px;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .segmented button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .segmented button:last-child {
    border-bottom: 0;
  }
}

.upload-form { padding-bottom: 1.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid #ddd; }
.repertoire-order li { padding: .5rem; display: flex; justify-content: space-between; gap: .6rem; align-items: center; }
.repertoire-order li span:first-child { overflow-wrap: anywhere; }
#memberForm fieldset label { display: inline-block; padding: .5rem; }

/* Production workspace and accessible multi-file uploads. */
[hidden] { display: none !important; }
.production-picker { margin-bottom: 24px; }
.production-picker summary, .calendar-create summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
.upload-drop { border: 2px dashed var(--line); border-radius: 8px; padding: 18px; background: #faf7f1; cursor: pointer; }
.upload-drop.dragging { border-color: var(--accent); background: #f3e8e7; }
.upload-drop input { width: 100%; min-width: 0; }
.upload-list { padding-left: 20px; overflow-wrap: anywhere; }
.production-picker select { max-width: 100%; }
.calendar-create form { margin-top: 16px; }

.grid > .panel { min-width: 0; }
.upload-drop { position: relative; }
.upload-drop .file-picker { position: absolute; width: 1px; height: 1px; opacity: 0; padding: 0; }
.upload-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 820px) {
  .weekdays, .month-grid { min-width: 0; gap: 4px; }
  .month-cell { min-width: 0; min-height: 76px; padding: 5px 3px; }
  .day-events { min-width: 0; }
  .day-dot { min-width: 0; padding: 2px; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
}

.upcoming-concerts { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.upcoming-concerts ul { list-style: none; padding: 0; }
.upcoming-concerts li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.event-repertoire { border-top: 1px solid var(--line); padding: 12px 0; margin-top: 12px; }
.event-repertoire h4 { margin: 0 0 8px; }
.participant-list { display: grid; gap: 10px; margin: 16px 0; }
.participant-list label { display: flex; align-items: start; gap: 8px; overflow-wrap: anywhere; }

/* Community screens: compact touch targets and a readable mobile dialog. */
.community-dialog {width:min(760px,calc(100vw - 24px));max-height:90dvh;border:1px solid #dacfc4;border-radius:12px;padding:20px;background:#fffdf9;color:#27221e;overflow:auto;}
.community-dialog::backdrop {background:#0008;}
.community-dialog header {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px;}
.community-dialog input,.community-dialog textarea,.community-dialog select {max-width:100%;}
.community-prose {white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;}
.community-people {list-style:none;padding:0;}.community-people li {padding:12px 0;border-bottom:1px solid #e9e1d9;overflow-wrap:anywhere;}.community-people span {display:block;}
.plan-choices label,.library-choice {display:block;padding:8px 0;}.plan-items {padding-left:24px;}.plan-items li {padding:12px;border:1px solid #e9e1d9;border-radius:8px;margin-bottom:12px;}.plan-controls {display:flex;gap:8px;flex-wrap:wrap;margin:8px 0;}
.notice-card {padding:16px 0;border-bottom:1px solid #e9e1d9;}.text-button {font:inherit;color:inherit;text-align:left;background:none;border:0;cursor:pointer;padding:0;}.concert-countdown {font-weight:600;color:#7e2330;margin:6px 0 16px;}.event-plan {padding:12px;border-left:3px solid #7e2330;margin-block:12px;}
@media(max-width:600px){.community-dialog{padding:14px;}.community-dialog header{align-items:flex-start;}.community-dialog h2{font-size:1.25rem;}.plan-controls button{min-height:40px;}}

/* Reusable musical archive. */
.archive-panel > .panel-head { align-items: center; }
.archive-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; color: var(--muted); font-size: 14px; }
.archive-summary strong { color: var(--ink); }
.archive-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.archive-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; min-height: 96px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #fffefa; color: var(--ink); text-align: left; }
.archive-card:hover { border-color: #bbaea3; box-shadow: 0 8px 24px rgb(64 50 40 / 7%); }
.archive-card.inactive { opacity: .68; }
.archive-card-main { display: grid; gap: 4px; min-width: 0; }
.archive-card-main strong { font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.2; }
.archive-card-main span { color: var(--muted); overflow-wrap: anywhere; }
.archive-card-counts { display: flex; flex-wrap: wrap; gap: 5px 10px; grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.archive-detail { max-width: 1120px; }
.archive-back { display: inline-flex; min-height: 44px; align-items: center; margin-bottom: 10px; }
.archive-title h2 { margin-top: 3px; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 500; }
.archive-title .pill { flex: none; }
.archive-work-body { display: grid; gap: 0; }
.archive-notes { margin-bottom: 4px; padding: 14px; border-left: 3px solid var(--gold); background: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.archive-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.archive-section h3, .archive-management h3 { margin: 4px 0 16px; font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 500; }
.archive-asset, .archive-audio { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; }
.archive-asset + .archive-asset, .archive-audio + .archive-audio { border-top: 1px solid var(--line); }
.archive-asset > div:first-child, .archive-audio > div:first-child { display: grid; gap: 3px; }
.archive-asset span, .archive-audio span { color: var(--muted); font-size: 13px; }
.archive-version-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.archive-audio audio { width: min(360px, 42vw); }
.archive-links, .archive-contributions { display: grid; gap: 9px; }
.archive-links article, .archive-contributions article { padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fffefa; }
.archive-links article { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.archive-links article a { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); }
.archive-links article strong { overflow-wrap: anywhere; }
.archive-contributions article > div { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.archive-contributions h4 { margin: 10px 0 4px; }
.archive-contributions p { margin: 7px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.archive-contributions .text-link { margin-top: 8px; }
.archive-uses { display: flex; flex-wrap: wrap; gap: 7px; }
.archive-tool { border-bottom: 1px solid var(--line); }
.archive-tool > summary { min-height: 48px; cursor: pointer; font-weight: 750; }
.archive-tool > form { padding: 4px 0 18px; }
.archive-management { margin-top: 24px; padding: 18px; border: 1px solid #d8c5c8; border-radius: 9px; background: #faf3f4; }
.archive-management > .button.danger { margin-top: 18px; }

/* Mobile layout: every management and content screen stays usable with one hand. */
@media (max-width: 600px) {
  body { background: var(--paper); }
  .app-frame .panel { border-radius: 10px; box-shadow: 0 4px 18px rgb(64 50 40 / 7%); }
  .app-frame .panel-body { overflow-x: visible; }
  .app-frame .field input,
  .app-frame .field select,
  .app-frame .field textarea { min-height: 46px; font-size: 16px; }
  .app-frame .button { min-height: 44px; white-space: normal; text-align: center; }
  .app-frame :where(summary, .check-field, .participant-list label, .library-choice) { min-height: 44px; }
  .app-frame summary { display: flex; align-items: center; }
  .app-frame fieldset { min-width: 0; margin-inline: 0; padding: 12px; }
  #memberForm fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  #memberForm fieldset label { display: flex; align-items: center; min-height: 44px; padding: 6px; }

  .calendar-panel > .panel-head { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .calendar-panel .panel-head h2 { font-size: 20px; }
  .calendar-panel .panel-head p { font-size: 13px; }
  .weekdays, .month-grid { gap: 3px; }
  .month-cell { min-height: 62px; border-radius: 7px; padding: 6px 3px; text-align: center; }
  .day-number { font-size: 14px; }
  .day-events { display: flex; justify-content: center; flex-wrap: wrap; gap: 3px; }
  .day-dot { width: 7px; min-width: 7px; height: 7px; min-height: 7px; padding: 0; font-size: 0; }
  .upcoming-concerts li { display: grid; align-items: stretch; }
  .upcoming-concerts li .button { width: 100%; }
  .upcoming-concerts li .concert-countdown { margin: 0; }
  .event { gap: 12px; padding: 14px; }
  .datebox { display: flex; min-height: 48px; justify-content: flex-start; padding: 10px 12px; }
  .datebox > div { display: flex; align-items: baseline; gap: 7px; }
  .event h3 { line-height: 1.25; }
  .event-repertoire p:has(.button) { display: grid; gap: 8px; }
  .event-repertoire p:has(.button) .button { width: 100%; }
  .note-row { grid-template-columns: minmax(0, 1fr); }
  .note-row .button { width: 100%; }

  .production-picker { margin-bottom: 14px; }
  .production-picker .panel-body > p:has(.button),
  .participation-actions { display: grid; gap: 8px; }
  .production-picker .panel-body > p > .button { width: 100%; margin: 3px 0; }
  .resource-list { gap: 10px; }
  .resource { padding: 12px; }
  .resource-heading h3 { font-size: 21px; line-height: 1.2; }
  .material-file-link { align-items: flex-start; overflow-wrap: anywhere; }
  .upload-drop { padding: 15px; }
  .upload-drop .button { width: 100%; }
  .repertoire-order { padding-left: 22px; }
  .repertoire-order li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .repertoire-order li > span:last-child { display: flex; gap: 4px; }
  .repertoire-order .button { width: 44px; padding: 0; }

  .practice-score-actions .button { width: 100%; }
  .practice-score iframe { min-height: 62vh; }
  .summary-event { padding: 12px; }
  .event-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .event-actions .button { width: 100%; }
  .score-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .score-summary-item { padding: 10px 8px; }
  .score-summary-item span { font-size: 11px; overflow-wrap: anywhere; }
  .score-summary-item strong { font-size: 21px; }
  .choir-member { grid-template-columns: minmax(0, 1fr); }
  .choir-member strong,
  .choir-member span { white-space: normal; overflow-wrap: anywhere; }
  .choir-member-meta { align-items: stretch; flex-direction: column; gap: 5px; }
  .choir-member-meta .button { width: 100%; }
  [data-member-row] > .button { width: 100%; }
  [data-member-row] > span { overflow-wrap: anywhere; }

  .community-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); margin: 8px; padding: 14px; border-radius: 10px; }
  .community-dialog header { position: sticky; z-index: 2; top: -14px; margin: -14px -14px 14px; padding: 14px; border-bottom: 1px solid var(--line); background: #fffdf9; }
  .community-dialog header .button { flex: none; }
  .dialog-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .dialog-actions .button { width: 100%; }
  .plan-items { padding-left: 20px; }
  .plan-items li { padding: 10px; }
  .plan-controls { display: grid; grid-template-columns: 44px 44px minmax(0, 1fr); }
  .plan-controls .button { width: 100%; padding-inline: 8px; }
  .notice-card > .button { width: 100%; margin: 4px 0; }
  .archive-panel > .panel-head { align-items: stretch; }
  .archive-panel > .panel-head .button { width: 100%; }
  .archive-summary { align-items: flex-start; flex-direction: column; }
  .archive-grid { grid-template-columns: minmax(0, 1fr); }
  .archive-card { min-height: 88px; padding: 14px; }
  .archive-title { align-items: flex-start; }
  .archive-title h2 { font-size: 25px; }
  .archive-asset, .archive-audio { grid-template-columns: minmax(0, 1fr); }
  .archive-version-links { display: grid; grid-template-columns: minmax(0, 1fr); }
  .archive-version-links .button { width: 100%; }
  .archive-audio audio { width: 100%; }
  .archive-links article { align-items: stretch; flex-direction: column; }
  .archive-links article a { align-items: flex-start; flex-direction: column; }
  .archive-links article .text-link { min-height: 44px; align-self: flex-start; }
  .archive-management { padding: 14px; }
  .archive-management > .button.danger { width: 100%; }
  .toast { left: 12px; right: 12px; max-width: none; }
}

@media (max-width: 360px) {
  .app-frame .panel-head, .app-frame .panel-body { padding-left: 12px; padding-right: 12px; }
  #memberForm fieldset, .score-summary { grid-template-columns: minmax(0, 1fr); }
  .month-cell { min-height: 56px; }
  .community-dialog { width: calc(100vw - 8px); max-height: calc(100dvh - 8px); margin: 4px; }
}
