:root {
  color-scheme: light;
  --ink: #282420;
  --muted: #716b64;
  --line: #ddd7cf;
  --paper: #f6f7f2;
  --panel: #ffffff;
  --sidebar: #2c2724;
  --sidebar-soft: #3a332f;
  --accent: #147d76;
  --accent-dark: #0e5f5a;
  --accent-soft: #e3f4f1;
  --coral: #b9503e;
  --coral-soft: #fde9e3;
  --warn: #a65f18;
  --danger: #b42318;
  --green: #2e7358;
  --shadow: 0 16px 34px rgba(42, 36, 31, 0.1);
  --shadow-soft: 0 6px 18px rgba(42, 36, 31, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(20, 125, 118, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(185, 80, 62, 0.08), transparent 320px),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(14, 95, 90, 0.24);
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button.secondary {
  color: var(--ink);
  background: #e9e4dc;
  box-shadow: 0 2px 0 rgba(42, 36, 31, 0.1);
}

button.secondary:hover {
  background: #ded6cc;
}

button.danger {
  background: var(--danger);
  box-shadow: 0 3px 0 rgba(125, 22, 14, 0.2);
}

button.danger:hover {
  background: #8f1c13;
}

button.secondary-danger {
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.22);
  background: #fff4f2;
  box-shadow: 0 2px 0 rgba(125, 22, 14, 0.08);
}

button.secondary-danger:hover {
  background: var(--coral-soft);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf9;
  color: var(--ink);
  padding: 10px 11px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 125, 118, 0.16);
  outline: 0;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

label,
.field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-help {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 0;
  background:
    linear-gradient(180deg, rgba(20, 125, 118, 0.16), transparent 240px),
    var(--sidebar);
  padding: 24px;
  color: #f8f3eb;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.brand::before {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, var(--accent), var(--coral));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.account {
  display: grid;
  gap: 4px;
  margin-bottom: 22px;
  color: #cfc5ba;
  font-size: 0.9rem;
}

.account strong {
  color: #fffaf2;
}

.band-list {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.band-tab {
  position: relative;
  width: 100%;
  color: #f5efe7;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
}

.band-tab:hover,
.band-tab.active {
  background: var(--sidebar-soft);
  border-color: rgba(255, 255, 255, 0.14);
  transform: none;
}

.band-tab.active {
  color: #fffaf2;
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: inset 4px 0 0 var(--accent);
}

.sidebar-label {
  margin: 10px 0 4px;
  color: #b9aea4;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.band-current {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: var(--sidebar-soft);
  color: #fffaf2;
  font-weight: 800;
  padding: 10px 14px;
}

.content {
  padding: 32px;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 2.25rem;
  line-height: 1.1;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.panel {
  position: relative;
  overflow: hidden;
  grid-column: span 6;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--coral));
}

.panel.wide {
  grid-column: span 12;
}

.panel h2 {
  margin: 2px 0 16px;
  font-size: 1.08rem;
}

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

.panel-heading h2 {
  margin: 0;
}

button.compact {
  min-height: 34px;
  padding: 0 11px;
  white-space: nowrap;
}

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

.full {
  grid-column: 1 / -1;
}

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

.list {
  display: grid;
  gap: 10px;
}

.section-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  margin: 0 0 14px;
  padding: 12px;
}

.section-action summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.section-action form,
.section-action p {
  margin-top: 14px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.calendar-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.calendar-weekdays {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 6px;
  text-align: center;
}

.calendar-day {
  min-height: 96px;
  border: 1px solid var(--line);
  background: #fffdf9;
  padding: 8px;
}

.calendar-day.empty {
  background: #efede7;
}

.calendar-day.has-practice {
  background: var(--accent-soft);
}

.calendar-date {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.calendar-event {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 0;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
}

.calendar-event:hover,
.calendar-event.selected {
  background: var(--coral-soft);
  color: var(--ink);
}

.calendar-event strong,
.calendar-event span {
  overflow-wrap: anywhere;
}

.calendar-event span:last-child:not(:only-child) {
  color: var(--muted);
  font-weight: 600;
}

.practice-list-mode {
  display: none;
}

.practice-list-event {
  display: grid;
  grid-template-columns: minmax(74px, 0.28fr) 1fr;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  background: #fffdf9;
  color: var(--ink);
  padding: 12px;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.practice-list-event:hover,
.practice-list-event.selected {
  background: var(--coral-soft);
  color: var(--ink);
}

.practice-list-date {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.practice-list-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.practice-list-main strong,
.practice-list-main span {
  overflow-wrap: anywhere;
}

.practice-list-main span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.mobile-empty-state {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf9;
  margin: 0;
  padding: 14px;
}

.calendar-hint {
  margin: 12px 0 0;
}

.practice-editor {
  border-top: 1px solid var(--line);
  background: #fbfaf6;
  border-radius: 8px;
  margin-top: 18px;
  padding: 18px;
}

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

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

.practice-editor form {
  margin-top: 14px;
}

.occurrence-note {
  margin: 8px 0 0;
}

.item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fffdf9;
  box-shadow: var(--shadow-soft);
}

.item h3 {
  margin: 0 0 5px;
  font-size: 1rem;
}

.item p {
  margin: 4px 0;
  color: var(--muted);
}

.item-actions,
.item-action {
  margin-top: 10px;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.item-actions button.compact {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.84rem;
}

.songbook-filter {
  display: block;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--accent-soft);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.warn {
  background: #fff0d9;
  color: var(--warn);
}

.checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 160px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffdf9;
}

.setlist-tag-picker {
  position: relative;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 4px 3px 10px;
  border: 1px solid #d7d0c7;
  border-radius: 999px;
  background: #fbfaf6;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(42, 36, 31, 0.06);
}

.tag-chip button {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 50%;
  background: #eee9e2;
  color: var(--muted);
  box-shadow: none;
  font-size: 1rem;
  line-height: 1;
}

.tag-chip button:hover,
.tag-chip button:focus-visible {
  background: var(--coral-soft);
  color: var(--coral);
  box-shadow: none;
  transform: none;
}

.tag-options {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(20, 24, 31, 0.16);
}

.tag-options button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.tag-options button:hover,
.tag-options button:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
}

.checkbox-list.tall {
  max-height: 230px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}

.check-row input {
  width: auto;
}

.setlist-builder {
  display: grid;
  gap: 12px;
}

.setlist-builder-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 12px;
}

.setlist-picker-pane {
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf9;
  padding: 12px;
  overflow: hidden;
}

.setlist-pane-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.setlist-pane-heading h3 {
  margin: 0;
  font-size: 0.96rem;
}

.setlist-song-results,
.selected-setlist-songs {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.setlist-song-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--paper);
}

.selected-setlist-song {
  display: grid;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--paper);
}

.setlist-song-row span,
.selected-setlist-song span {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  font-weight: 700;
}

.selected-setlist-songs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.selected-song-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.icon-button {
  min-width: 54px;
}

.auth {
  width: min(440px, calc(100vw - 32px));
  margin: max(7vh, 32px) auto;
  display: grid;
  gap: 24px;
}

.auth-title {
  text-align: center;
}

.auth-title h1 {
  margin: 0;
  font-size: 2.55rem;
}

.auth-title p {
  color: var(--muted);
}

.auth-card .panel {
  width: 100%;
  padding: 28px;
}

.auth-switch {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.auth-switch + .auth-switch {
  margin-top: 10px;
}

.auth-help {
  color: var(--muted);
  line-height: 1.5;
}

.auth-message {
  padding: 14px 16px;
  border: 1px solid rgba(46, 115, 88, 0.25);
  border-radius: 8px;
  background: #eaf5ed;
  color: var(--green);
}

.member-invites {
  margin-top: 18px;
}

.dev-reset-link {
  display: block;
  margin-top: 8px;
}

button.text-button {
  min-height: 0;
  padding: 0;
  color: var(--accent-dark);
  background: none;
  box-shadow: none;
  font-weight: 700;
}

button.text-button:hover {
  color: var(--accent);
  background: none;
  transform: none;
  text-decoration: underline;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

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

a {
  color: var(--coral);
  font-weight: 800;
}

.edit-block {
  margin-top: 12px;
}

.edit-block summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.edit-block form {
  margin-top: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(32, 27, 23, 0.54);
  padding: 20px;
}

.modal {
  width: min(720px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(32, 27, 23, 0.28);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fffdf9;
  padding: 16px 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  min-width: 38px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.modal-body {
  padding: 18px;
}

.modal-meta {
  margin-bottom: 12px;
}

.modal-form-offset {
  margin-top: 14px;
}

.modal-danger-zone {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.setlist-songs {
  margin: 12px 0 0;
  padding-left: 24px;
}

.setlist-songs li {
  margin-bottom: 8px;
  color: var(--ink);
}

.setlist-songs li a {
  margin-left: 8px;
}

.song-library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.super-table {
  width: 100%;
  border-collapse: collapse;
}

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

.super-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

@media (max-width: 860px) {
  .shell,
  .auth {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 0;
  }

  .panel {
    grid-column: span 12;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-heading button {
    width: 100%;
  }

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

  .setlist-builder-grid {
    grid-template-columns: 1fr;
  }

  .setlist-song-results,
  .selected-setlist-songs {
    max-height: 220px;
  }

  .calendar-day {
    min-height: 76px;
    padding: 5px;
  }

  .calendar-event {
    font-size: 0.72rem;
  }

  .calendar-header {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-controls button {
    flex: 1;
  }

  .calendar-month {
    display: none;
  }

  .practice-list-mode {
    display: grid;
    gap: 10px;
  }

  .practice-editor-header {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .modal-danger-zone {
    display: grid;
  }
}
