:root {
  color-scheme: light;
  --bg: #f7f7fb;
  --panel: #ffffff;
  --panel-soft: #f0eef8;
  --panel-tint: #fbfbff;
  --ink: #18141f;
  --ink-soft: #302a3d;
  --muted: #706a7d;
  --line: #e4dfec;
  --line-strong: #c9bfd8;
  --jade: #0fbfa6;
  --jade-ink: #07584f;
  --plum: #7c3aed;
  --copper: #ff5f7a;
  --gold: #f4b63f;
  --blue: #2563eb;
  --teal: var(--jade);
  --teal-ink: var(--jade-ink);
  --rose: #ff4d73;
  --amber: #f59e0b;
  --field: #ffffff;
  --field-focus: #ffffff;
  --placeholder: #9a94a7;
  --focus-border: rgba(15, 191, 166, 0.72);
  --focus-ring: rgba(15, 191, 166, 0.18);
  --topbar-bg: rgba(20, 17, 29, 0.94);
  --topbar-border: rgba(255, 255, 255, 0.12);
  --topbar-ink: #ffffff;
  --topbar-muted: #cbc4d8;
  --summary-bg: linear-gradient(135deg, rgba(15, 191, 166, 0.14), rgba(124, 58, 237, 0.08) 52%, rgba(244, 182, 63, 0.13)), var(--panel);
  --summary-item-bg: rgba(255, 255, 255, 0.78);
  --section-header-bg: linear-gradient(135deg, rgba(15, 191, 166, 0.14), rgba(124, 58, 237, 0.08) 52%, rgba(244, 182, 63, 0.1)), #fbfbff;
  --section-body-bg: rgba(248, 248, 252, 0.78);
  --card-bg: #ffffff;
  --card-body-bg: linear-gradient(90deg, rgba(15, 191, 166, 0.055), rgba(244, 182, 63, 0.05)), #fdfdff;
  --drag-bg: linear-gradient(135deg, rgba(15, 191, 166, 0.14), rgba(244, 182, 63, 0.08)), #fbfbff;
  --empty-bg: rgba(255, 255, 255, 0.72);
  --rename-bg: rgba(15, 191, 166, 0.12);
  --body-glow:
    radial-gradient(circle at 18% -18%, rgba(15, 191, 166, 0.26), transparent 34%),
    radial-gradient(circle at 88% -8%, rgba(124, 58, 237, 0.18), transparent 36%),
    linear-gradient(180deg, #ffffff 0, var(--bg) 360px);
  --logo-filter: invert(1);
  --shadow: 0 18px 46px rgba(24, 20, 31, 0.1);
  --shadow-soft: 0 10px 26px rgba(24, 20, 31, 0.07);
  --radius: 8px;
  --font-body: Arial, Helvetica, sans-serif;
  --font-display: Arial, Helvetica, sans-serif;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1018;
  --panel: #171a24;
  --panel-soft: #202432;
  --panel-tint: #1c202c;
  --ink: #fbf8ff;
  --ink-soft: #ede7f7;
  --muted: #aaa3bb;
  --line: #2c3142;
  --line-strong: #465067;
  --jade: #35e0c3;
  --jade-ink: #a8fff0;
  --plum: #a78bfa;
  --copper: #fb7185;
  --gold: #f7c76b;
  --blue: #60a5fa;
  --teal: var(--jade);
  --teal-ink: #bafff3;
  --rose: #fb7185;
  --amber: #fbbf24;
  --field: #11141d;
  --field-focus: #171b27;
  --placeholder: #817a8f;
  --focus-border: rgba(53, 224, 195, 0.82);
  --focus-ring: rgba(53, 224, 195, 0.18);
  --topbar-bg: rgba(10, 12, 18, 0.94);
  --topbar-border: rgba(255, 255, 255, 0.08);
  --topbar-ink: #ffffff;
  --topbar-muted: #aaa3bb;
  --summary-bg: linear-gradient(135deg, rgba(53, 224, 195, 0.16), rgba(167, 139, 250, 0.12) 54%, rgba(247, 199, 107, 0.1)), var(--panel);
  --summary-item-bg: rgba(28, 32, 44, 0.88);
  --section-header-bg: linear-gradient(135deg, rgba(53, 224, 195, 0.13), rgba(167, 139, 250, 0.12) 52%, rgba(247, 199, 107, 0.08)), #171a24;
  --section-body-bg: rgba(14, 16, 24, 0.62);
  --card-bg: #171a24;
  --card-body-bg: linear-gradient(90deg, rgba(53, 224, 195, 0.06), rgba(247, 199, 107, 0.05)), #151822;
  --drag-bg: linear-gradient(135deg, rgba(53, 224, 195, 0.12), rgba(247, 199, 107, 0.07)), #1c202c;
  --empty-bg: rgba(28, 32, 44, 0.72);
  --rename-bg: rgba(53, 224, 195, 0.14);
  --body-glow:
    radial-gradient(circle at 16% -14%, rgba(53, 224, 195, 0.16), transparent 34%),
    radial-gradient(circle at 86% -4%, rgba(167, 139, 250, 0.16), transparent 36%),
    linear-gradient(180deg, #10131d 0, var(--bg) 390px);
  --logo-filter: invert(1);
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--body-glow);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  cursor: pointer;
  letter-spacing: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: var(--teal);
}

.app-shell {
  min-height: 100vh;
}

.loading-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 18px;
  color: var(--muted);
}

.mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--plum), var(--jade));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  box-shadow: 0 16px 30px rgba(24, 20, 31, 0.2);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(90px, auto);
  gap: 18px;
  align-items: center;
  padding: 16px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--topbar-border);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-logo-wrap {
  display: grid;
  flex: 0 0 auto;
  width: 118px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.brand-logo {
  display: block;
  width: 102px;
  height: 28px;
  object-fit: contain;
  filter: var(--logo-filter);
}

.brand-copy {
  min-width: 0;
}

.brand-copy span {
  display: block;
  color: var(--topbar-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--topbar-ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--topbar-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.tab {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  background: transparent;
  color: var(--topbar-muted);
  font-weight: 800;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.tab:hover {
  color: var(--topbar-ink);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sync {
  min-width: 76px;
  color: var(--topbar-muted);
  font-size: 0.84rem;
  text-align: right;
}

.icon-btn,
.text-btn,
.move-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.46);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.icon-btn:hover,
.text-btn:hover,
.move-btn:hover {
  border-color: var(--line-strong);
  background: var(--panel-tint);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.topbar .icon-btn,
.topbar .text-btn,
.topbar .move-btn {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: none;
}

.topbar .icon-btn:hover,
.topbar .text-btn:hover,
.topbar .move-btn:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.16);
}

.icon-btn {
  display: inline-grid;
  width: 36px;
  place-items: center;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  text-decoration: none;
}

.move-btn {
  min-height: 32px;
  padding: 0 10px;
  background: var(--panel-soft);
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.primary-btn {
  border-color: var(--teal);
  background: linear-gradient(135deg, var(--jade), var(--blue));
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 191, 166, 0.18);
}

.danger-btn {
  color: var(--rose);
}

.theme-btn {
  min-width: 104px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: 18px;
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 3vw, 34px) 40px;
}

.admin-shell {
  display: grid;
  gap: 18px;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 34px) 44px;
}

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 18px;
  align-items: stretch;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 191, 166, 0.18), rgba(37, 99, 235, 0.09) 46%, rgba(244, 182, 63, 0.16)),
    var(--panel);
  box-shadow: var(--shadow);
}

.admin-hero-copy h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.admin-hero-copy p {
  max-width: 42rem;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

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

.admin-stat {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-stat strong {
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1;
}

.admin-stat span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.42fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-panel-heading {
  display: grid;
  gap: 4px;
}

.admin-panel-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.18rem;
}

.index-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-submit {
  min-height: 44px;
  justify-self: start;
  padding: 0 18px;
}

.planner-list {
  display: grid;
  gap: 12px;
}

.planner-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--jade);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 1px 0 rgba(24, 20, 31, 0.03);
}

.planner-card.archived {
  border-left-color: var(--line-strong);
  opacity: 0.74;
}

.planner-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.planner-card h3 {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: 1.12rem;
}

.status-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(15, 191, 166, 0.14);
  color: var(--teal-ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.status-chip.archived {
  background: var(--panel-soft);
  color: var(--muted);
}

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

.planner-meta div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-tint);
}

.planner-meta span,
.admin-progress span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.planner-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-progress {
  display: grid;
  gap: 8px;
}

.admin-progress > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.admin-progress strong {
  font-family: var(--font-display);
}

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

.link-strip input {
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--muted);
  font-size: 0.82rem;
}

.planner-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.panel,
.section-panel,
.run-panel,
.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 17px;
}

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

.panel-title h2,
.panel-title h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
}

.setup-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 42px) 44px;
}

.setup-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--summary-bg);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.setup-copy h1,
.event-summary h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.08;
}

.setup-copy p {
  margin: 14px 0 0;
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.5;
}

.setup-form {
  display: grid;
  gap: 12px;
}

.setup-submit {
  min-height: 46px;
  justify-self: start;
  padding: 0 18px;
}

.event-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.event-details-card {
  display: grid;
  grid-template-columns: minmax(190px, 0.48fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--summary-bg);
  box-shadow: var(--shadow-soft);
}

.event-heading {
  min-width: 0;
}

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

.event-meta-inline div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--summary-item-bg);
}

.event-meta-inline span,
.guest-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.event-meta-inline strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guest-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.guest-toggle.enabled {
  border-color: rgba(15, 191, 166, 0.72);
  background: linear-gradient(135deg, rgba(15, 191, 166, 0.14), rgba(37, 99, 235, 0.06)), var(--panel);
}

.guest-toggle:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.guest-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.18s ease;
}

.guest-switch span {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}

.guest-toggle.enabled .guest-switch {
  background: linear-gradient(135deg, var(--jade), var(--blue));
}

.guest-toggle.enabled .guest-switch span {
  transform: translateX(20px);
}

.guest-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.guest-copy strong {
  font-size: 0.94rem;
}

.guest-copy small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.tips-panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.tips-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  background: linear-gradient(135deg, rgba(15, 191, 166, 0.12), rgba(124, 58, 237, 0.08)), var(--panel);
}

.tips-panel summary::-webkit-details-marker {
  display: none;
}

.tips-panel summary span {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 900;
}

.tips-panel summary strong {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tips-panel summary::after {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-ink);
  content: "+";
  font-weight: 900;
}

.tips-panel details[open] summary::after {
  content: "-";
}

.tips-content {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.55;
}

.tips-content p {
  margin: 0;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.small-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select,
.inline-input,
.song-input,
.section-title-input,
.item-title-input,
.notes-area,
.details-area,
.background-textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-size: 0.92rem;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.field input,
.field select,
.inline-input,
.song-input,
.section-title-input,
.item-title-input {
  min-height: 38px;
  padding: 7px 9px;
}

.field textarea,
.notes-area {
  min-height: 78px;
  resize: vertical;
  padding: 10px;
  line-height: 1.42;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.inline-input:focus,
.song-input:focus,
.section-title-input:focus,
.item-title-input:focus,
.notes-area:focus,
.details-area:focus,
.background-textarea:focus {
  border-color: var(--focus-border);
  background: var(--field-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-tint);
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.2s ease;
}

.switch span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(21, 32, 33, 0.22);
  content: "";
  transition: transform 0.2s ease;
}

.switch input:checked + span {
  background: linear-gradient(135deg, var(--jade), var(--blue));
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.progress-row {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.progress-line {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--panel-soft);
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--gold), var(--plum));
}

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

.metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-tint);
}

.metric strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.metric span {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

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

.section-tone-ceremony {
  --section-accent: var(--jade);
  --section-ink: var(--teal-ink);
  --section-soft: rgba(15, 191, 166, 0.13);
  --section-header-fill: linear-gradient(135deg, rgba(15, 191, 166, 0.14), rgba(15, 191, 166, 0.04)), var(--panel);
}

.section-tone-background {
  --section-accent: var(--gold);
  --section-ink: #8a5d00;
  --section-soft: rgba(244, 182, 63, 0.17);
  --section-header-fill: linear-gradient(135deg, rgba(244, 182, 63, 0.19), rgba(244, 182, 63, 0.05)), var(--panel);
}

.section-tone-key {
  --section-accent: #f97316;
  --section-ink: #a94300;
  --section-soft: rgba(249, 115, 22, 0.15);
  --section-header-fill: linear-gradient(135deg, rgba(249, 115, 22, 0.17), rgba(249, 115, 22, 0.04)), var(--panel);
}

.section-tone-custom {
  --section-accent: var(--blue);
  --section-ink: var(--blue);
  --section-soft: rgba(37, 99, 235, 0.12);
  --section-header-fill: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.04)), var(--panel);
}

body[data-theme="dark"] .section-tone-background {
  --section-ink: #ffd778;
}

body[data-theme="dark"] .section-tone-key {
  --section-ink: #fdba74;
}

.section-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-tint);
  color: var(--ink);
  text-align: left;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.section-link.active {
  border-color: var(--section-accent);
  background: var(--section-soft);
}

.section-link:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.section-link strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-link .count-pill {
  background: var(--section-soft);
  color: var(--section-ink);
}

.count-pill,
.status-pill,
.type-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.74rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.count-pill {
  background: var(--panel-soft);
  color: var(--muted);
}

.status-pill {
  background: rgba(15, 191, 166, 0.13);
  color: var(--teal-ink);
}

.status-pill.needs {
  background: rgba(245, 158, 11, 0.16);
  color: var(--amber);
}

.status-pill.dj {
  background: rgba(37, 99, 235, 0.14);
  color: var(--blue);
}

.type-pill {
  background: var(--panel-soft);
  color: var(--muted);
}

.action-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.main {
  min-width: 0;
}

.planner {
  display: grid;
  gap: 16px;
}

.section-panel {
  overflow: hidden;
  background: var(--panel);
}

.section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--section-header-fill);
}

.section-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.section-title-row .section-title-input {
  flex: 1 1 auto;
}

.section-title-input {
  border-color: var(--section-accent);
  background: var(--field);
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink);
}

.title-edit-input:hover {
  border-color: var(--section-accent);
}

.section-title-input:focus {
  background: var(--field-focus);
}

.section-actions,
.item-actions,
.song-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.section-body {
  display: grid;
  gap: 10px;
  min-height: 34px;
  padding: 13px;
  background: var(--section-body-bg);
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.section-body.drag-active {
  background: linear-gradient(180deg, rgba(15, 191, 166, 0.12), rgba(124, 58, 237, 0.05)), var(--section-body-bg);
  box-shadow: inset 0 0 0 2px rgba(15, 191, 166, 0.34);
}

.item-card {
  position: relative;
  border: 1px solid var(--line);
  border-left: 4px solid var(--section-accent);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 1px 0 rgba(24, 20, 31, 0.03);
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.item-card.dragging {
  border-color: var(--jade);
  opacity: 0.55;
  transform: scale(0.99);
  box-shadow: var(--shadow);
}

.item-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.item-card.drop-before::before,
.item-card.drop-after::after {
  position: absolute;
  right: 12px;
  left: 12px;
  z-index: 2;
  display: grid;
  height: 34px;
  place-items: center;
  border: 1px solid var(--section-accent);
  border-radius: 8px;
  background: var(--section-soft);
  color: var(--section-ink);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  content: "Drop here";
  pointer-events: none;
}

.item-card.drop-before::before {
  top: -24px;
}

.item-card.drop-after::after {
  bottom: -24px;
}

.item-card.just-moved {
  animation: movedFlash 0.85s ease;
}

.item-card.just-moved::after {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--section-accent);
  color: #fff;
  content: "Moved";
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  animation: movedBadge 0.9s ease forwards;
  pointer-events: none;
}

.item-top {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 11px 10px 9px;
  border-bottom: 1px solid var(--line);
}

.item-title-block {
  min-width: 0;
}

.drag-handle {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--drag-bg);
  color: var(--jade-ink);
  cursor: grab;
  user-select: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.drag-handle:active {
  cursor: grabbing;
}

.item-card:hover .drag-handle,
.is-reordering .drag-handle {
  border-color: var(--section-accent);
  background: var(--section-soft);
}

.item-card:hover .move-icon {
  animation: moveNudge 1s ease-in-out infinite;
}

.move-icon {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: var(--section-accent);
  color: #fff;
  font-weight: 900;
}

.move-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.move-copy strong {
  font-family: var(--font-display);
  font-size: 0.8rem;
}

.move-copy small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.1;
}

.item-title-input {
  min-height: 42px;
  border-color: var(--line-strong);
  background: var(--field);
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 800;
}

.item-title-input:focus {
  border-color: var(--section-accent);
  background: var(--field-focus);
}

.compact-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 9px 11px 11px;
  background: var(--card-body-bg);
}

.song-list {
  display: grid;
  gap: 7px;
  padding: 0;
  min-width: 0;
}

.song-row {
  display: grid;
  grid-template-columns: minmax(128px, 1.1fr) minmax(112px, 0.95fr) minmax(150px, 1.15fr) auto;
  gap: 7px;
  align-items: start;
}

.song-row.single-song {
  grid-template-columns: minmax(128px, 1.1fr) minmax(112px, 0.95fr) minmax(150px, 1.15fr);
}

.song-input {
  min-height: 34px;
}

.details-area {
  grid-column: 1;
  width: 100%;
  min-height: 40px;
  max-height: 150px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.32;
  outline: none;
  resize: vertical;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.details-area:focus {
  border-color: var(--focus-border);
  background: var(--field-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.compact-card-body > .text-btn {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  white-space: nowrap;
}

.background-card-body {
  display: grid;
  grid-template-columns: minmax(170px, 0.85fr) minmax(220px, 1.1fr) minmax(180px, 0.9fr);
  gap: 10px;
  padding: 10px 11px 11px;
  background: var(--card-body-bg);
}

.background-textarea {
  min-height: 88px;
  max-height: 260px;
  padding: 10px;
  resize: vertical;
  line-height: 1.42;
}

.playlist-textarea {
  min-height: 112px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--empty-bg);
  color: var(--muted);
  text-align: center;
}

.run-panel {
  overflow: hidden;
}

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

.run-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.22rem;
}

.run-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.run-meta div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--summary-item-bg);
}

.run-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.run-meta strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.84rem;
}

.run-meta .run-meta-notes {
  grid-column: 1 / -1;
}

.run-sheet {
  display: grid;
  gap: 0;
}

.run-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--section-accent);
}

.run-section h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--section-ink);
}

.run-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 1.3fr) minmax(180px, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.run-row:first-of-type {
  border-top: 0;
}

.run-moment {
  font-family: var(--font-display);
  font-weight: 800;
}

.run-song {
  display: grid;
  gap: 5px;
}

.run-song span {
  color: var(--muted);
  font-size: 0.88rem;
}

.run-notes {
  overflow-wrap: anywhere;
  color: var(--muted);
  white-space: pre-wrap;
}

.run-detail-block {
  display: grid;
  gap: 3px;
}

.run-detail-block span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.run-detail-block strong {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 12, 18, 0.58);
}

.modal {
  width: min(460px, 100%);
  padding: 18px;
}

.modal h2 {
  margin: 0 0 14px;
  font-size: 1.08rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ink), var(--ink-soft));
  color: #fff;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .tabs,
  .top-actions {
    justify-self: stretch;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .admin-hero,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .setup-panel,
  .event-summary,
  .event-details-card {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .event-meta-inline,
  .planner-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .run-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    position: static;
  }

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

  .item-actions {
    justify-content: flex-start;
  }

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

  .song-actions {
    justify-content: flex-start;
  }
}

.song-remove {
  min-height: 36px;
}

@keyframes moveNudge {
  0%,
  100% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(-3px);
  }
  70% {
    transform: translateY(3px);
  }
}

@keyframes movedFlash {
  0% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(15, 191, 166, 0);
  }
  28% {
    border-color: var(--section-accent);
    transform: translateY(-8px);
    box-shadow: 0 0 0 4px rgba(15, 191, 166, 0.16), var(--shadow);
  }
  58% {
    transform: translateY(4px);
  }
  100% {
    transform: translateY(0);
    box-shadow: 0 1px 0 rgba(24, 20, 31, 0.03);
  }
}

@keyframes movedBadge {
  0% {
    opacity: 0;
    transform: translateY(3px);
  }
  20%,
  70% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-3px);
  }
}

@media (max-width: 680px) {
  .layout,
  .admin-shell,
  .topbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .tabs {
    overflow-x: auto;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo-wrap {
    width: 96px;
  }

  .brand-logo {
    width: 82px;
  }

  .setup-shell {
    padding: 22px 12px 32px;
  }

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

  .event-meta-inline,
  .admin-stats,
  .planner-meta,
  .link-strip,
  .index-heading {
    grid-template-columns: 1fr;
  }

  .tab {
    white-space: nowrap;
  }

  .section-header,
  .item-top,
  .compact-card-body,
  .background-card-body,
  .song-row,
  .song-row.single-song,
  .run-row,
  .run-meta,
  .action-stack,
  .metrics {
    grid-template-columns: 1fr;
  }

  .section-title-row,
  .section-actions,
  .item-actions {
    flex-wrap: wrap;
  }

  .drag-handle {
    width: 100%;
  }

  .sync {
    min-width: 0;
    text-align: left;
  }

  .compact-card-body > .text-btn {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }
}

@media print {
  :root,
  body[data-theme="dark"] {
    --bg: #ffffff;
    --panel: #ffffff;
    --panel-soft: #f4f4f4;
    --panel-tint: #ffffff;
    --ink: #111111;
    --ink-soft: #222222;
    --muted: #555555;
    --line: #dddddd;
    --line-strong: #bbbbbb;
    --summary-item-bg: #ffffff;
    --section-header-bg: #ffffff;
    --card-bg: #ffffff;
  }

  body {
    background: #fff;
    color: #111;
  }

  .topbar,
  .sidebar,
  .planner,
  .toast,
  .modal-backdrop {
    display: none !important;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .run-panel {
    border: 0;
    box-shadow: none;
  }

  .run-header {
    background: #fff;
  }

  .run-meta {
    background: #fff;
  }
}
