/*! Backstage Control Room theme */
:root {
	--bg: #0b0f14;
	--bg-elevated: #101720;
	--bg-panel: #151d27;
	--bg-panel-strong: #1b2531;
	--bg-input: #0f151d;
	--border: #283341;
	--border-strong: #374557;
	--text: #eef4fb;
	--text-muted: #9aa8b8;
	--text-soft: #c7d1dc;
	--accent: #3b82f6;
	--accent-strong: #60a5fa;
	--accent-ink: #d9e9ff;
	--cue: #f59e0b;
	--danger: #ef4444;
	--danger-bg: #3b1518;
	--success: #22c55e;
	--paper: #ffffff;
	--paper-ink: #101010;
	--shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
	--radius: 8px;
	--radius-sm: 6px;
	--sidebar-width: 16rem;
}

* {
	box-sizing: border-box;
}

html {
	background: var(--bg);
}

body {
	background:
		linear-gradient(180deg, rgba(59, 130, 246, 0.10), rgba(11, 15, 20, 0) 24rem),
		radial-gradient(circle at top right, rgba(245, 158, 11, 0.08), transparent 26rem),
		var(--bg);
	color: var(--text);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 0.96rem;
	line-height: 1.55;
	margin: 0;
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a {
	color: var(--accent-strong);
	text-decoration-color: rgba(96, 165, 250, 0.42);
	text-underline-offset: 0.16em;
}

a:hover {
	color: #93c5fd;
	text-decoration-color: currentColor;
}

h1,
h2,
h3 {
	color: var(--text);
	line-height: 1.15;
	margin: 0 0 0.75rem;
}

h1 {
	font-size: clamp(2rem, 4vw, 3.25rem);
	font-weight: 760;
	letter-spacing: 0;
}

h2 {
	font-size: 1rem;
	font-weight: 720;
}

h3 {
	color: var(--text-soft);
	font-size: 0.82rem;
	font-weight: 780;
	margin-top: 1.4rem;
	text-transform: uppercase;
}

p {
	margin: 0 0 1rem;
}

code {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text-soft);
	display: inline-block;
	max-width: 100%;
	overflow-wrap: anywhere;
	padding: 0.16rem 0.34rem;
}

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

.content-shell {
	flex: 1 1 auto;
	min-width: 0;
}

.wrap {
	margin: 0 auto;
	max-width: 1220px;
	padding: 2rem;
}

.sidebar {
	background: linear-gradient(180deg, #080b10, #0d1218);
	border-right: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 12px 0 36px rgba(0, 0, 0, 0.25);
	color: var(--text-muted);
	display: flex;
	flex: 0 0 var(--sidebar-width);
	flex-direction: column;
	min-height: 100vh;
	overflow-y: auto;
	padding: 1rem;
	position: sticky;
	top: 0;
}

.sidebar-header {
	align-items: center;
	display: flex;
	justify-content: space-between;
	margin-bottom: 1.65rem;
	min-height: 2.5rem;
}

.brand {
	align-items: center;
	color: var(--text);
	display: inline-flex;
	flex: 0 0 auto;
	line-height: 0;
	max-width: 11rem;
	width: min(11rem, 100%);
}

.brand-logo {
	display: block;
	height: auto;
	max-height: 2.6rem;
	max-width: 100%;
	width: 100%;
}

.sidebar-nav,
.sidebar-footer {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.sidebar a {
	align-items: center;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	color: var(--text-muted);
	display: flex;
	font-size: 0.92rem;
	font-weight: 620;
	gap: 0.65rem;
	min-height: 2.45rem;
	padding: 0.55rem 0.65rem;
	text-decoration: none;
}

.sidebar a:hover,
.sidebar a.active {
	background: rgba(255, 255, 255, 0.06);
	border-color: rgba(255, 255, 255, 0.08);
	color: var(--text);
}

.sidebar a.active {
	box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer {
	background: linear-gradient(180deg, rgba(13, 18, 24, 0), #0d1218 20%);
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	bottom: 0;
	left: 0;
	margin-top: auto;
	padding: 1rem;
	position: fixed;
	width: var(--sidebar-width);
}

.account-link {
	align-items: center;
	display: flex;
	gap: 0.55rem;
}

.nav-avatar {
	border: 1px solid rgba(255, 255, 255, 0.26);
	border-radius: 999px;
	height: 2rem;
	object-fit: cover;
	width: 2rem;
}

.nav-backdrop,
.mobile-header,
.sidebar-close {
	display: none;
}

.nav-toggle-button,
.sidebar-close {
	align-items: center;
	background: transparent;
	border: 0;
	cursor: pointer;
	height: 2.5rem;
	justify-content: center;
	padding: 0;
	width: 2.5rem;
}

.nav-toggle-button {
	display: inline-flex;
	flex-direction: column;
	gap: 0.27rem;
}

.nav-toggle-button span,
.sidebar-close span {
	background: var(--text);
	border-radius: 999px;
	display: block;
	height: 2px;
	width: 1rem;
}

.sidebar-close span {
	background: var(--text-muted);
	position: absolute;
}

.sidebar-close span:first-child {
	transform: rotate(45deg);
}

.sidebar-close span:last-child {
	transform: rotate(-45deg);
}

.page-heading {
	align-items: end;
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	margin: 0.55rem 0 1.1rem;
}

.page-subtitle {
	color: var(--text-muted);
	font-size: 0.98rem;
	margin: -0.25rem 0 0;
}

.flash,
.error {
	border-radius: var(--radius);
	margin: 1rem 0;
	padding: 0.75rem 0.9rem;
}

.flash {
	background: rgba(34, 197, 94, 0.13);
	border: 1px solid rgba(34, 197, 94, 0.34);
	color: #bbf7d0;
}

.flash.error,
.error {
	background: var(--danger-bg);
	border: 1px solid rgba(239, 68, 68, 0.35);
	color: #fecaca;
}

.card,
.panel {
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)), var(--bg-panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow);
	margin-bottom: 1rem;
	padding: 1rem;
}

.card > *:first-child,
.panel > *:first-child {
	margin-top: 0;
}

.card > *:last-child,
.panel > *:last-child {
	margin-bottom: 0;
}

.toolbar-card {
	background: rgba(21, 29, 39, 0.72);
	box-shadow: none;
	padding: 0.65rem;
}

.actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
}

.actions > *:last-child {
	margin-left: auto;
}

.row-actions {
	align-items: center;
	display: flex;
	flex: 0 0 auto;
	gap: 0.45rem;
}

.row-actions form,
.actions form {
	margin: 0;
}

.btn {
	align-items: center;
	background: #1a2430;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	color: var(--text-soft);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-size: 0.88rem;
	font-weight: 700;
	gap: 0.4rem;
	justify-content: center;
	line-height: 1;
	min-height: 2.35rem;
	padding: 0.55rem 0.78rem;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
	white-space: nowrap;
}

.btn:hover {
	background: #223044;
	border-color: #516174;
	color: var(--text);
	transform: translateY(-1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
	background: rgba(26, 36, 48, 0.48);
	border-color: rgba(55, 69, 87, 0.55);
	box-shadow: none;
	color: rgba(199, 209, 220, 0.42);
	cursor: not-allowed;
	transform: none;
}

.btn.primary {
	background: linear-gradient(180deg, var(--accent-strong), var(--accent));
	border-color: #70adff;
	box-shadow: 0 10px 22px rgba(59, 130, 246, 0.24);
	color: #07111f;
}

.btn.danger {
	background: #3b1518;
	border-color: rgba(239, 68, 68, 0.55);
	color: #fecaca;
}

.muted {
	color: var(--text-muted);
	font-size: 0.9rem;
	margin-top: 0.15rem;
}

.error-text {
	color: #fca5a5;
}

.setlist-workbench {
	align-items: start;
	display: block;
}

.setlist-editor-panel {
	min-width: 0;
}

.setlist-songs,
.setlist-index-list,
.song-index-list,
.artist-index-list,
.musician-index-list,
.artist-songs,
.tokens {
	list-style: none;
	padding-left: 0;
}

.setlist-songs,
.setlist-index-list,
.song-index-list,
.artist-index-list,
.musician-index-list {
	display: grid;
	gap: 0.5rem;
	margin: 0.85rem 0;
}

.setlist-songs li,
.setlist-index-row,
.song-index-row,
.artist-index-row,
.musician-index-row {
	align-items: center;
	background: rgba(11, 15, 20, 0.42);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	display: flex;
	gap: 0.8rem;
	justify-content: space-between;
	min-height: 4rem;
	padding: 0.62rem 0.7rem;
}

.setlist-index-row,
.song-index-row,
.artist-index-row,
.musician-index-row {
	min-height: 4.4rem;
}

.setlist-index-row:hover,
.song-index-row:hover,
.artist-index-row:hover,
.musician-index-row:hover {
	background: rgba(59, 130, 246, 0.08);
	border-color: rgba(96, 165, 250, 0.38);
}

.song-key-column,
.song-meta-column {
	border-left: 1px solid var(--border);
	flex: 0 0 4.6rem;
	padding: 0.25rem 1rem;
}

.song-tempo-column {
	flex-basis: 7rem;
	width: 7rem;
}

.musician-index-row .song-meta-column {
	flex-basis: 15rem;
}

.song-key-column strong,
.song-meta-column strong {
	color: var(--text);
	display: block;
	font-size: 1rem;
}

.field-label {
	color: var(--text-muted);
	display: block;
	font-size: 0.72rem;
	font-weight: 780;
	text-transform: uppercase;
}

.setlist-songs .sortable-item {
	transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.setlist-songs .sortable-item:hover,
.setlist-songs .sortable-item.drag-ready {
	background: rgba(59, 130, 246, 0.08);
	border-color: rgba(96, 165, 250, 0.38);
}

.setlist-songs .sortable-item.dragging {
	opacity: 0.65;
	transform: scale(0.995);
}

.drag-handle {
	align-items: center;
	background: transparent;
	border: 0;
	color: #617184;
	cursor: grab;
	display: inline-flex;
	flex: 0 0 auto;
	font-size: 1.2rem;
	height: 2rem;
	justify-content: center;
	line-height: 1;
	padding: 0;
	touch-action: none;
	width: 2rem;
}

.drag-handle:hover {
	color: var(--accent-strong);
}

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

.slot-content {
	flex: 1 1 auto;
	min-width: 0;
}

.slot-content strong {
	color: var(--text);
	display: block;
	font-size: 1rem;
	overflow-wrap: anywhere;
}

.setlist-songs .page-break-slot {
	background: rgba(245, 158, 11, 0.10);
	border: 1px dashed rgba(245, 158, 11, 0.46);
	color: #fde68a;
	margin: 0.35rem 0;
	min-height: 3.2rem;
}

.setlist-songs form {
	margin: 0;
}

.youtube-player {
	aspect-ratio: 16 / 9;
	margin-top: 0.6rem;
	max-width: 640px;
	width: 100%;
}

.youtube-player iframe {
	border: 0;
	border-radius: var(--radius);
	height: 100%;
	width: 100%;
}

.inline-form {
	align-items: end;
	display: grid;
	gap: 0.75rem;
	grid-template-columns: minmax(14rem, 1fr) minmax(7rem, 0.42fr) minmax(12rem, 0.8fr) auto;
}

.inline-form input,
.inline-form select {
	margin-bottom: 0;
	max-width: none;
	width: 100%;
}

.inline-form .btn {
	align-self: end;
	justify-self: start;
	min-height: 2.62rem;
}

.filter-form {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin-top: 1rem;
	width: 100%;
}

.add-song-form {
	grid-template-columns: minmax(0, 1.35fr) minmax(6.5rem, 0.55fr) minmax(0, 1fr) auto;
	margin-bottom: 1.4rem;
	max-width: 100%;
}

.page-break-form {
	grid-template-columns: minmax(14rem, 1fr) auto;
	margin-bottom: 1.4rem;
	max-width: 720px;
}

.form-field {
	min-width: 0;
}

.song-detail-grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	max-width: 640px;
}

.song-detail-grid input,
.song-detail-grid select {
	max-width: none;
	width: 100%;
}

.song-detail-box-grid {
	display: grid;
	gap: 0.75rem;
	margin-top: 0.75rem;
}

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

.song-meta-detail-grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.song-detail-box {
	background: rgba(11, 15, 20, 0.42);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	min-width: 0;
	padding: 0.78rem 0.85rem;
}

.song-detail-label {
	color: var(--text-muted);
	display: block;
	font-size: 0.82rem;
	font-weight: 500;
	margin-bottom: 0.3rem;
}

.song-detail-box strong {
	color: var(--text);
	display: block;
	font-size: 1.45rem;
	font-weight: 800;
	line-height: 1.15;
	overflow-wrap: anywhere;
}

.song-detail-box-grid + .youtube-toggle {
	margin-top: 1rem;
}

label {
	color: var(--text-soft);
	display: block;
	font-size: 0.78rem;
	font-weight: 780;
	margin-bottom: 0.35rem;
	text-transform: uppercase;
}

input,
select,
textarea {
	background: var(--bg-input);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	color: var(--text);
	font: inherit;
	font-size: 0.94rem;
	margin: 0 0 0.9rem;
	max-width: 640px;
	padding: 0.62rem 0.72rem;
	width: 100%;
}

input:focus,
select:focus,
textarea:focus {
	border-color: var(--accent-strong);
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
	outline: 0;
}

select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background: var(--bg-input) url("../img/select-arrows.svg") right 0.55rem center / 16px 32px no-repeat;
	padding-right: 2rem;
	width: auto;
}

textarea {
	min-height: 8rem;
	resize: vertical;
}

textarea#chord_chart,
textarea#lyrics,
.chart, 
.lyrics {
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	line-height: 1.55;
}

.lyrics {
	line-height: 0.75;
}

pre {
	background: #0b1016;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text-soft);
	overflow-x: auto;
	padding: 0.9rem;
}

.chart-card {
	background: linear-gradient(180deg, rgba(59, 130, 246, 0.06), rgba(255, 255, 255, 0.015)), var(--bg-panel);
}

.paper-chart {
	background: var(--paper);
	color: var(--paper-ink);
}

.paper-chart {
	border: 0;
	border-radius: 3px;
	box-shadow: 0 18px 46px rgba(0, 0, 0, 0.36);
	font-size: 1rem;
	padding: 1.4rem;
	white-space: pre-wrap;
}

table {
	border-collapse: separate;
	border-spacing: 0;
	width: 100%;
}

th,
td {
	border-bottom: 1px solid var(--border);
	padding: 0.72rem 0.65rem;
	text-align: left;
}

th {
	color: var(--text-muted);
	font-size: 0.74rem;
	font-weight: 780;
	text-transform: uppercase;
}

td {
	color: var(--text-soft);
}

tr:hover td {
	background: rgba(255, 255, 255, 0.025);
}

tr:last-child td {
	border-bottom: 0;
}

td:last-child {
	text-align: right;
}

.artist-songs li,
.tokens li {
	border-bottom: 1px solid var(--border);
	margin: 0;
	padding: 0.55rem 0;
}

.tokens {
	font-size: 0.84rem;
}

.share-link-row {
	align-items: center;
	display: flex;
	gap: 1rem;
	justify-content: space-between;
}

.share-link-content {
	min-width: 0;
}

.share-link-content strong {
	color: var(--text);
	display: block;
	font-size: 0.96rem;
	margin-bottom: 0.1rem;
}

.share-link-content code {
	margin-top: 0.45rem;
}

.copy-link-button.copied {
	border-color: rgba(34, 197, 94, 0.55);
	color: #bbf7d0;
}

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

.account-summary {
	align-items: center;
	display: flex;
	gap: 1rem;
	grid-column: 1 / -1;
}

.account-summary h2 {
	margin: 0;
}

.account-avatar {
	border: 1px solid var(--border-strong);
	border-radius: 999px;
	flex: 0 0 auto;
	height: 5rem;
	width: 5rem;
}

.avatar-placeholder {
	align-items: center;
	background: var(--bg-panel-strong);
	color: var(--text);
	display: inline-flex;
	font-size: 2rem;
	font-weight: 780;
	justify-content: center;
}

.panel {
	margin: 9vh auto;
	max-width: 420px;
	padding: 1.25rem;
}

.panel h1 {
	font-size: 1.45rem;
}

.panel input {
	max-width: none;
}

.panel button {
	width: 100%;
}

.login-screen {
	align-items: center;
	display: flex;
	justify-content: center;
	padding: 2rem;
}

.login-panel {
	margin: 0;
	padding: 1.5rem;
	width: min(100%, 420px);
}

.login-panel .brand {
	margin-bottom: 1rem;
}

.login-panel h1 {
	font-size: 1.7rem;
	margin-bottom: 1rem;
}

.login-panel .btn {
	margin-top: 0.15rem;
	min-height: 2.75rem;
}

@media (max-width: 980px) {
	.inline-form {
		grid-template-columns: 1fr 1fr;
	}

	.add-song-form {
		grid-template-columns: minmax(0, 1fr) minmax(7rem, 0.45fr);
	}

	.add-song-form .form-field:first-of-type,
	.add-song-form .form-field:nth-of-type(3) {
		grid-column: 1 / -1;
	}

	.filter-form,
	.page-break-form {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}
}

@media (max-width: 720px) {
	body {
		background: var(--bg);
	}

	.app-shell {
		display: block;
	}

	.wrap {
		padding: 1rem;
	}

	.sidebar {
		bottom: 0;
		box-shadow: 8px 0 28px rgba(0, 0, 0, 0.42);
		left: 0;
		max-width: calc(100vw - 4rem);
		min-height: 100vh;
		position: fixed;
		top: 0;
		transform: translateX(-100%);
		transition: transform 0.2s ease;
		width: var(--sidebar-width);
		z-index: 20;
	}

	.sidebar-close {
		display: inline-flex;
		position: relative;
	}

	body.nav-open .sidebar {
		transform: translateX(0);
	}

	body.nav-open .nav-backdrop {
		background: rgba(0, 0, 0, 0.62);
		border: 0;
		bottom: 0;
		display: block;
		left: 0;
		padding: 0;
		position: fixed;
		right: 0;
		top: 0;
		z-index: 10;
	}

	.mobile-header {
		align-items: center;
		background: rgba(11, 15, 20, 0.92);
		backdrop-filter: blur(16px);
		border-bottom: 1px solid var(--border);
		display: flex;
		gap: 0.75rem;
		min-height: 3.75rem;
		padding: 0 1rem;
		position: sticky;
		top: 0;
		z-index: 5;
	}

	.page-heading {
		align-items: start;
		flex-direction: column;
	}

	h1 {
		font-size: 2rem;
	}

	.account-grid {
		display: block;
	}

	.account-summary {
		align-items: flex-start;
	}

	.actions {
		align-items: stretch;
	}

	.actions > *:last-child {
		margin-left: 0;
	}

	.setlist-songs li {
		align-items: flex-start;
		flex-direction: column;
	}

	.setlist-index-row,
	.song-index-row,
	.artist-index-row,
	.musician-index-row {
		align-items: flex-start;
		flex-direction: column;
	}

	.song-key-column,
	.song-meta-column {
		border-left: 0;
		border-right: 0;
		border-top: 1px solid var(--border);
		flex: 0 0 auto;
		padding: 0.7rem 0 0;
		width: 100%;
	}

	.row-actions {
		flex-wrap: wrap;
		width: 100%;
	}

	.share-link-row {
		align-items: flex-start;
		flex-direction: column;
	}

	.inline-form,
	.page-break-form,
	.song-detail-grid,
	.song-detail-box-grid {
		display: block;
	}

	.inline-form input,
	.inline-form select {
		margin-bottom: 0.75rem;
		width: 100%;
	}

	td,
	th {
		padding: 0.65rem 0.35rem;
	}
}
