:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-alt: #eef4f3;
  --field: #fbfcfc;
  --ink: #172026;
  --muted: #66737c;
  --line: #d8e0e3;
  --teal: #217c76;
  --teal-dark: #155a56;
  --amber: #b7791f;
  --rose: #b42318;
  --blue: #315f99;
  --green: #2f7d32;
  --shadow: 0 18px 40px rgba(23, 32, 38, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101314;
  --surface: #181d1f;
  --surface-alt: #222a2c;
  --field: #121719;
  --ink: #eef3f2;
  --muted: #9aa8ad;
  --line: #313b3f;
  --teal: #53aaa1;
  --teal-dark: #8ed0c9;
  --amber: #e4b15f;
  --rose: #ff8a7d;
  --blue: #8db8f1;
  --green: #8ccf8f;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.is-hidden {
  display: none !important;
}

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

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 26px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 22px;
  background: #172026;
  color: #f8fbfb;
}

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

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: #24464a;
  color: #ffe2a8;
  font-size: 28px;
  line-height: 1;
}

.brand p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand p {
  color: #a6b4ba;
}

.brand h1,
.topbar h2,
.panel h3,
.song-card h4 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

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

.nav-list a,
.tab-button {
  min-height: 42px;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d5dee2;
  text-align: left;
  text-decoration: none;
}

.nav-list a:hover,
.nav-list a.active,
.tab-button:hover,
.tab-button.active {
  background: #243238;
  color: #ffffff;
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-note span {
  display: inline-flex;
  margin-bottom: 8px;
  color: #ffe2a8;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-note p {
  margin: 0;
  color: #cbd6da;
  font-size: 13px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px) auto auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.topbar h2 {
  max-width: 720px;
  font-size: 34px;
  line-height: 1.12;
}

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

.summary-tile {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-tile strong {
  display: block;
  margin-bottom: 5px;
  font-size: 28px;
  line-height: 1;
}

.summary-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.theme-toggle {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.manage-toggle.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.events-grid {
  grid-template-columns: minmax(0, 1fr) minmax(390px, 0.72fr);
}

.refs-grid {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.55fr);
}

.side-stack {
  display: grid;
  gap: 24px;
}

.storage-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.storage-strip a {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.storage-strip a::after {
  content: "↗";
  color: var(--muted);
  font-weight: 700;
}

.compact-gap {
  margin-top: 4px;
  margin-bottom: 8px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel h3 {
  font-size: 22px;
  line-height: 1.2;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

label,
.search-field,
.select-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span,
.search-field span,
.select-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  outline: none;
}

input,
select {
  padding: 0 12px;
}

textarea {
  min-width: 0;
  padding: 12px;
  resize: vertical;
}

select[multiple] {
  min-height: 112px;
  padding: 8px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(33, 124, 118, 0.16);
}

.search-field {
  width: min(300px, 100%);
}

.select-field {
  width: 150px;
}

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

.compact-list {
  gap: 8px;
}

.event-row,
.song-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.calendar-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.calendar-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.calendar-head strong {
  min-width: 180px;
  text-align: center;
  font-size: 18px;
}

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

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

.calendar-cell {
  height: 126px;
  min-height: 126px;
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}

.calendar-cell.empty-cell {
  background: transparent;
  border-style: dashed;
  opacity: 0.4;
}

.calendar-day {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.calendar-day em {
  display: none;
  font-style: normal;
}

.calendar-events {
  display: grid;
  gap: 5px;
  min-height: 0;
  overflow: hidden;
}

.calendar-event-chip {
  display: grid;
  gap: 2px;
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  padding: 5px 6px;
  background: var(--surface-alt);
  overflow: hidden;
}

.calendar-event-chip strong,
.calendar-event-chip em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-chip strong {
  font-size: 12px;
}

.calendar-event-chip em,
.calendar-more {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.chip-color-1 {
  border-left-color: var(--amber);
}

.chip-color-2 {
  border-left-color: var(--blue);
}

.chip-color-3 {
  border-left-color: var(--green);
}

.event-row {
  cursor: pointer;
}

.event-row:hover {
  border-color: #b8c8cc;
  background: var(--field);
}

.song-row {
  grid-template-columns: minmax(0, 1fr) auto;
  cursor: pointer;
}

.date-badge {
  width: 52px;
  min-height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--teal-dark);
}

.date-badge strong,
.date-badge span {
  display: block;
  line-height: 1;
}

.date-badge strong {
  font-size: 20px;
}

.date-badge span {
  font-size: 12px;
  font-weight: 800;
}

.row-main {
  min-width: 0;
}

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

.row-title h4,
.event-row p,
.song-row p {
  margin: 0;
}

.row-title h4 {
  font-size: 17px;
}

.event-row p,
.song-row p,
.row-stats {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.song-row:hover {
  border-color: #b8c8cc;
  background: var(--field);
}

.row-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.row-stats span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  white-space: nowrap;
}

.song-card,
.event-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.song-main,
.event-main {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
}

.song-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.song-card h4,
.event-card h4 {
  font-size: 18px;
  line-height: 1.25;
}

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status-ready {
  background: #e6f3e8;
  color: var(--green);
}

.status-review {
  background: #e8f0fb;
  color: var(--blue);
}

.status-needs_files {
  background: #fff3d9;
  color: var(--amber);
}

.status-draft {
  background: #eef1f2;
  color: #4a5961;
}

.event-status-planning {
  background: #fff3d9;
  color: var(--amber);
}

.event-status-preparing {
  background: #e8f0fb;
  color: var(--blue);
}

.event-status-ready,
.event-status-done {
  background: #e6f3e8;
  color: var(--green);
}

.event-status-canceled {
  background: #fff0ef;
  color: var(--rose);
}

:root[data-theme="dark"] .status-ready,
:root[data-theme="dark"] .status-review,
:root[data-theme="dark"] .status-needs_files,
:root[data-theme="dark"] .status-draft,
:root[data-theme="dark"] .event-status-planning,
:root[data-theme="dark"] .event-status-preparing,
:root[data-theme="dark"] .event-status-ready,
:root[data-theme="dark"] .event-status-done,
:root[data-theme="dark"] .event-status-canceled {
  background: var(--surface-alt);
}

.song-meta,
.song-comment,
.event-meta,
.event-comment {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.song-comment,
.event-comment {
  color: var(--ink);
}

.event-songs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.event-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.event-block > strong {
  font-size: 13px;
}

.song-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--surface-alt);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

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

.schedule-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.schedule-time {
  color: var(--teal-dark);
  font-weight: 900;
}

.schedule-row strong,
.schedule-row span {
  display: block;
}

.schedule-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.icon-danger {
  width: 30px;
  height: 30px;
  border: 1px solid #ffd5d1;
  border-radius: 8px;
  background: #fff5f3;
  color: var(--rose);
  font-size: 20px;
  line-height: 1;
}

.mini-empty {
  margin: 0;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.request-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.request-row span {
  flex: 1;
  min-width: 180px;
  color: var(--ink);
  font-size: 14px;
}

.request-song-link {
  min-height: 26px;
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 0;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 800;
}

.request-approved {
  border-color: #cfe6d2;
  background: #f6fbf7;
}

.request-rejected {
  border-color: #ffd5d1;
  background: #fff8f7;
}

:root[data-theme="dark"] .request-approved,
:root[data-theme="dark"] .request-rejected {
  background: var(--surface-alt);
}

.tiny-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--teal);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.muted-button {
  background: var(--surface);
  color: var(--muted);
}

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

.song-actions select {
  width: 150px;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.link-row a {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.materials-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.material-item {
  display: grid;
  grid-template-columns: 74px auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.material-item strong {
  font-size: 13px;
}

.material-item em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.material-item a {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.material-item .icon-download,
.icon-download {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal-dark);
  text-decoration: none;
}

.material-item span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.media-count {
  display: inline-flex;
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

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

.preset-grid button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 800;
}

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

.song-form,
.event-form,
.schedule-form,
.quick-form,
.admin-form {
  display: grid;
  gap: 14px;
}

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

.refs-columns h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.mini-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mini-head h4 {
  margin: 0;
}

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

.mini-item {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.mini-action-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.mini-action-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-action-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.danger-mini {
  border-color: #ffd5d1;
  background: #fff5f3;
  color: var(--rose);
}

:root[data-theme="dark"] .danger-button,
:root[data-theme="dark"] .danger-mini,
:root[data-theme="dark"] .icon-danger {
  border-color: #5e3733;
  background: #261918;
}

.is-muted {
  opacity: 0.55;
}

.toggle-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
  padding: 11px 0 0;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.toggle-row span {
  color: var(--ink);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.check-grid legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.check-grid label {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
}

.check-grid input {
  width: 18px;
  min-height: 18px;
}

.form-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.form-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.icon-only {
  width: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  font-size: 18px;
}

.tiny-button.icon-only,
.icon-danger.icon-only {
  width: 30px;
  min-width: 30px;
  padding: 0;
  font-size: 15px;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.danger-button {
  border-color: #ffd5d1;
  background: #fff5f3;
  color: var(--rose);
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.small-empty {
  min-height: 120px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 22, 27, 0.48);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  max-height: min(88vh, 920px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(23, 32, 38, 0.25);
  overflow: hidden;
}

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

.modal-head h3 {
  margin: 0;
  font-size: 22px;
}

.modal-body {
  overflow: auto;
  padding: 20px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.favicon-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.favicon-preview img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.modal-form {
  display: grid;
  gap: 14px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.password-toggle:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.event-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 18px;
}

.song-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.45fr) minmax(0, 0.55fr);
  gap: 18px;
}

.song-detail-grid p {
  margin: 0 0 8px;
}

.song-picker {
  display: grid;
  gap: 12px;
}

.song-picker-results {
  max-height: min(48vh, 460px);
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.song-picker-row {
  width: 100%;
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.song-picker-row:hover {
  border-color: #9fb7bd;
  background: var(--field);
}

.song-picker-row strong,
.song-picker-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-picker-row span {
  color: var(--muted);
  font-size: 12px;
}

.split-actions {
  justify-content: space-between;
}

.song-text-preview {
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-family: inherit;
  white-space: pre-wrap;
}

.detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-side {
  display: grid;
  align-content: start;
  gap: 10px;
}

.detail-side h4 {
  margin: 0;
  font-size: 14px;
}

.event-side-section {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.event-group-list {
  max-height: 150px;
  overflow-y: auto;
}

.event-song-approvals {
  min-height: 0;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assignment-chip {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 13px;
}

.assignment-chip strong {
  color: var(--muted);
}

.person-link {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 8px;
  background: var(--surface);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

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

.person-card {
  display: grid;
  gap: 12px;
}

.person-card p {
  margin: 0;
}

.contact-missing {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.request-list {
  display: grid;
  gap: 8px;
  max-height: min(52vh, 520px);
  overflow-y: auto;
  padding-right: 3px;
  overscroll-behavior: contain;
}

.chip-icon-button {
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--rose);
  font-weight: 900;
}

.day-event-switcher {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.day-event-switcher button {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.day-event-switcher button.active {
  border-color: var(--teal);
  background: var(--surface-alt);
}

.day-event-switcher span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.sheet-tabs button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.sheet-tabs button.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.sheet-table-wrap {
  display: grid;
  gap: 10px;
  overflow-x: auto;
}

.sheet-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}

.two-col-sheet {
  min-width: 520px;
}

.wide-sheet {
  min-width: 1080px;
}

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

.sheet-table th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
}

.schedule-set-tabs {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.schedule-set-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.schedule-set-list button {
  min-width: 116px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.schedule-set-list button.active {
  border-color: var(--teal);
  background: var(--field);
}

.schedule-set-list span {
  color: var(--muted);
  font-size: 12px;
}

.schedule-set-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}

.schedule-wrap {
  display: grid;
  gap: 10px;
}

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

.schedule-table th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
}

.table-actions {
  width: 126px;
  white-space: nowrap;
}

.table-actions button + button {
  margin-left: 6px;
}

.schedule-head-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.column-tools {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.column-tools button {
  min-width: 24px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.drag-hint,
.row-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-height: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: grab;
  font-size: 12px;
  font-weight: 800;
  user-select: none;
}

.schedule-table .drag-hint,
.schedule-table .row-drag-handle {
  display: inline-flex;
  margin-top: 0;
  color: var(--muted);
}

.schedule-add-row {
  display: flex;
  justify-content: center;
}

.schedule-empty {
  gap: 10px;
}

[draggable="true"] {
  cursor: grab;
}

.is-dragging {
  opacity: 0.45;
}

.is-drop-target {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
  background: var(--surface-alt);
}

.schedule-table strong,
.schedule-table span {
  display: block;
}

.schedule-table span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.stage-end-time {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.schedule-total {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-alt);
}

.schedule-total span {
  color: var(--muted);
  font-size: 12px;
}

.team-value,
.team-schedule-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.team-schedule-badge {
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--field);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.team-schedule-badge.all {
  color: var(--teal-dark);
}

@media (max-width: 1180px) {
  .topbar,
  .content-grid,
  .events-grid,
  .refs-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .storage-strip {
    max-width: 680px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 18px;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

  .topbar h2 {
    font-size: 26px;
  }

  .summary-grid,
  .storage-strip,
  .form-grid,
  .preset-grid,
  .refs-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .event-row,
  .song-row,
  .event-detail-grid,
  .song-detail-grid {
    grid-template-columns: 1fr;
  }

  .date-badge {
    width: 100%;
    min-height: 42px;
    grid-template-columns: auto auto;
    justify-content: start;
    gap: 6px;
    padding: 0 10px;
  }

  .panel-head,
  .song-main,
  .event-main,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .song-actions {
    justify-content: stretch;
  }

  .search-field,
  .select-field,
  .song-actions select {
    width: 100%;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(34px, 1fr));
    gap: 4px;
  }

  .calendar-cell {
    min-height: 78px;
    height: 78px;
    padding: 5px;
    gap: 4px;
  }

  .calendar-event-chip {
    padding: 3px 4px;
  }

  .calendar-event-chip em {
    display: none;
  }
}

@media (max-width: 520px) {
  .nav-list,
  .summary-grid,
  .storage-strip,
  .form-grid,
  .preset-grid,
  .refs-columns {
    grid-template-columns: 1fr;
  }

  .material-item {
    grid-template-columns: 1fr;
  }

  .brand h1 {
    font-size: 18px;
  }

  .panel {
    padding: 16px;
  }

  .calendar-weekdays {
    display: none;
  }

  .calendar-day em {
    display: inline;
  }

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

  .calendar-cell {
    min-height: 70px;
    height: 70px;
    border-radius: 6px;
  }

  .calendar-cell.empty-cell {
    display: block;
  }
}
