: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 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;
}

.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;
}

.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;
}

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

.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-box {
  background: var(--soft);
  border-radius: 7px;
  padding: 10px;
}

.summary-box strong {
  display: block;
  margin-bottom: 6px;
}

.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;
}

.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 {
    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;
  }
}
