/* ════════════════════════════════════════════════════════════
   RekordAi — Liquid Glass Design System
   ════════════════════════════════════════════════════════════ */

:root {
	--bg-dark: #0a0a12;
	--bg-grad-top: #0d1117;
	--bg-grad-bot: #16111f;
	--glass-bg: rgba(255, 255, 255, 0.06);
	--glass-bg-hi: rgba(255, 255, 255, 0.1);
	--settings-menu-bg: #171522;
	--glass-border: rgba(255, 255, 255, 0.12);
	--accent: #7c5cff;
	--accent-dim: #5a3fd6;
	--accent-glow: rgba(124, 92, 255, 0.35);
	--text-primary: #e8e8f0;
	--text-dim: rgba(232, 232, 240, 0.55);
	--success: #5cf2a0;
	--error: #ff6b6b;
	--warning: #f0a020;
	--info: #4da6ff;
	--radius: 16px;
	--radius-sm: 12px;
	--blur: 20px;
	--shadow-color: rgba(0, 0, 0, 0.25);
	--shadow-color-strong: rgba(0, 0, 0, 0.32);
	--control-bg: rgba(255, 255, 255, 0.04);
	--control-hover-bg: rgba(255, 255, 255, 0.05);
	--line-subtle: rgba(255, 255, 255, 0.04);
	--surface-subtle: rgba(255, 255, 255, 0.03);
	--surface-muted: rgba(255, 255, 255, 0.08);
	--surface-selected-text: #ffffff;
	--text-on-accent: #ffffff;
	--text-on-success: #07120c;
	--text-on-warning: #160f03;
	--accent-soft: rgba(124, 92, 255, 0.08);
	--accent-soft-hi: rgba(124, 92, 255, 0.16);
	--accent-soft-strong: rgba(124, 92, 255, 0.22);
	--accent-soft-border: rgba(124, 92, 255, 0.22);
	--accent-soft-border-strong: rgba(124, 92, 255, 0.55);
	--success-soft: rgba(92, 242, 160, 0.13);
	--success-soft-hi: rgba(92, 242, 160, 0.18);
	--success-soft-border: rgba(92, 242, 160, 0.32);
	--warning-soft: rgba(240, 160, 32, 0.08);
	--warning-soft-hi: rgba(240, 160, 32, 0.18);
	--warning-soft-strong: rgba(240, 160, 32, 0.2);
	--warning-soft-border: rgba(240, 160, 32, 0.35);
	--error-soft: rgba(255, 107, 107, 0.11);
	--error-soft-hi: rgba(255, 107, 107, 0.14);
	--error-soft-border: rgba(255, 107, 107, 0.34);
	--error-text-soft: #ffc9c9;
	--info-soft: rgba(77, 166, 255, 0.13);
	--info-soft-border: rgba(77, 166, 255, 0.32);
	--code-bg: rgba(0, 0, 0, 0.2);
	--modal-overlay: rgba(10, 10, 18, 0.6);
	--progress-track: rgba(255, 255, 255, 0.12);
	--progress-accent-alt: #8b5cf6;
	--chart-energy: #ff4d4d;
	--chart-bpm: var(--info);
	--chart-grid: rgba(232, 232, 240, 0.16);
	--chart-label: rgba(232, 232, 240, 0.42);
	--chart-point-stroke: var(--bg-grad-bot);
	--analysis-idle-green: rgba(134, 239, 172, 0.08);
	--analysis-idle-blue: rgba(165, 180, 252, 0.16);
	--analysis-idle-text: rgba(226, 232, 240, 0.68);
	--analysis-idle-strong: rgba(245, 247, 251, 0.76);
	--analysis-idle-muted: rgba(199, 210, 254, 0.54);
	--analysis-placeholder: rgba(226, 232, 240, 0.46);
	--option-bg: #111827;
	--option-text: #f8fafc;

	/* Foundation scale shared by the app and dialogs. */
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 20px;
	--space-6: 24px;
	--space-8: 32px;
	--font-size-caption: 0.75rem;
	--font-size-label: 0.8125rem;
	--font-size-body: 0.9375rem;
	--font-size-section: clamp(1.25rem, 2vw, 1.5rem);
	--font-size-page: clamp(1.75rem, 3vw, 2.25rem);
	--control-height-sm: 36px;
	--control-height: 44px;
	--control-height-lg: 52px;
	--icon-size-sm: 16px;
	--icon-size: 20px;
	--motion-fast: 120ms;
	--motion-base: 200ms;
	--motion-slow: 360ms;
	--ease-standard: cubic-bezier(0.2, 0, 0, 1);
	--glass-shadow-1: 0 6px 20px var(--shadow-color);
	--glass-shadow-2: 0 12px 36px var(--shadow-color);
	--glass-shadow-3: 0 20px 60px var(--shadow-color-strong);
}

:root[data-theme="gruvbox-dark"] {
	--bg-dark: #1d2021;
	--bg-grad-top: #282828;
	--bg-grad-bot: #1d2021;
	--glass-bg: rgba(235, 219, 178, 0.07);
	--glass-bg-hi: rgba(235, 219, 178, 0.13);
	--settings-menu-bg: #282828;
	--glass-border: rgba(235, 219, 178, 0.18);
	--accent: #d79921;
	--accent-dim: #b57614;
	--accent-glow: rgba(215, 153, 33, 0.34);
	--text-primary: #ebdbb2;
	--text-dim: rgba(235, 219, 178, 0.62);
	--success: #b8bb26;
	--error: #fb4934;
	--warning: #fabd2f;
	--info: #83a598;
	--shadow-color: rgba(0, 0, 0, 0.34);
	--shadow-color-strong: rgba(0, 0, 0, 0.42);
	--control-bg: rgba(235, 219, 178, 0.055);
	--control-hover-bg: rgba(235, 219, 178, 0.09);
	--line-subtle: rgba(235, 219, 178, 0.07);
	--surface-subtle: rgba(235, 219, 178, 0.045);
	--surface-muted: rgba(235, 219, 178, 0.09);
	--text-on-accent: #1d2021;
	--text-on-success: #1d2021;
	--text-on-warning: #1d2021;
	--accent-soft: rgba(215, 153, 33, 0.11);
	--accent-soft-hi: rgba(215, 153, 33, 0.2);
	--accent-soft-strong: rgba(215, 153, 33, 0.26);
	--accent-soft-border: rgba(215, 153, 33, 0.3);
	--accent-soft-border-strong: rgba(215, 153, 33, 0.58);
	--success-soft: rgba(184, 187, 38, 0.14);
	--success-soft-hi: rgba(184, 187, 38, 0.22);
	--success-soft-border: rgba(184, 187, 38, 0.34);
	--warning-soft: rgba(250, 189, 47, 0.1);
	--warning-soft-hi: rgba(250, 189, 47, 0.2);
	--warning-soft-strong: rgba(250, 189, 47, 0.25);
	--warning-soft-border: rgba(250, 189, 47, 0.42);
	--error-soft: rgba(251, 73, 52, 0.12);
	--error-soft-hi: rgba(251, 73, 52, 0.16);
	--error-soft-border: rgba(251, 73, 52, 0.36);
	--error-text-soft: #ffb0a6;
	--info-soft: rgba(131, 165, 152, 0.14);
	--info-soft-border: rgba(131, 165, 152, 0.34);
	--chart-energy: #fb4934;
	--chart-bpm: #83a598;
	--chart-grid: rgba(235, 219, 178, 0.18);
	--chart-label: rgba(235, 219, 178, 0.48);
	--chart-point-stroke: #1d2021;
	--analysis-idle-green: rgba(184, 187, 38, 0.09);
	--analysis-idle-blue: rgba(131, 165, 152, 0.16);
	--analysis-idle-text: rgba(235, 219, 178, 0.68);
	--analysis-idle-strong: rgba(235, 219, 178, 0.78);
	--analysis-idle-muted: rgba(215, 153, 33, 0.62);
	--analysis-placeholder: rgba(235, 219, 178, 0.48);
	--option-bg: #282828;
	--option-text: #ebdbb2;
}

:root[data-theme="catppuccin-mocha"] {
	--bg-dark: #11111b;
	--bg-grad-top: #181825;
	--bg-grad-bot: #1e1e2e;
	--glass-bg: rgba(205, 214, 244, 0.065);
	--glass-bg-hi: rgba(205, 214, 244, 0.11);
	--settings-menu-bg: #1e1e2e;
	--glass-border: rgba(205, 214, 244, 0.15);
	--accent: #cba6f7;
	--accent-dim: #b4befe;
	--accent-glow: rgba(203, 166, 247, 0.34);
	--text-primary: #cdd6f4;
	--text-dim: rgba(205, 214, 244, 0.62);
	--success: #a6e3a1;
	--error: #f38ba8;
	--warning: #f9e2af;
	--info: #89b4fa;
	--text-on-accent: #11111b;
	--text-on-success: #11111b;
	--text-on-warning: #11111b;
	--accent-soft: rgba(203, 166, 247, 0.1);
	--accent-soft-hi: rgba(203, 166, 247, 0.18);
	--accent-soft-strong: rgba(203, 166, 247, 0.24);
	--accent-soft-border: rgba(203, 166, 247, 0.3);
	--accent-soft-border-strong: rgba(203, 166, 247, 0.58);
	--success-soft: rgba(166, 227, 161, 0.13);
	--success-soft-hi: rgba(166, 227, 161, 0.2);
	--success-soft-border: rgba(166, 227, 161, 0.32);
	--warning-soft: rgba(249, 226, 175, 0.09);
	--warning-soft-hi: rgba(249, 226, 175, 0.18);
	--warning-soft-strong: rgba(249, 226, 175, 0.22);
	--warning-soft-border: rgba(249, 226, 175, 0.38);
	--error-soft: rgba(243, 139, 168, 0.11);
	--error-soft-hi: rgba(243, 139, 168, 0.15);
	--error-soft-border: rgba(243, 139, 168, 0.34);
	--error-text-soft: #f5b9c8;
	--info-soft: rgba(137, 180, 250, 0.13);
	--info-soft-border: rgba(137, 180, 250, 0.32);
	--progress-accent-alt: #b4befe;
	--chart-energy: #f38ba8;
	--chart-bpm: #89b4fa;
	--chart-grid: rgba(205, 214, 244, 0.18);
	--chart-label: rgba(205, 214, 244, 0.48);
	--chart-point-stroke: #1e1e2e;
	--analysis-idle-green: rgba(166, 227, 161, 0.09);
	--analysis-idle-blue: rgba(180, 190, 254, 0.16);
	--analysis-idle-text: rgba(205, 214, 244, 0.68);
	--analysis-idle-strong: rgba(205, 214, 244, 0.78);
	--analysis-idle-muted: rgba(203, 166, 247, 0.62);
	--analysis-placeholder: rgba(205, 214, 244, 0.48);
	--option-bg: #1e1e2e;
	--option-text: #cdd6f4;
}

:root[data-theme="catppuccin-latte"] {
	--bg-dark: #eff1f5;
	--bg-grad-top: #eff1f5;
	--bg-grad-bot: #dce0e8;
	--glass-bg: rgba(255, 255, 255, 0.58);
	--glass-bg-hi: rgba(255, 255, 255, 0.78);
	--settings-menu-bg: #eff1f5;
	--glass-border: rgba(76, 79, 105, 0.18);
	--accent: #8839ef;
	--accent-dim: #7287fd;
	--accent-glow: rgba(136, 57, 239, 0.22);
	--text-primary: #4c4f69;
	--text-dim: rgba(76, 79, 105, 0.68);
	--success: #40a02b;
	--error: #d20f39;
	--warning: #df8e1d;
	--info: #1e66f5;
	--shadow-color: rgba(76, 79, 105, 0.14);
	--shadow-color-strong: rgba(76, 79, 105, 0.22);
	--control-bg: rgba(255, 255, 255, 0.52);
	--control-hover-bg: rgba(255, 255, 255, 0.72);
	--line-subtle: rgba(76, 79, 105, 0.1);
	--surface-subtle: rgba(255, 255, 255, 0.42);
	--surface-muted: rgba(76, 79, 105, 0.08);
	--surface-selected-text: #ffffff;
	--text-on-accent: #ffffff;
	--text-on-success: #ffffff;
	--text-on-warning: #2f1f00;
	--accent-soft: rgba(136, 57, 239, 0.1);
	--accent-soft-hi: rgba(136, 57, 239, 0.16);
	--accent-soft-strong: rgba(136, 57, 239, 0.2);
	--accent-soft-border: rgba(136, 57, 239, 0.25);
	--accent-soft-border-strong: rgba(136, 57, 239, 0.48);
	--success-soft: rgba(64, 160, 43, 0.12);
	--success-soft-hi: rgba(64, 160, 43, 0.18);
	--success-soft-border: rgba(64, 160, 43, 0.28);
	--warning-soft: rgba(223, 142, 29, 0.11);
	--warning-soft-hi: rgba(223, 142, 29, 0.18);
	--warning-soft-strong: rgba(223, 142, 29, 0.22);
	--warning-soft-border: rgba(223, 142, 29, 0.34);
	--error-soft: rgba(210, 15, 57, 0.1);
	--error-soft-hi: rgba(210, 15, 57, 0.14);
	--error-soft-border: rgba(210, 15, 57, 0.28);
	--error-text-soft: #9d1230;
	--info-soft: rgba(30, 102, 245, 0.11);
	--info-soft-border: rgba(30, 102, 245, 0.28);
	--code-bg: rgba(76, 79, 105, 0.1);
	--modal-overlay: rgba(220, 224, 232, 0.72);
	--progress-track: rgba(76, 79, 105, 0.13);
	--progress-accent-alt: #7287fd;
	--chart-energy: #d20f39;
	--chart-bpm: #1e66f5;
	--chart-grid: rgba(76, 79, 105, 0.16);
	--chart-label: rgba(76, 79, 105, 0.54);
	--chart-point-stroke: #eff1f5;
	--analysis-idle-green: rgba(64, 160, 43, 0.08);
	--analysis-idle-blue: rgba(30, 102, 245, 0.12);
	--analysis-idle-text: rgba(76, 79, 105, 0.68);
	--analysis-idle-strong: rgba(76, 79, 105, 0.78);
	--analysis-idle-muted: rgba(136, 57, 239, 0.6);
	--analysis-placeholder: rgba(76, 79, 105, 0.48);
	--option-bg: #eff1f5;
	--option-text: #4c4f69;
}

:root[data-theme="nord"] {
	--bg-dark: #2e3440;
	--bg-grad-top: #3b4252;
	--bg-grad-bot: #242933;
	--glass-bg: rgba(236, 239, 244, 0.065);
	--glass-bg-hi: rgba(236, 239, 244, 0.12);
	--settings-menu-bg: #2e3440;
	--glass-border: rgba(236, 239, 244, 0.16);
	--accent: #88c0d0;
	--accent-dim: #5e81ac;
	--accent-glow: rgba(136, 192, 208, 0.32);
	--text-primary: #eceff4;
	--text-dim: rgba(236, 239, 244, 0.62);
	--success: #a3be8c;
	--error: #bf616a;
	--warning: #ebcb8b;
	--info: #81a1c1;
	--text-on-accent: #2e3440;
	--text-on-success: #2e3440;
	--text-on-warning: #2e3440;
	--accent-soft: rgba(136, 192, 208, 0.1);
	--accent-soft-hi: rgba(136, 192, 208, 0.18);
	--accent-soft-strong: rgba(136, 192, 208, 0.24);
	--accent-soft-border: rgba(136, 192, 208, 0.3);
	--accent-soft-border-strong: rgba(136, 192, 208, 0.55);
	--success-soft: rgba(163, 190, 140, 0.13);
	--success-soft-hi: rgba(163, 190, 140, 0.19);
	--success-soft-border: rgba(163, 190, 140, 0.31);
	--warning-soft: rgba(235, 203, 139, 0.1);
	--warning-soft-hi: rgba(235, 203, 139, 0.18);
	--warning-soft-strong: rgba(235, 203, 139, 0.22);
	--warning-soft-border: rgba(235, 203, 139, 0.38);
	--error-soft: rgba(191, 97, 106, 0.11);
	--error-soft-hi: rgba(191, 97, 106, 0.15);
	--error-soft-border: rgba(191, 97, 106, 0.34);
	--error-text-soft: #e4a2a8;
	--info-soft: rgba(129, 161, 193, 0.13);
	--info-soft-border: rgba(129, 161, 193, 0.32);
	--progress-accent-alt: #5e81ac;
	--chart-energy: #bf616a;
	--chart-bpm: #81a1c1;
	--chart-grid: rgba(236, 239, 244, 0.18);
	--chart-label: rgba(236, 239, 244, 0.48);
	--chart-point-stroke: #242933;
	--analysis-idle-green: rgba(163, 190, 140, 0.09);
	--analysis-idle-blue: rgba(129, 161, 193, 0.16);
	--analysis-idle-text: rgba(236, 239, 244, 0.68);
	--analysis-idle-strong: rgba(236, 239, 244, 0.78);
	--analysis-idle-muted: rgba(136, 192, 208, 0.62);
	--analysis-placeholder: rgba(236, 239, 244, 0.48);
	--option-bg: #2e3440;
	--option-text: #eceff4;
}

:root[data-theme="dracula"] {
	--bg-dark: #282a36;
	--bg-grad-top: #282a36;
	--bg-grad-bot: #191a21;
	--glass-bg: rgba(248, 248, 242, 0.065);
	--glass-bg-hi: rgba(248, 248, 242, 0.12);
	--settings-menu-bg: #282a36;
	--glass-border: rgba(248, 248, 242, 0.16);
	--accent: #bd93f9;
	--accent-dim: #ff79c6;
	--accent-glow: rgba(189, 147, 249, 0.34);
	--text-primary: #f8f8f2;
	--text-dim: rgba(248, 248, 242, 0.62);
	--success: #50fa7b;
	--error: #ff5555;
	--warning: #f1fa8c;
	--info: #8be9fd;
	--text-on-accent: #282a36;
	--text-on-success: #282a36;
	--text-on-warning: #282a36;
	--accent-soft: rgba(189, 147, 249, 0.1);
	--accent-soft-hi: rgba(189, 147, 249, 0.18);
	--accent-soft-strong: rgba(189, 147, 249, 0.24);
	--accent-soft-border: rgba(189, 147, 249, 0.3);
	--accent-soft-border-strong: rgba(189, 147, 249, 0.56);
	--success-soft: rgba(80, 250, 123, 0.13);
	--success-soft-hi: rgba(80, 250, 123, 0.2);
	--success-soft-border: rgba(80, 250, 123, 0.32);
	--warning-soft: rgba(241, 250, 140, 0.1);
	--warning-soft-hi: rgba(241, 250, 140, 0.18);
	--warning-soft-strong: rgba(241, 250, 140, 0.22);
	--warning-soft-border: rgba(241, 250, 140, 0.38);
	--error-soft: rgba(255, 85, 85, 0.11);
	--error-soft-hi: rgba(255, 85, 85, 0.15);
	--error-soft-border: rgba(255, 85, 85, 0.34);
	--error-text-soft: #ffb6b6;
	--info-soft: rgba(139, 233, 253, 0.13);
	--info-soft-border: rgba(139, 233, 253, 0.32);
	--progress-accent-alt: #ff79c6;
	--chart-energy: #ff5555;
	--chart-bpm: #8be9fd;
	--chart-grid: rgba(248, 248, 242, 0.18);
	--chart-label: rgba(248, 248, 242, 0.48);
	--chart-point-stroke: #191a21;
	--analysis-idle-green: rgba(80, 250, 123, 0.09);
	--analysis-idle-blue: rgba(139, 233, 253, 0.16);
	--analysis-idle-text: rgba(248, 248, 242, 0.68);
	--analysis-idle-strong: rgba(248, 248, 242, 0.78);
	--analysis-idle-muted: rgba(189, 147, 249, 0.62);
	--analysis-placeholder: rgba(248, 248, 242, 0.48);
	--option-bg: #282a36;
	--option-text: #f8f8f2;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html,
body {
	height: 100vh;
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
	color: var(--text-primary);
	background: linear-gradient(135deg, var(--bg-grad-top), var(--bg-grad-bot));
	background-attachment: fixed;
	overflow: hidden;
	-webkit-user-select: text;
	-moz-user-select: text;
	user-select: text;
}

/* ── Glass primitives ──────────────────────────────────── */
.glass {
	background: var(--glass-bg);
	backdrop-filter: blur(var(--blur)) saturate(180%);
	-webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius);
	box-shadow: 0 8px 32px var(--shadow-color);
}

.glass-hi {
	background: var(--glass-bg-hi);
	backdrop-filter: blur(var(--blur)) saturate(180%);
	-webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius);
	box-shadow: var(--glass-shadow-3);
}

.glass-subtle {
	background: var(--surface-subtle);
	backdrop-filter: blur(calc(var(--blur) * 0.65)) saturate(140%);
	-webkit-backdrop-filter: blur(calc(var(--blur) * 0.65)) saturate(140%);
	border: 1px solid var(--line-subtle);
	border-radius: var(--radius-sm);
	box-shadow: var(--glass-shadow-1);
}

:is(button, a, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

:is(button, input, select, textarea) {
	accent-color: var(--accent);
}

:is(.btn-primary, .btn-accent, .btn-secondary, .btn-danger) {
	min-height: var(--control-height);
	transition:
		transform var(--motion-fast) var(--ease-standard),
		border-color var(--motion-base) var(--ease-standard),
		background var(--motion-base) var(--ease-standard),
		opacity var(--motion-base) var(--ease-standard);
}

:is(.btn-primary, .btn-accent, .btn-secondary, .btn-danger):not(
	:disabled
):active {
	transform: translateY(1px);
}

:is(button, input, select, textarea):disabled {
	cursor: not-allowed;
	opacity: 0.56;
}

.status-panel {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--info-soft-border);
	border-radius: var(--radius-sm);
	background: var(--info-soft);
	color: var(--text-primary);
	font-size: var(--font-size-label);
	line-height: 1.5;
}

.status-panel[data-tone="success"] {
	background: var(--success-soft);
	border-color: var(--success-soft-border);
}

.status-panel[data-tone="warning"] {
	background: var(--warning-soft);
	border-color: var(--warning-soft-border);
}

.status-panel[data-tone="error"] {
	background: var(--error-soft-hi);
	border-color: var(--error-soft-border);
	color: var(--error-text-soft);
}

.status-panel__content {
	min-width: 0;
	flex: 1;
}

.status-panel__details {
	margin-top: var(--space-2);
	color: var(--text-dim);
}

/* ── Layout ────────────────────────────────────────────── */
#app {
	display: flex;
	flex-direction: column;
	height: 100vh;
}

.appbar {
	position: relative;
	z-index: 10000;
	isolation: isolate;
	padding: 14px 24px;
	background: var(--glass-bg);
	backdrop-filter: blur(var(--blur)) saturate(180%);
	-webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
	border-bottom: 1px solid var(--glass-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.appbar-title {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	min-width: 0;
}

.appbar-brand {
	display: flex;
	align-items: baseline;
	gap: var(--space-3);
	min-width: 0;
}

.appbar-context {
	max-width: 28rem;
	overflow: hidden;
	padding-left: var(--space-4);
	border-left: 1px solid var(--glass-border);
	color: var(--text-dim);
	font-size: var(--font-size-label);
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

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

.appbar h1 {
	font-size: 22px;
	font-weight: 700;
}

.settings-menu {
	position: relative;
	flex: 0 0 auto;
	z-index: 10001;
}

.settings-menu > summary {
	list-style: none;
}

.settings-menu > summary::-webkit-details-marker {
	display: none;
}

.settings-menu-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--control-height);
	gap: var(--space-2);
	padding-inline: var(--space-3);
}

.settings-menu-popover {
	position: absolute;
	top: calc(100% + var(--space-2));
	right: 0;
	z-index: 10002;
	width: min(300px, calc(100vw - 24px));
	max-width: calc(100vw - 24px);
	box-sizing: border-box;
	display: grid;
	gap: var(--space-3);
	padding: var(--space-3);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	box-shadow: var(--glass-shadow-3);
	overflow: hidden;
	/* Keep this control surface opaque: the surrounding app can remain glassy,
	 * but settings must not let content show through in any theme/browser. */
	background: #171522;
	background: var(--settings-menu-bg, #171522);
}

.settings-menu-action {
	width: 100%;
	min-height: var(--control-height);
}

.settings-status-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-width: 0;
	padding: 9px 10px;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	background: var(--control-bg);
}

.settings-status-copy {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	min-width: 0;
	width: 100%;
}

.settings-status-label {
	color: var(--text-dim);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.settings-status-value {
	overflow: hidden;
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 750;
	text-align: right;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.settings-status-dot {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--error);
	box-shadow: 0 0 0 3px var(--error-soft);
}

.settings-status-dot.is-available {
	background: var(--success);
	box-shadow: 0 0 0 3px var(--success-soft);
}

.content-alert {
	margin-bottom: var(--space-5);
}

.appbar .subtitle {
	font-size: 12px;
	color: var(--text-dim);
}

.lang-switch {
	display: flex;
	align-items: center;
	justify-content: stretch;
	gap: 4px;
	width: 100%;
	box-sizing: border-box;
	padding: 4px;
	border-radius: 8px;
	background: var(--control-bg);
	border: 1px solid var(--glass-border);
}

.theme-switch {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, auto);
	grid-template-areas:
		"label current"
		"select select";
	align-items: center;
	gap: 6px 8px;
	padding: 10px;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	background: var(--control-bg);
	min-width: 0;
}

.theme-switch-label {
	grid-area: label;
	color: var(--text-dim);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.theme-switch-current {
	grid-area: current;
	min-width: 0;
	max-width: 150px;
	overflow: hidden;
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 750;
	text-align: right;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.theme-select {
	grid-area: select;
	width: 100%;
	min-width: 0;
	max-width: none;
	appearance: none;
	-webkit-appearance: none;
	padding: 8px 30px 8px 10px;
	background:
		linear-gradient(45deg, transparent 50%, var(--accent) 50%) right 10px top
		50% / 6px 6px no-repeat,
		var(--settings-menu-bg, #171522);
	border: 1px solid var(--glass-border);
	border-radius: 8px;
	color: var(--text-primary);
	font: inherit;
	font-size: 12px;
	font-weight: 650;
	line-height: 1.25;
	cursor: pointer;
	outline: none;
}

.theme-select:focus-visible {
	border-color: var(--accent);
	box-shadow: 0 0 0 2px var(--accent-glow);
}

.theme-select option {
	background: var(--option-bg);
	color: var(--option-text);
}

.btn-lang {
	flex: 1 1 0;
	min-height: 32px;
	background: transparent;
	border: none;
	color: var(--text-dim);
	padding: 4px 8px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition:
		color var(--motion-base) var(--ease-standard),
		background var(--motion-base) var(--ease-standard),
		box-shadow var(--motion-base) var(--ease-standard);
}

.btn-lang:hover {
	color: var(--text-primary);
	background: var(--control-hover-bg);
}

.btn-lang.active {
	color: var(--text-on-accent);
	background: var(--accent);
	box-shadow: 0 0 8px var(--accent-glow);
}

.body {
	display: flex;
	flex: 1;
	overflow: hidden;
}

/* ── Pipeline rail ─────────────────────────────────────── */
.pipeline-rail {
	width: 248px;
	flex: 0 0 248px;
	min-width: 0;
	padding: 12px 10px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 12px;
	border-radius: var(--radius);
	position: relative;
	overflow: hidden;
}

.pipeline-rail::before {
	content: "";
	position: absolute;
	inset: -30% -60% auto auto;
	width: 220px;
	height: 220px;
	background: radial-gradient(
		circle,
		var(--accent-soft-strong),
		transparent 65%
	);
	pointer-events: none;
}

.preload-rail-tab {
	appearance: none;
	border: 1px solid var(--accent-soft-border-strong);
	background: linear-gradient(
		135deg,
		var(--accent-soft-strong),
		var(--success-soft)
	);
	color: var(--text-primary);
	width: 100%;
	min-height: 72px;
	display: grid;
	grid-template-columns: 36px 1fr auto;
	gap: 8px;
	align-items: center;
	padding: 10px;
	border-radius: var(--radius-sm);
	position: relative;
	z-index: 1;
	text-align: left;
	font: inherit;
	cursor: pointer;
	transition:
		transform 0.2s ease,
		border-color 0.2s ease,
		box-shadow 0.2s ease;
}

.preload-rail-tab:hover {
	transform: translateX(2px);
	border-color: var(--accent);
}

.preload-rail-tab:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

.preload-rail-tab.is-current {
	box-shadow:
		inset 0 0 0 1px var(--accent),
		0 10px 28px var(--accent-glow);
}

.preload-rail-tab__mark {
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border-radius: 13px;
	background: var(--accent);
	color: var(--accent-contrast);
	font-weight: 900;
	box-shadow: 0 8px 20px var(--accent-glow);
}

.preload-rail-tab__copy {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.preload-rail-tab__copy strong {
	font-size: 14px;
}
.preload-rail-tab__copy small {
	color: var(--text-dim);
	font-size: 11px;
}
.preload-rail-tab__status {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 4px;
	color: var(--text-secondary);
	font-size: 11px;
	font-weight: 700;
}
.preload-rail-tab__status i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 8px var(--accent-glow);
}
.preload-rail-tab.is-done .preload-rail-tab__status i {
	background: var(--success);
}
.preload-rail-tab.is-skipped .preload-rail-tab__status i {
	background: var(--text-dim);
	box-shadow: none;
}
.preload-rail-tab.is-unavailable .preload-rail-tab__status i,
.preload-rail-tab.is-error .preload-rail-tab__status i {
	background: var(--warning);
	box-shadow: none;
}
.preload-rail-tab__arrow {
	color: var(--accent);
	font-size: 18px;
}

.pipeline-heading {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 2px 3px 5px;
	position: relative;
	z-index: 1;
}

.pipeline-heading strong {
	font-size: 14px;
	letter-spacing: 0.01em;
}

.pipeline-eyebrow {
	color: var(--accent);
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.pipeline-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 4px;
	position: relative;
	z-index: 1;
}

.pipeline-reset-actions {
	margin-top: auto;
	padding: 6px 3px 1px;
	position: relative;
	z-index: 1;
}

.pipeline-reset-button {
	width: 100%;
	min-height: 38px;
}

.pipeline-reset-button:focus-visible {
	outline: 2px solid var(--error);
	outline-offset: 3px;
}

.pipeline-item {
	min-height: 58px;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	color: var(--text-dim);
	position: relative;
	transition:
		border-color 0.2s ease,
		background 0.2s ease,
		color 0.2s ease,
		transform 0.2s ease;
}

.pipeline-button {
	appearance: none;
	border: 0;
	background: transparent;
	color: inherit;
	width: 100%;
	min-height: inherit;
	display: grid;
	grid-template-columns: 34px 1fr;
	gap: 9px;
	align-items: start;
	padding: 8px 8px 8px 5px;
	text-align: left;
	font: inherit;
	border-radius: inherit;
	cursor: pointer;
}

.pipeline-item.clickable:hover {
	transform: translateX(2px);
	border-color: var(--glass-border);
}

.pipeline-item.current {
	box-shadow: inset 0 0 0 1px var(--surface-muted);
}

.pipeline-button:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

.pipeline-button:disabled {
	cursor: not-allowed;
}

.pipeline-item.disabled {
	opacity: 0.68;
}

.pipeline-item:not(:last-child)::after {
	content: "";
	position: absolute;
	left: 22px;
	top: 42px;
	bottom: -10px;
	width: 2px;
	background: linear-gradient(180deg, var(--glass-border), var(--accent-soft));
}

.pipeline-item.done:not(:last-child)::after,
.pipeline-item.active:not(:last-child)::after {
	background: linear-gradient(180deg, var(--accent), var(--success-soft-hi));
	box-shadow: 0 0 12px var(--accent-glow);
}

.pipeline-item.active {
	background: linear-gradient(
		135deg,
		var(--accent-soft-strong),
		var(--success-soft)
	);
	border-color: var(--accent-soft-border-strong);
	color: var(--text-primary);
}

.pipeline-item.ready {
	background: var(--accent-soft);
	border-color: var(--accent-soft-border);
	color: var(--text-primary);
}

.pipeline-item.done {
	color: var(--text-primary);
}

.pipeline-item.error {
	background: var(--warning-soft);
	border-color: var(--warning-soft-border);
	color: var(--text-primary);
}

.pipeline-node {
	width: 32px;
	height: 32px;
	border-radius: 999px;
	display: grid;
	place-items: center;
	position: relative;
	background: var(--surface-muted);
	border: 1px solid var(--glass-border);
	box-shadow: inset 0 0 0 1px var(--line-subtle);
	z-index: 1;
}

.pipeline-number {
	font-size: 12px;
	font-weight: 800;
	color: var(--text-primary);
	z-index: 2;
}

.pipeline-wave {
	position: absolute;
	inset: 7px;
	border-radius: inherit;
	background: linear-gradient(135deg, var(--accent), var(--success-soft-hi));
	opacity: 0;
	transform: scale(0.75);
	transition:
		opacity 0.2s ease,
		transform 0.2s ease;
}

.pipeline-item.active .pipeline-wave {
	opacity: 1;
	transform: scale(1);
	animation: pipelinePulse 1.8s ease-in-out infinite;
}

.pipeline-item.done .pipeline-node {
	background: var(--success);
	border-color: var(--success);
	box-shadow: 0 0 18px var(--success-soft-border);
}

.pipeline-item.done .pipeline-number {
	color: var(--text-on-success);
}

.pipeline-item.error .pipeline-node {
	background: var(--warning);
	border-color: var(--warning);
}

.pipeline-item.error .pipeline-number {
	color: var(--text-on-warning);
}

.pipeline-copy,
.pipeline-title,
.pipeline-caption,
.pipeline-meta {
	display: block;
}

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

.pipeline-title {
	font-size: 13px;
	font-weight: 800;
}

.pipeline-caption {
	margin-top: 2px;
	font-size: 11px;
	color: var(--text-dim);
}

.pipeline-meta {
	margin-top: 4px;
	color: var(--text-dim);
	font-size: 10px;
	line-height: 1.35;
}

@keyframes pipelinePulse {
	0%,
	100% {
		box-shadow: 0 0 0 0 var(--accent-glow);
	}
	50% {
		box-shadow: 0 0 0 8px transparent;
	}
}

/* ── Content area ──────────────────────────────────────── */
.content {
	flex: 1;
	min-width: 0;
	padding: 12px 12px 12px 0;
	overflow-y: auto;
	overflow-x: hidden;
}

.content-inner {
	min-width: 0;
	padding: 12px;
	min-height: 100%;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* ── Accent button ─────────────────────────────────────── */
.btn-accent {
	background: linear-gradient(135deg, var(--accent), var(--accent-dim));
	color: var(--text-on-accent);
	border: none;
	padding: 12px 24px;
	border-radius: var(--radius-sm);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-accent:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 24px var(--accent-glow);
}
.btn-accent:active {
	transform: translateY(0);
}
.btn-accent:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Secondary button ──────────────────────────────────── */
.btn-secondary {
	background: var(--glass-bg-hi);
	color: var(--text-primary);
	border: 1px solid var(--glass-border);
	padding: 12px 18px;
	border-radius: var(--radius-sm);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-secondary:hover {
	border-color: var(--accent);
	transform: translateY(-1px);
}
.btn-secondary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.btn-danger {
	background: var(--error-soft-hi);
	color: var(--error);
	border: 1px solid var(--error-soft-border);
	padding: 12px 18px;
	border-radius: var(--radius-sm);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-danger:hover {
	border-color: var(--error);
	transform: translateY(-1px);
}
.btn-danger:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

/* ── Workflow panels ───────────────────────────────────── */
.onboarding-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-6);
	margin-bottom: var(--space-5);
	padding: var(--space-5) var(--space-6);
}

.onboarding-card h2 {
	margin: var(--space-1) 0 var(--space-2);
	font-size: var(--font-size-section);
}

.onboarding-card p {
	max-width: 68ch;
	color: var(--text-dim);
	line-height: 1.6;
}

.onboarding-action {
	min-width: 132px;
	min-height: var(--control-height-lg);
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	padding: 0 var(--space-5);
	border: 1px solid color-mix(in srgb, var(--accent) 72%, white);
	border-radius: 999px;
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--accent) 88%, white),
		var(--accent-dim)
	);
	box-shadow:
		0 8px 24px var(--accent-glow),
		inset 0 1px 0 rgb(255 255 255 / 28%);
	font-family: inherit;
	font-size: var(--font-size-body);
	font-weight: 750;
	letter-spacing: 0.01em;
	-webkit-font-smoothing: antialiased;
}

.onboarding-action:hover {
	box-shadow:
		0 10px 28px var(--accent-glow),
		inset 0 1px 0 rgb(255 255 255 / 34%);
}

.onboarding-action-arrow {
	font-size: 18px;
	font-weight: 500;
	line-height: 1;
	transition: transform var(--motion-fast) var(--ease-standard);
}

.onboarding-action:hover .onboarding-action-arrow {
	transform: translateX(3px);
}

.onboarding-action:active .onboarding-action-arrow {
	transform: translateX(1px);
}

.workflow-layout {
	display: grid;
	gap: var(--space-5);
}

.load-more-actions {
	display: flex;
	justify-content: center;
	padding: var(--space-3);
}

.advanced-disclosure {
	overflow: hidden;
}

.advanced-disclosure > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--control-height);
	padding: var(--space-3) var(--space-4);
	font-size: var(--font-size-label);
	font-weight: 750;
	cursor: pointer;
}

.disclosure-meta {
	min-width: 28px;
	padding: 2px var(--space-2);
	border-radius: 999px;
	background: var(--surface-muted);
	text-align: center;
}

.operation-notice {
	position: relative;
	margin-bottom: var(--space-5);
}

.notice-dismiss {
	width: var(--control-height);
	height: var(--control-height);
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 1.25rem;
}

.operation-progress {
	height: 6px;
	overflow: hidden;
	margin-top: var(--space-3);
	border-radius: 999px;
	background: var(--progress-track);
}

.operation-progress span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: var(--accent);
	transition: width var(--motion-slow) var(--ease-standard);
}

.status-panel__details code,
.status-panel__details small {
	display: block;
	margin-top: var(--space-2);
	overflow-wrap: anywhere;
}

.workflow-panel {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-height: calc(100vh - 118px);
}

.yaya-launch-hint {
	max-width: 68ch;
	color: var(--text-dim);
	font-size: var(--font-size-label);
}

.yaya-choice-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-2) 4px 0;
}

.yaya-choice-actions > button {
	min-width: 190px;
}

@media (max-width: 640px) {
	.yaya-choice-actions > button {
		width: 100%;
	}
}

.calibration-entry { align-self: flex-start; }
.calibration-panel { display: flex; flex-direction: column; gap: 14px; padding: 22px; margin-bottom: 18px; }
.calibration-privacy, .calibration-hint { color: var(--text-dim); line-height: 1.5; }
.calibration-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.calibration-upload { cursor: pointer; }
.calibration-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.calibration-table-wrap { overflow-x: auto; border: 1px solid var(--glass-border); border-radius: 12px; }
.calibration-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.calibration-table th, .calibration-table td { padding: 11px 12px; border-bottom: 1px solid var(--line-subtle); text-align: left; white-space: nowrap; }
.calibration-table th { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.calibration-empty { padding: 28px; border: 1px dashed var(--glass-border); border-radius: 12px; color: var(--text-dim); text-align: center; }

.panel-heading {
	padding: 8px 4px 0;
}

.panel-heading h2 {
	margin: 4px 0 6px;
	font-size: 28px;
	letter-spacing: -0.03em;
}

.panel-heading p {
	color: var(--text-dim);
	line-height: 1.5;
}

.eyebrow {
	color: var(--accent) !important;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

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

.source-card {
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	border-radius: var(--radius);
}

.source-card.selected {
	border-color: var(--accent);
	box-shadow: 0 8px 32px var(--accent-glow);
}

.source-card h3,
.generated-card h3 {
	margin-bottom: 6px;
	font-size: 18px;
}

.source-card p {
	color: var(--text-dim);
	line-height: 1.5;
}

.source-library-controls {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	margin-top: 16px;
	padding: 12px;
	background: var(--surface-subtle);
	border: 1px solid var(--line-subtle);
	border-radius: var(--radius-sm);
}

.source-library-field {
	display: flex;
	flex-direction: column;
	gap: 7px;
	min-width: 0;
}

.source-library-field > span:first-child {
	color: var(--text-dim);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.source-select-shell {
	position: relative;
	display: block;
}

.source-select-shell::after {
	content: "⌄";
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-56%);
	color: var(--accent);
	font-size: 18px;
	font-weight: 900;
	line-height: 1;
	pointer-events: none;
}

.source-library-select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 44px;
	background:
		linear-gradient(135deg, var(--accent-soft-hi), var(--info-soft)),
		var(--glass-bg);
	border-color: var(--accent-soft-border-strong);
	font-weight: 800;
	cursor: pointer;
}

.source-library-select:hover,
.source-library-path:hover {
	border-color: var(--glass-border);
}

.source-library-select:focus,
.source-library-path:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
}

.source-library-select option {
	background: var(--option-bg);
	color: var(--option-text);
}

.source-actions {
	display: flex;
	gap: 10px;
	align-items: stretch;
	flex-wrap: wrap;
}

.source-actions .btn-accent,
.source-actions .btn-secondary {
	flex: 1 1 180px;
}

.playlist-picker {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: stretch;
}

.playlist-search-field {
	display: block;
}

.playlist-search-shell {
	position: relative;
	display: block;
}

.playlist-search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	width: 12px;
	height: 12px;
	transform: translateY(-60%);
	border: 2px solid var(--text-dim);
	border-radius: 50%;
	pointer-events: none;
}

.playlist-search-icon::after {
	content: "";
	position: absolute;
	right: -5px;
	bottom: -3px;
	width: 6px;
	height: 2px;
	transform: rotate(45deg);
	border-radius: 999px;
	background: var(--text-dim);
}

.playlist-search-input {
	width: 100%;
	min-height: var(--control-height);
	padding: 10px 44px 10px 40px;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	background: var(--surface-subtle);
	color: var(--text-primary);
	font: inherit;
	font-size: 13px;
	transition:
		border-color var(--motion-base) var(--ease-standard),
		box-shadow var(--motion-base) var(--ease-standard),
		background var(--motion-base) var(--ease-standard);
}

.playlist-search-input::placeholder {
	color: var(--text-dim);
}

.playlist-search-input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.playlist-search-input:hover {
	background: var(--glass-bg-hi);
}

.playlist-search-input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
	outline: none;
}

.playlist-search-clear {
	position: absolute;
	right: 7px;
	top: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	transform: translateY(-50%);
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--text-dim);
	font-size: 21px;
	line-height: 1;
	cursor: pointer;
}

.playlist-search-clear:hover {
	background: var(--accent-glow);
	color: var(--accent);
}

/* ── Playlist folder tree ──────────────────────────────── */
.playlist-tree {
	max-height: 320px;
	overflow-y: auto;
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	padding: 6px;
}

.tree-row {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	border-radius: 8px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--text-primary);
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	transition: background 0.12s ease;
}

.tree-row:hover {
	background: var(--glass-bg-hi);
}

.tree-row-folder {
	font-weight: 600;
	color: var(--text-primary);
}

.tree-row-selected {
	background: var(--accent-glow);
	color: var(--surface-selected-text);
}

.tree-row-selected:hover {
	background: var(--accent-glow);
	filter: brightness(1.08);
}

.tree-toggle {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: transparent;
	border: none;
	color: var(--text-dim);
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
}

.tree-toggle:hover {
	color: var(--accent);
}

.tree-toggle-spacer {
	flex: 0 0 auto;
	width: 18px;
}

.tree-icon {
	flex: 0 0 auto;
	font-size: 14px;
}

.tree-icon-smart {
	color: var(--accent);
}

.tree-name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tree-count {
	flex: 0 0 auto;
	font-size: 11px;
	color: var(--text-dim);
}

.tree-empty-hint {
	padding: 10px 12px;
	font-size: 13px;
	color: var(--text-dim);
	background: var(--glass-bg);
	border: 1px dashed var(--glass-border);
	border-radius: var(--radius-sm);
}

.select-input {
	min-width: 0;
	padding: 12px 14px;
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	color: var(--text-primary);
	font-size: 14px;
	outline: none;
}

.select-input:focus {
	border-color: var(--accent);
}
.select-input option {
	color: #111;
}

.inline-error {
	color: var(--error) !important;
	font-size: 13px;
}

.summary-card {
	padding: 16px;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
	gap: 14px;
	align-items: center;
}
.analysis-summary-card {
	grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(280px, 1fr);
}

.analysis-summary-card .summary-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 12px;
	min-width: 0;
}

.summary-actions button {
	min-width: 0;
}

.summary-actions .btn-accent,
.summary-actions .btn-secondary {
	flex: 1 1 220px;
}

.summary-actions .btn-danger {
	flex: 0 0 auto;
}


.summary-card strong {
	display: block;
	margin-top: 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.summary-label {
	display: block;
	color: var(--text-dim);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.table-shell,
.log-shell {
	flex: 1;
	min-height: 260px;
	overflow: auto;
	padding: 4px;
}

.empty-cell,
.empty-state {
	padding: 24px !important;
	color: var(--text-dim);
	text-align: center;
}

.progress-card {
	padding: 16px;
}

.progress-card.analysis-progress-idle {
	border-color: var(--glass-border);
	background:
		radial-gradient(
			circle at 18% 0%,
			var(--analysis-idle-green),
			transparent 30%
		),
		linear-gradient(135deg, var(--glass-bg-hi), var(--surface-subtle));
	box-shadow:
		0 16px 42px rgba(0, 0, 0, 0.22),
		inset 0 1px 0 var(--progress-track);
}

.analysis-progress-details.analysis-progress-details-idle {
	border-color: var(--glass-border);
	background:
		radial-gradient(
			circle at 14% 0%,
			var(--analysis-idle-blue),
			transparent 34%
		),
		radial-gradient(
			circle at 88% 12%,
			var(--analysis-idle-green),
			transparent 28%
		),
		linear-gradient(135deg, var(--glass-bg-hi), var(--line-subtle));
	box-shadow:
		0 18px 44px rgba(0, 0, 0, 0.22),
		inset 0 1px 0 var(--glass-border);
}

.analysis-progress-details.analysis-progress-details-idle::before {
	background: linear-gradient(180deg, var(--progress-track), transparent);
}

.analysis-progress-status.analysis-progress-status-idle {
	border-color: var(--progress-track);
	background:
		linear-gradient(135deg, var(--glass-bg-hi), var(--surface-subtle)),
		var(--surface-subtle);
	box-shadow:
		inset 0 1px 0 var(--progress-track),
		0 10px 26px rgba(0, 0, 0, 0.14);
}

.analysis-progress-status-idle .analysis-progress-status-text {
	color: var(--analysis-idle-text);
}

.analysis-progress-status-idle .analysis-progress-percent {
	color: var(--analysis-idle-strong);
	text-shadow: 0 0 18px var(--analysis-idle-blue);
}

.analysis-progress-details-idle .analysis-kicker,
.analysis-progress-details-idle .analysis-metric-chip > span {
	color: var(--analysis-idle-muted);
}

.analysis-current-track strong.analysis-track-placeholder {
	color: var(--analysis-placeholder);
	font-weight: 650;
	letter-spacing: -0.01em;
	text-shadow: none;
}

.analysis-progress-details-idle
	.analysis-metric-chip:not(.analysis-metric-error) {
	border-color: var(--glass-bg-hi);
	background:
		linear-gradient(135deg, var(--surface-muted), var(--surface-subtle)),
		var(--surface-subtle);
	box-shadow: inset 0 1px 0 var(--surface-muted);
}

.analysis-progress-details-idle
	.analysis-metric-chip:not(.analysis-metric-error)
	strong {
	color: var(--analysis-idle-strong);
}

.analysis-progress-status {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 14px;
	padding: 12px 14px;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	background:
		linear-gradient(135deg, var(--glass-border), var(--surface-subtle)),
		var(--glass-bg);
	box-shadow:
		inset 0 1px 0 var(--glass-border),
		0 12px 30px rgba(0, 0, 0, 0.18);
}

.analysis-progress-status-text {
	min-width: 0;
	overflow: hidden;
	color: var(--text-primary);
	font-size: 13px;
	font-weight: 650;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.analysis-progress-percent {
	color: var(--text-primary);
	font-size: clamp(24px, 4vw, 42px);
	font-weight: 800;
	letter-spacing: -0.06em;
	line-height: 0.9;
	text-shadow: 0 0 24px var(--accent-glow);
}

.analysis-progress-details {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: 14px;
	padding: 16px;
	overflow: hidden;
	border: 1px solid var(--glass-border);
	border-radius: calc(var(--radius) + 2px);
	background:
		radial-gradient(
			circle at 12% 0%,
			var(--accent-soft-strong),
			transparent 34%
		),
		linear-gradient(135deg, var(--glass-border), var(--surface-subtle));
	box-shadow:
		0 18px 48px rgba(0, 0, 0, 0.28),
		inset 0 1px 0 var(--progress-track);
	backdrop-filter: blur(calc(var(--blur) * 1.25)) saturate(190%);
	-webkit-backdrop-filter: blur(calc(var(--blur) * 1.25)) saturate(190%);
}

.analysis-progress-details::before {
	content: "";
	position: absolute;
	inset: 1px 1px auto 1px;
	height: 42%;
	pointer-events: none;
	border-radius: calc(var(--radius) + 1px) calc(var(--radius) + 1px) 42px 42px;
	background: linear-gradient(180deg, var(--glass-border), transparent);
}

.analysis-progress-status,
.analysis-progress-head,
.analysis-metric-row,
.analysis-error-hint {
	position: relative;
	z-index: 1;
}

.analysis-current-track {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.analysis-kicker,
.analysis-metric-chip > span {
	color: var(--text-dim);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.12em;
	line-height: 1;
	text-transform: uppercase;
}

.analysis-current-track strong {
	display: block;
	max-width: 100%;
	overflow: hidden;
	color: var(--text-primary);
	font-size: clamp(18px, 2.1vw, 26px);
	font-weight: 750;
	letter-spacing: -0.03em;
	line-height: 1.15;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-shadow: 0 0 22px var(--accent-soft-strong);
}

.analysis-metric-row {
	display: grid;
	grid-template-columns: repeat(5, minmax(92px, 1fr));
	gap: 8px;
}

.analysis-metric-chip {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	background: var(--glass-bg);
	box-shadow: inset 0 1px 0 var(--surface-muted);
}

.analysis-metric-chip strong {
	display: flex;
	gap: 2px;
	align-items: baseline;
	overflow: hidden;
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.1;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.analysis-metric-error {
	border-color: var(--error-soft-border);
	background: var(--error-soft);
}

.analysis-error-hint {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border: 1px solid var(--error-soft-border);
	border-radius: var(--radius-sm);
	background: var(--error-soft);
	color: var(--error-text-soft);
	font-size: 12px;
	font-weight: 650;
}

.analysis-error-dot {
	width: 8px;
	height: 8px;
	flex: 0 0 auto;
	border-radius: 999px;
	background: var(--error);
	box-shadow: 0 0 14px var(--error-soft-border);
}

.step-actions {
	display: flex;
	justify-content: flex-end;
}

.generated-card {
	flex: 1;
	min-width: 0;
	min-height: 320px;
	padding: 18px;
	overflow: auto;
}

.generated-card pre {
	white-space: pre-wrap;
	color: var(--text-primary);
	font:
		14px / 1.55 "SF Mono",
		"Fira Code",
		monospace;
}

.generated-card.compact {
	min-height: 0;
}

.correction-playlist-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	margin-bottom: 6px;
}
.correction-playlist-controls {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	flex-wrap: wrap;
}

.serato-gain-description {
	margin: 4px 0 0;
	color: var(--text-dim);
	font-size: 12px;
}

.correction-playlist-heading h3 {
	margin-bottom: 0;
}

/* The correction table is the primary working surface on step 5. Keep its
 * controls visually anchored while letting the track metadata breathe. */
.generated-card.compact {
	background: linear-gradient(145deg, var(--accent-soft), transparent 34%), var(--glass-bg);
}

.generated-card.compact .correction-playlist-heading {
	padding: 2px 2px 10px;
	border-bottom: 1px solid var(--line-subtle);
}

.generated-card.compact .correction-playlist-table-scroll {
		margin-inline: -4px;
		padding-inline: 4px;
		border: 1px solid var(--glass-border);
		border-radius: var(--radius);
		background: var(--control-bg);
}

.generated-card.compact .correction-playlist-table thead th {
		position: sticky;
		top: 0;
		z-index: 1;
		background: var(--glass-bg-hi);
		box-shadow: 0 1px 0 var(--glass-border);
	}

.generated-card.compact .correction-playlist-table tbody tr {
		transition: background-color var(--motion-fast) var(--ease-standard);
}

.generated-card.compact .correction-playlist-table tbody tr:hover {
		background: var(--accent-soft);
}

.generated-card.compact .correction-playlist-table td:nth-child(8) {
		padding-inline: 12px;
}

.generated-card.compact .correction-playlist-table td:nth-child(8) .track-playback {
		display: grid;
		width: 100%;
		max-width: none;
		margin-inline: auto;
}

.correction-history-nav {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	flex: 0 0 auto;
}

.correction-history-button.btn-secondary {
	display: inline-grid;
	place-items: center;
	width: 34px;
	min-width: 34px;
	height: 34px;
	min-height: 34px;
	padding: 0;
	border-radius: var(--radius-sm);
}

.correction-history-button svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.correction-history-position {
	min-width: 44px;
	color: var(--text-muted);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	text-align: center;
}

.markdown-content {
	font-size: 14px;
	line-height: 1.6;
	color: var(--text-primary);
}

.markdown-content p {
	margin-top: 0;
	margin-bottom: 12px;
}
.markdown-content p:last-child {
	margin-bottom: 0;
}

.markdown-content ul,
.markdown-content ol {
	margin-top: 0;
	margin-bottom: 12px;
	padding-left: 20px;
}
.markdown-content ul:last-child,
.markdown-content ol:last-child {
	margin-bottom: 0;
}

.markdown-content li {
	margin-bottom: 6px;
}
.markdown-content li:last-child {
	margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
	margin-top: 16px;
	margin-bottom: 8px;
	font-size: 1.15em;
	font-weight: 600;
}
.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child,
.markdown-content h4:first-child,
.markdown-content h5:first-child,
.markdown-content h6:first-child {
	margin-top: 0;
}

.correction-grid {
	display: grid;
	grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
	gap: 16px;
	flex: 1;
	min-height: 0;
}

.playlist-history-card {
	margin-top: 16px;
	padding: 18px;
}

.history-card-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}

.history-card-header h3 {
	margin: 0 0 6px;
	font-size: 18px;
}

.history-card-header p {
	margin: 0;
	color: var(--text-dim);
	font-size: 13px;
	line-height: 1.4;
}

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

.history-section {
	min-width: 0;
	padding: 14px;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	background: var(--surface-subtle);
}

.history-section h4 {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--text-primary);
}

.history-empty {
	margin: 0;
	color: var(--text-dim);
	font-size: 13px;
}

.history-entry-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 280px;
	overflow-y: auto;
}

.history-entry {
	padding: 10px 12px;
	border-radius: var(--radius-sm);
	font-size: 13px;
	line-height: 1.45;
}

.history-entry.user {
	background: var(--glass-bg-hi);
}

.history-entry.ai {
	background: var(--accent-soft);
	border: 1px solid var(--accent-soft-border);
}

.history-entry-role {
	display: block;
	margin-bottom: 6px;
	color: var(--text-dim);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.history-entry-text p {
	margin-top: 0;
	margin-bottom: 8px;
}

.history-entry-text p:last-child {
	margin-bottom: 0;
}

.correction-chat {
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.correction-diff-card {
	padding: 16px;
}

.correction-diff-card h3 {
	margin: 0 0 10px;
}

.correction-diff-summary,
.correction-diff-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.correction-diff-summary span {
	padding: 4px 8px;
	border-radius: 999px;
	background: var(--accent-soft);
}

.correction-diff-actions {
	justify-content: flex-end;
	margin-top: 12px;
}

.correction-recommendations-card {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.correction-recommendations-card h3 {
	margin: 0 0 6px;
	font-size: 16px;
}

.correction-recommendations-card p {
	margin: 0;
	color: var(--text-dim);
	font-size: 13px;
	line-height: 1.45;
}

.correction-recommendations-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
	padding-left: 18px;
	color: var(--text-primary);
	font-size: 13px;
	line-height: 1.45;
}

.correction-recommendations-list li::marker {
	color: var(--accent);
}

.correction-playlist-table-scroll {
	width: 100%;
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
}

.correction-playlist-table {
	/* Give the primary track columns room to breathe; narrow viewports can
	 * scroll the table instead of compressing names into ellipses. */
	min-width: 1456px;
	table-layout: fixed;
}

.correction-playlist-table th:nth-child(1),
.correction-playlist-table td:nth-child(1) {
	width: 58px;
}

.correction-playlist-table th:nth-child(2) {
	width: 34%;
}

.correction-playlist-table th:nth-child(3) {
	width: 28%;
}

.correction-playlist-table th:nth-child(4) {
	width: 64px;
}

.correction-playlist-table th:nth-child(5) {
	width: 82px;
}

.correction-playlist-table th:nth-child(6) {
	width: 76px;
}

.correction-playlist-table th:nth-child(7),
.correction-playlist-table td:nth-child(7) {
	width: 176px;
	min-width: 176px;
}

.correction-playlist-table th:nth-child(8),
.correction-playlist-table td:nth-child(8) {
	width: 300px;
	min-width: 300px;
	text-align: center;
}

.correction-playlist-table td:nth-child(8) {
	overflow: visible;
}

.correction-playlist-table th:nth-child(9),
.correction-playlist-table td:nth-child(9) {
	width: 92px;
	text-align: center;
}

.correction-playlist-table td.pl-title,
.correction-playlist-table td.pl-artist {
	max-width: none;
	white-space: normal;
	overflow: visible;
	overflow-wrap: anywhere;
	vertical-align: top;
}

.correction-row-actions {
	box-sizing: border-box;
	width: 92px;
	padding: 6px 8px !important;
	overflow: visible !important;
}

.correction-sortable-row {
	transition:
		background 160ms ease,
		box-shadow 160ms ease,
		opacity 160ms ease;
}

.correction-sortable-row.is-dragging {
	opacity: 0.42;
}

.correction-sortable-row.is-drop-target {
	background: var(--accent-soft);
	box-shadow: inset 0 2px 0 var(--accent);
}

.correction-drag-cell {
	width: 58px;
}

.correction-drag-handle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 42px;
	padding: 5px 7px;
	border: 1px solid transparent;
	border-radius: 8px;
	color: var(--text-dim);
	background: transparent;
	font: inherit;
	cursor: grab;
	transition:
		color 140ms ease,
		background 140ms ease,
		border-color 140ms ease;
}

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

.correction-drag-handle:hover,
.correction-drag-handle:focus-visible {
	color: var(--text-primary);
	border-color: var(--accent-soft-border);
	background: var(--accent-soft);
	outline: none;
}

.correction-drag-handle:focus-visible {
	box-shadow: 0 0 0 2px var(--accent-soft-strong);
}

.correction-drag-handle:disabled {
	opacity: 0.38;
	cursor: wait;
}

.correction-drag-handle svg {
	width: 14px;
	height: 18px;
	fill: currentColor;
}

.correction-action-group {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--glass-border);
	border-radius: 12px;
	background: var(--glass-bg);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.correction-action-button {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 9px;
	color: var(--text-dim);
	background: transparent;
	cursor: pointer;
	transition:
		color 160ms ease,
		background 160ms ease,
		border-color 160ms ease,
		transform 160ms ease;
}

.correction-action-button svg {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.correction-action-button:hover:not(:disabled),
.correction-action-button:focus-visible {
	color: var(--text-primary);
	border-color: var(--accent-soft-border);
	background: var(--accent-soft);
	transform: translateY(-1px);
}

.correction-action-button:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.correction-action-protect.is-active {
	color: var(--accent-strong, var(--accent));
	border-color: var(--accent-soft-border);
	background: var(--accent-soft);
	box-shadow: inset 0 0 0 1px var(--accent-soft-border);
}

.correction-action-protect.is-active svg {
	filter: drop-shadow(0 0 5px var(--accent-soft-strong));
}

.correction-action-button:disabled {
	opacity: 0.38;
	cursor: wait;
}

.correction-action-danger:hover:not(:disabled),
.correction-action-danger:focus-visible {
	color: var(--danger, #ff6b7a);
	border-color: rgba(255, 107, 122, 0.28);
	background: rgba(255, 107, 122, 0.1);
}

.correction-action-button::after {
	content: attr(data-tooltip);
	position: absolute;
	z-index: 20;
	top: calc(100% + 8px);
	left: 50%;
	padding: 6px 8px;
	border: 1px solid var(--glass-border);
	border-radius: 7px;
	color: var(--text-primary);
	background: var(--surface-strong, #161827);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
	font-size: 11px;
	font-weight: 650;
	line-height: 1;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, -4px);
	transition:
		opacity 120ms ease,
		transform 120ms ease;
}

.correction-action-button:hover::after,
.correction-action-button:focus-visible::after {
	opacity: 1;
	transform: translate(-50%, 0);
}

.correction-action-replace { color: var(--accent, #d9a441); font-size: 1rem; }
.correction-replace-overlay { z-index: 30; padding: 1rem; }
.correction-replace-modal { width: min(680px, 100%); max-height: min(760px, 92vh); overflow: auto; padding: clamp(1.1rem, 3vw, 2rem); }
.correction-replace-header { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; margin-bottom:1.1rem; }
.correction-replace-header h2 { margin:.25rem 0 0; }
.correction-replace-current { display:grid; gap:.2rem; padding:1rem; border:1px solid var(--accent-soft-border); border-radius:14px; background:var(--accent-soft); }
.correction-replace-current span, .correction-replace-candidate small { color:var(--text-muted, #9da4b3); }
.correction-replace-search { width:100%; margin:1rem 0 .7rem; }
.correction-replace-filters { display:flex; flex-wrap:wrap; gap:.55rem; margin-bottom:.9rem; }
.correction-replace-filters label { display:flex; align-items:center; gap:.35rem; font-size:.82rem; }
.correction-ai-replace { width:100%; margin-bottom:.8rem; }
.correction-replace-list { display:grid; gap:.5rem; max-height:330px; overflow:auto; }
.correction-replace-candidate { display:flex; justify-content:space-between; align-items:center; gap:1rem; width:100%; text-align:left; padding:.75rem .85rem; border:1px solid var(--border-color, #333); border-radius:12px; background:transparent; color:inherit; cursor:pointer; transition:transform .18s ease, border-color .18s ease, background .18s ease; }
.correction-replace-candidate:hover, .correction-replace-candidate:focus-visible { transform:translateX(3px); border-color:var(--accent); background:var(--accent-soft); }
.correction-replace-candidate span { display:grid; gap:.2rem; min-width:0; }
.correction-replace-candidate strong, .correction-replace-candidate small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.correction-replace-error { color:#ef8d8d; }
.correction-replace-conflict { display:grid; gap:.45rem; padding:.8rem; margin:.7rem 0; border:1px solid #d77b7b; border-radius:12px; color:#ffd1d1; }
.correction-replace-note { margin:1rem 0 0; font-size:.78rem; color:var(--text-muted, #9da4b3); }
@media (max-width: 560px) { .correction-replace-candidate { align-items:flex-start; flex-direction:column; gap:.25rem; } .correction-replace-candidate small { white-space:normal; } }

/* ── Table ─────────────────────────────────────────────── */
.track-table-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--glass-border);
}

.track-table-toolbar > div {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.track-table-toolbar strong {
	font-size: 13px;
	color: var(--text-primary);
}

.track-table-toolbar span {
	color: var(--text-dim);
	font-size: 12px;
}

.track-problems-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 7px 10px;
	border-radius: 999px;
	border: 1px solid var(--warning-soft-border);
	background: var(--warning-soft);
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;
}

.track-problems-toggle strong {
	min-width: 20px;
	height: 20px;
	display: grid;
	place-items: center;
	border-radius: 999px;
	background: var(--warning-soft-hi);
	color: var(--warning);
	font-size: 11px;
}

.track-problems-toggle.active {
	background: var(--warning-soft-strong);
	border-color: var(--warning);
	box-shadow: 0 0 18px var(--warning-soft-hi);
}

.track-problems-toggle:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.track-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.track-table th {
	text-align: left;
	padding: 10px 14px;
	color: var(--text-dim);
	font-weight: 600;
	border-bottom: 1px solid var(--glass-border);
}

.track-table td {
	padding: 8px 14px;
	border-bottom: 1px solid var(--line-subtle);
}

.track-table tr:hover td {
	background: var(--glass-bg);
}

.track-table tr.row-deselected {
	opacity: 0.45;
}

.track-table tr.row-analysis-error td {
	background: var(--error-soft);
}

.track-main-title,
.track-analysis-hint {
	display: block;
}

.track-main-title {
	font-weight: 650;
	color: var(--text-primary);
}

.track-analysis-hint {
	margin-top: 4px;
	max-width: 360px;
	color: var(--text-dim);
	font-size: 11px;
	line-height: 1.35;
}

.row-analysis-error .track-analysis-hint {
	color: var(--error-text-soft);
}

.analysis-status-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 8px;
	border-radius: 999px;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	white-space: nowrap;
	border: 1px solid var(--glass-border);
	background: var(--surface-muted);
	color: var(--text-dim);
}

.analysis-status-badge::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 999px;
	background: currentColor;
}

.analysis-status-badge.status-analyzed {
	background: var(--success-soft);
	border-color: var(--success-soft-border);
	color: var(--success);
}

.analysis-status-badge.status-cached {
	background: var(--info-soft);
	border-color: var(--info-soft-border);
	color: var(--info);
}

.analysis-status-badge.status-error {
	background: var(--error-soft-hi);
	border-color: var(--error-soft-border);
	color: var(--error);
}

.analysis-status-badge.status-analyzing {
	background: var(--accent-soft-hi);
	border-color: var(--accent-soft-border-strong);
	color: var(--accent);
}

.analysis-status-badge.status-pending {
	background: var(--glass-bg);
	color: var(--text-dim);
}

.playlist-chart-svg {
	width: 100%;
	height: auto;
	overflow: visible;
}

.chart-legend {
	display: flex;
	justify-content: center;
	gap: var(--space-4);
	margin: var(--space-2) 0 var(--space-4);
	font-size: var(--font-size-caption);
}

.chart-legend-item {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}

.chart-swatch {
	display: inline-block;
	width: 12px;
	height: 3px;
}

.chart-swatch-energy {
	border-radius: 1px;
	background: var(--chart-energy);
}

.chart-swatch-bpm {
	border-bottom: 2px dashed var(--chart-bpm);
}

.excluded-section {
	margin-top: var(--space-6);
	padding-top: var(--space-4);
	border-top: 1px solid var(--line-subtle);
}

.excluded-title {
	margin-bottom: var(--space-3);
	color: var(--text-primary);
	font-size: var(--font-size-label);
	font-weight: 700;
}

.excluded-list {
	max-height: 180px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding: var(--space-3);
	border: 1px solid var(--line-subtle);
	border-radius: var(--radius-sm);
	background: var(--surface-subtle);
}

.excluded-item {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-4);
	padding: 6px 0;
	border-bottom: 1px solid var(--line-subtle);
	font-size: var(--font-size-caption);
}

.excluded-track,
.excluded-reason {
	min-width: 0;
	flex: 1;
}

.excluded-artist {
	font-weight: 700;
}

.excluded-track-title {
	font-weight: 550;
}

.excluded-meta,
.excluded-reason {
	color: var(--text-dim);
	font-size: 11px;
}

.excluded-reason {
	text-align: right;
	font-style: italic;
}

.login-submit {
	margin-top: var(--space-2);
}

/* ── Chat ──────────────────────────────────────────────── */
.chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.chat-bubble {
	max-width: 70%;
	padding: 12px 16px;
	border-radius: var(--radius-sm);
	font-size: 14px;
	line-height: 1.5;
}

.chat-bubble.user {
	align-self: flex-end;
	background: var(--glass-bg-hi);
}

.chat-bubble.ai {
	align-self: flex-start;
	background: var(--accent-soft);
	border: 1px solid var(--accent-soft-border);
}

.chat-bubble.thinking {
	color: var(--text-dim);
	font-style: italic;
}

.chat-bubble p {
	margin-top: 0;
	margin-bottom: 8px;
}
.chat-bubble p:last-child {
	margin-bottom: 0;
}

.chat-bubble ul,
.chat-bubble ol {
	margin-top: 0;
	margin-bottom: 8px;
	padding-left: 20px;
}
.chat-bubble ul:last-child,
.chat-bubble ol:last-child {
	margin-bottom: 0;
}

.chat-bubble li {
	margin-bottom: 4px;
}
.chat-bubble li:last-child {
	margin-bottom: 0;
}

.chat-bubble h1,
.chat-bubble h2,
.chat-bubble h3,
.chat-bubble h4,
.chat-bubble h5,
.chat-bubble h6 {
	margin-top: 0;
	margin-bottom: 8px;
	font-size: 1.1em;
	font-weight: 600;
}

.chat-bubble pre {
	background: var(--code-bg);
	padding: 8px;
	border-radius: 4px;
	overflow-x: auto;
	font-family: monospace;
	margin-top: 0;
	margin-bottom: 8px;
}

.chat-bubble code {
	font-family: monospace;
	background: var(--code-bg);
	padding: 2px 4px;
	border-radius: 2px;
}

.chat-bubble pre code {
	background: none;
	padding: 0;
}

.chat-input-row {
	display: flex;
	gap: 10px;
	padding: 16px;
}

.ai-editor {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 16px;
}

.ai-editor-toolbar,
.ai-editor-footer {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.ai-editor-footer {
	justify-content: space-between;
	color: var(--text-dim);
	font-size: 12px;
}

.btn-compact {
	padding: 8px 12px;
	font-size: 12px;
}

.chat-input {
	flex: 1;
	padding: 12px 16px;
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	color: var(--text-primary);
	font-size: 14px;
	outline: none;
}

.ai-editor-textarea {
	width: 100%;
	min-height: 96px;
	max-height: 320px;
	resize: vertical;
	line-height: 1.5;
	font-family: inherit;
	overflow-y: auto;
}

.ai-editor-preview {
	padding: 12px 16px;
	border: 1px solid var(--accent-soft-border);
	border-radius: var(--radius-sm);
	background: var(--accent-soft);
	font-size: 14px;
	line-height: 1.5;
}

.ai-editor-preview p {
	margin-top: 0;
	margin-bottom: 8px;
}

.ai-editor-preview p:last-child,
.ai-editor-preview ul:last-child,
.ai-editor-preview ol:last-child {
	margin-bottom: 0;
}

.chat-input::placeholder {
	color: var(--text-dim);
}
.chat-input:focus {
	border-color: var(--accent);
}

/* ── Progress bar ──────────────────────────────────────── */
.progress-bar {
	width: 100%;
	height: 6px;
	background: var(--glass-bg);
	border-radius: 3px;
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--accent), var(--accent-dim));
	transition: width 0.3s ease;
}

/* ── Status bar ────────────────────────────────────────── */
.status-bar {
	min-height: var(--control-height-sm);
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-2) var(--space-6);
	font-size: var(--font-size-caption);
	color: var(--text-dim);
	background: var(--glass-bg);
	backdrop-filter: blur(var(--blur));
	-webkit-backdrop-filter: blur(var(--blur));
	border-top: 1px solid var(--glass-border);
}

.status-bar-dot {
	width: 6px;
	height: 6px;
	flex: 0 0 auto;
	border-radius: 999px;
	background: var(--accent);
	box-shadow: 0 0 10px var(--accent-glow);
}

/* ── Analysis logs ─────────────────────────────────────── */
.log-entry {
	padding: 6px 12px;
	font-size: 13px;
	font-family: "SF Mono", "Fira Code", monospace;
}

.log-ok {
	color: var(--success);
}
.log-err {
	color: var(--error);
}
.log-info {
	color: var(--text-dim);
}

.log-badge {
	display: inline-flex;
	align-items: center;
	margin-left: 6px;
	padding: 2px 6px;
	border-radius: 999px;
	background: var(--glass-bg-hi);
	color: var(--text-dim);
	font-size: 11px;
	font-family: inherit;
}

.log-badge.cache-hit {
	color: var(--success);
}
.log-badge.cache-miss {
	color: var(--text-dim);
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
	width: 6px;
}
::-webkit-scrollbar-track {
	background: transparent;
}
::-webkit-scrollbar-thumb {
	background: var(--glass-border);
	border-radius: 3px;
}

/* ── Fade transitions ──────────────────────────────────── */
.fade-enter {
	animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ── Welcome text ──────────────────────────────────────── */
.welcome {
	padding: 40px;
	text-align: center;
	color: var(--text-dim);
}

@media (max-width: 980px) {
	html,
	body {
		overflow: auto;
	}
	#app {
		min-height: 100vh;
		height: auto;
	}
	.appbar {
		align-items: flex-start;
		flex-wrap: wrap;
		padding: 12px;
	}
	.appbar-title {
		flex: 1 1 180px;
		flex-wrap: wrap;
		gap: 6px 10px;
	}
	.appbar-actions {
		flex: 1 1 100%;
		flex-wrap: wrap;
		gap: 8px;
		justify-content: flex-start;
	}
	.theme-switch {
		flex: 1 1 160px;
		min-width: 0;
	}
	.theme-select {
		flex: 1 1 auto;
		max-width: none;
		min-width: 0;
	}
	.appbar-actions .btn-secondary {
		padding: 6px 10px !important;
	}
	.body {
		flex-direction: column;
		overflow: visible;
	}
	.pipeline-rail {
		width: auto;
		margin: 12px;
	}
	.pipeline-list {
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: minmax(210px, 1fr);
		overflow-x: auto;
		padding-bottom: 4px;
	}
	.pipeline-reset-actions {
		margin-top: 0;
		padding: 4px 0 0;
	}
	.pipeline-reset-button {
		width: 100%;
	}
	.pipeline-item:not(:last-child)::after {
		left: 38px;
		right: -18px;
		top: 28px;
		bottom: auto;
		width: auto;
		height: 2px;
	}
	.analysis-progress-details {
		padding: 14px;
	}
	.analysis-progress-status {
		grid-template-columns: 1fr;
		align-items: start;
		gap: 10px;
	}
	.analysis-progress-status-text {
		white-space: normal;
	}
	.analysis-metric-row {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.track-table-toolbar {
		align-items: stretch;
		flex-direction: column;
	}
	.track-problems-toggle {
		justify-content: space-between;
	}
	.analysis-current-track strong {
		white-space: normal;
	}
	.content {
		padding: 0 12px 12px;
		overflow: visible;
	}
	.workflow-panel {
		min-height: auto;
	}
	.source-grid,
	.correction-grid,
	.history-sections {
		grid-template-columns: 1fr;
	}
	.source-library-controls {
		grid-template-columns: 1fr;
	}
	.history-card-header {
		flex-direction: column;
	}
	.summary-card {
		grid-template-columns: 1fr;
	}
	.summary-actions {
		flex-wrap: wrap;
		justify-content: stretch;
	}
	.summary-actions button,
	.summary-actions .btn-accent,
	.summary-actions .btn-secondary,
	.summary-actions .btn-danger {
		flex: 1 1 100%;
		width: 100%;
	}
	.playlist-picker,
	.chat-input-row {
		grid-template-columns: 1fr;
		flex-direction: column;
	}
	.chat-bubble {
		max-width: 100%;
	}
}

/* Compatibility highlighting and badges */

.badge-perfect,
.badge-harmonic,
.badge-tempo,
.badge-focused {
	display: inline-block;
	padding: 4px 8px;
	font-size: 11px;
	font-weight: 600;
	border-radius: 6px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.badge-perfect {
	background: var(--success-soft-hi);
	color: var(--success);
	border: 1px solid var(--success-soft-border);
}

.badge-harmonic {
	background: var(--accent-soft-border);
	color: var(--accent);
	border: 1px solid var(--accent-soft-border);
}

.badge-tempo {
	background: var(--info-soft);
	color: var(--info);
	border: 1px solid var(--info-soft-border);
}

.badge-focused {
	background: var(--glass-bg-hi);
	color: var(--text-primary);
	border: 1px solid var(--glass-border);
}

/* Chart container styles */
.chart-card {
	margin-top: 16px;
	padding: 16px;
	border-radius: var(--radius-sm);
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
}

.chart-wrapper {
	margin: 12px 0;
	padding: 8px;
	position: relative;
	width: 100%;
}

/* ── Compact Playlist Table ────────────────────────────── */
.generated-card {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.playlist-table {
	width: 100%;
	min-width: 920px;
	border-collapse: collapse;
	font-size: 12px;
}

.playlist-table th:last-child,
.playlist-table td:last-child {
	min-width: 300px;
}

.playlist-table td:last-child {
	overflow: visible;
}

.correction-playlist-table th:last-child,
.correction-playlist-table td:last-child {
	min-width: 0;
}

.playlist-table th {
	text-align: left;
	padding: 6px 10px;
	color: var(--text-dim);
	font-weight: 600;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 1px solid var(--glass-border);
	white-space: nowrap;
}

.playlist-table td {
	padding: 6px 10px;
	border-bottom: 1px solid var(--line-subtle);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.playlist-table td.pl-title {
	max-width: 200px;
	color: var(--text-primary);
	font-weight: 500;
}

.playlist-table td.pl-artist {
	max-width: 150px;
	color: var(--text-dim);
}

.playlist-table td.pl-num {
	color: var(--text-dim);
	font-variant-numeric: tabular-nums;
}

/* Group the DJ-facing level readings without letting the extra metadata
 * squeeze the track columns. The scroll wrapper remains the narrow-screen
 * fallback, while the summary can wrap at its separators. */
.playlist-table th.pl-loudness,
.playlist-table td.pl-loudness {
	width: 176px;
	min-width: 176px;
}

.playlist-table th.pl-loudness {
	color: var(--text-dim);
}

.playlist-table td.pl-loudness {
	overflow: visible;
	color: var(--text-dim);
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
	font-weight: 500;
	line-height: 1.35;
	white-space: normal;
}

.playlist-track-row {
	cursor: pointer;
	transition: background 0.15s ease;
}

.playlist-track-row:hover td {
	background: var(--glass-bg);
}

.playlist-track-row.expanded td {
	background: var(--glass-bg-hi);
}

/* Reason row (expands below track row on click) */
.reason-row td {
	padding: 8px 10px 10px;
	background: var(--surface-subtle);
	border-bottom: 1px solid var(--glass-border);
	font-size: 11px;
	color: var(--text-dim);
	line-height: 1.4;
	white-space: normal;
}

.reason-label {
	font-weight: 600;
	color: var(--text-primary);
	margin-right: 6px;
}

/* Local audio analysis expands beneath a playlist track, alongside reason rows. */
.analysis-details-row td {
	padding: 10px;
	background: var(--surface-subtle);
	border-bottom: 1px solid var(--glass-border);
	white-space: normal;
	overflow: visible;
	text-overflow: clip;
}

.analysis-details {
	min-width: 0;
	color: var(--text-dim);
	font-size: 11px;
	line-height: 1.4;
}

.analysis-detail-groups {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 10px;
}

.analysis-detail-group {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 5px 10px;
	min-width: 0;
	padding: 8px;
	border: 1px solid var(--line-subtle);
	border-radius: var(--radius-sm);
	background: var(--glass-bg);
}

.analysis-detail-group > :first-child {
	grid-column: 1 / -1;
	margin: 0 0 1px;
	color: var(--text-primary);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.05em;
	line-height: 1.2;
	text-transform: uppercase;
}

.analysis-detail-group > :first-child:last-child {
	margin-bottom: 0;
}

.analysis-detail-group > :not(:first-child):not(.analysis-detail-item) {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 5px 10px;
}

.analysis-detail-item {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 6px;
	min-width: 0;
}

.analysis-detail-label {
	flex: 0 1 auto;
	color: var(--text-dim);
}

.analysis-detail-value {
	min-width: 0;
	color: var(--text-primary);
	font-variant-numeric: tabular-nums;
	font-weight: 500;
	text-align: right;
	overflow-wrap: anywhere;
	word-break: break-word;
}

@media (max-width: 560px) {
	.analysis-detail-groups,
	.analysis-detail-group > :not(:first-child) {
		grid-template-columns: 1fr;
	}

	.analysis-detail-item {
		align-items: flex-start;
	}

	.analysis-detail-value {
		text-align: left;
	}
}

/* ── Collapsible Markdown ──────────────────────────────── */
.playlist-markdown-wrapper {
	overflow: hidden;
	transition: max-height 0.3s ease;
	max-height: 5000px;
}

.playlist-markdown-wrapper.collapsed {
	max-height: 4.2em;
	position: relative;
}

.playlist-markdown-wrapper.collapsed::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 2em;
	background: linear-gradient(to bottom, transparent, var(--bg-grad-bot));
	pointer-events: none;
}

.markdown-toggle {
	display: inline-block;
	background: none;
	border: none;
	color: var(--accent);
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	padding: 4px 0;
	margin-top: 4px;
	text-decoration: none;
}

.markdown-toggle:hover {
	text-decoration: underline;
}

/* ── Step 5: Even More Compact ────────────────────────── */
.generated-card.compact .playlist-table {
	font-size: 11px;
}

.generated-card.compact .playlist-table th {
	padding: 4px 8px;
	font-size: 9px;
}

.generated-card.compact .playlist-table td {
	padding: 4px 8px;
}

.generated-card.compact .playlist-table td.pl-title {
	max-width: 140px;
}

.generated-card.compact .playlist-table td.pl-artist {
	max-width: 100px;
}

.generated-card.compact .playlist-markdown-wrapper.collapsed {
	max-height: 2.8em;
}

/* ── Step 4: playlist stats, actions & result states ──── */
.playlist-stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

.stat-tile {
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	border-radius: var(--radius-sm);
}

.stat-label {
	color: var(--text-dim);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.stat-value {
	font-size: 20px;
	font-weight: 700;
	color: var(--text-primary);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

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

.btn-generate {
	min-width: 210px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.btn-loader {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.btn-spinner {
	width: 15px;
	height: 15px;
	border: 2px solid var(--glass-border);
	border-top-color: var(--surface-selected-text);
	border-radius: 50%;
	animation: rekordai-spin 0.7s linear infinite;
}

@keyframes rekordai-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Generated card header & states */
.generated-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}
.generated-card-header h3 {
	margin-bottom: 0;
}

.track-count-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	border-radius: 999px;
	background: var(--accent-glow);
	border: 1px solid var(--accent);
	color: var(--surface-selected-text);
	font-size: 13px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.result-empty-state,
.result-loading-state {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	text-align: center;
	padding: 48px 24px;
	color: var(--text-dim);
}

.result-empty-state .empty-icon {
	width: 64px;
	height: 64px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--glass-bg-hi);
	border: 1px solid var(--glass-border);
	color: var(--accent);
}
.result-empty-state .empty-icon svg {
	width: 30px;
	height: 30px;
}
.result-empty-state p {
	max-width: 380px;
	font-size: 14px;
	line-height: 1.55;
	color: var(--text-dim);
}
.result-loading-state p {
	font-size: 14px;
}

.generation-progress {
	width: min(100%, 380px);
	text-align: left;
}

.generation-progress-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 8px;
	font-size: 12px;
	color: var(--text-dim);
}

.generation-progress-meta strong {
	color: var(--text);
	font-variant-numeric: tabular-nums;
}

.generation-progress-track {
	height: 8px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--progress-track);
	border: 1px solid var(--glass-border);
}

.generation-progress-fill {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--accent-dim), var(--accent));
	box-shadow: 0 0 16px var(--accent-glow);
	transition: width 0.45s ease;
}

.spinner-large {
	width: 40px;
	height: 40px;
	border: 3px solid var(--glass-border);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: rekordai-spin 0.8s linear infinite;
}

.chart-title {
	margin-bottom: 4px;
	font-size: 12px;
	font-weight: 700;
	color: var(--text-dim);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* Sticky table header so long playlists stay readable while scrolling */
.generated-card .playlist-table thead th {
	position: sticky;
	top: 0;
	background: var(--bg-grad-bot);
	z-index: 1;
}

/* Responsive: stack stats & full-width actions on narrow windows */
@media (max-width: 720px) {
	.playlist-stats {
		grid-template-columns: 1fr;
	}
	.playlist-actions {
		flex-direction: column;
		align-items: stretch;
	}
	.playlist-actions .btn-accent,
	.playlist-actions .btn-secondary {
		width: 100%;
	}
}

@media (max-width: 720px) {
	.playlist-table {
		min-width: 900px;
	}

	.playlist-table th.pl-loudness,
	.playlist-table td.pl-loudness {
		width: 164px;
		min-width: 164px;
	}
}

/* ── Public landing page ───────────────────────────────── */
body.landing-body {
	min-height: 100vh;
	height: auto;
	overflow-x: hidden;
	overflow-y: auto;
}

.landing-body::before,
.landing-body::after {
	content: "";
	position: fixed;
	width: 420px;
	height: 420px;
	border-radius: 999px;
	pointer-events: none;
	filter: blur(8px);
	z-index: 0;
}

.landing-body::before {
	top: -160px;
	right: -120px;
	background: radial-gradient(
		circle,
		var(--accent-soft-strong),
		transparent 68%
	);
}

.landing-body::after {
	left: -160px;
	bottom: -180px;
	background: radial-gradient(
		circle,
		rgba(92, 242, 160, 0.12),
		transparent 66%
	);
}

.landing-shell {
	position: relative;
	z-index: 1;
	width: min(1120px, calc(100% - 32px));
	margin: 0 auto;
	padding: 24px 0 56px;
}

.landing-nav {
	position: sticky;
	top: 16px;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	padding: 12px 14px;
}

.landing-brand,
.landing-links,
.landing-actions,
.landing-cta-row,
.landing-download,
.landing-steps,
.landing-steps div {
	display: flex;
	align-items: center;
}

.landing-brand {
	gap: 10px;
	color: var(--text-primary);
	text-decoration: none;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.landing-brand img {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	box-shadow: 0 0 22px var(--accent-glow);
}

.landing-links {
	gap: 22px;
}

.landing-links a,
.landing-mobile a {
	color: var(--text-dim);
	text-decoration: none;
	font-size: 14px;
	font-weight: 650;
	transition: color 0.2s ease;
}

.landing-links a:hover,
.landing-mobile a:hover {
	color: var(--text-primary);
}

.landing-actions {
	gap: 10px;
}

.landing-menu-btn {
	display: none;
	padding: 8px 11px;
}

.landing-mobile {
	display: none;
	position: sticky;
	top: 86px;
	z-index: 4;
	margin-top: 10px;
	padding: 14px;
	flex-direction: column;
	align-items: stretch;
	gap: 12px;
}

.landing-hero {
	display: grid;
	grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
	gap: 34px;
	align-items: center;
	padding: 84px 0 44px;
}

.landing-hero-copy h1 {
	max-width: 760px;
	font-size: clamp(36px, 5.8vw, 64px);
	line-height: 1.08;
	letter-spacing: -0.045em;
	margin: 16px 0 24px;
}

.landing-eyebrow {
	color: var(--accent);
	font-size: 12px;
	font-weight: 900;
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.landing-lead {
	max-width: 640px;
	color: var(--text-dim);
	font-size: clamp(15px, 1.55vw, 18px);
	line-height: 1.55;
}

.landing-cta-row {
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 30px;
}

.landing-download {
	justify-content: center;
	gap: 10px;
	min-width: 220px;
	text-decoration: none;
}

.platform-icon {
	width: 19px;
	height: 19px;
	flex: 0 0 auto;
	fill: currentColor;
	opacity: 0.92;
}

.landing-download span {
	opacity: 0.76;
	font-size: 13px;
}

.landing-note {
	margin-top: 14px;
	color: var(--text-dim);
	font-size: 13px;
	line-height: 1.45;
}

.landing-hero-card {
	min-height: 420px;
	padding: 34px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 28px;
	position: relative;
	overflow: hidden;
}

.landing-hero-card::before {
	content: "";
	position: absolute;
	inset: -40% -30% auto;
	height: 260px;
	background: radial-gradient(
		circle,
		rgba(124, 92, 255, 0.34),
		transparent 70%
	);
}

.landing-hero-icon {
	position: relative;
	width: min(190px, 55vw);
	height: min(190px, 55vw);
	border-radius: 42px;
	box-shadow:
		0 24px 80px rgba(0, 0, 0, 0.36),
		0 0 42px var(--accent-glow);
}

.landing-hero-card p {
	position: relative;
	color: var(--text-dim);
	text-align: center;
	font-weight: 650;
}

.landing-wave {
	position: relative;
	display: flex;
	align-items: end;
	gap: 8px;
	height: 70px;
}

.landing-wave span {
	width: 12px;
	border-radius: 999px;
	background: linear-gradient(180deg, var(--success), var(--accent));
	box-shadow: 0 0 18px var(--accent-glow);
}

.landing-wave span:nth-child(1) {
	height: 28px;
	opacity: 0.58;
}
.landing-wave span:nth-child(2) {
	height: 54px;
	opacity: 0.82;
}
.landing-wave span:nth-child(3) {
	height: 70px;
}
.landing-wave span:nth-child(4) {
	height: 44px;
	opacity: 0.72;
}
.landing-wave span:nth-child(5) {
	height: 62px;
	opacity: 0.9;
}

.landing-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
	margin: 8px 0 16px;
}

.landing-card {
	padding: 22px;
	min-height: 180px;
}

.landing-card h2 {
	font-size: 20px;
	letter-spacing: -0.03em;
	margin-bottom: 12px;
}

.landing-card p {
	color: var(--text-dim);
	line-height: 1.55;
	font-size: 14px;
}

.landing-steps {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
	padding: 18px;
}

.landing-steps div {
	gap: 12px;
	min-width: 0;
	justify-content: center;
}

.landing-steps strong {
	color: var(--accent);
	font-size: 13px;
	letter-spacing: 0.12em;
}

.landing-steps span {
	color: var(--text-primary);
	font-weight: 700;
}

@media (max-width: 1020px) {
	.landing-grid,
	.landing-steps {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 820px) {
	.landing-shell {
		width: min(100% - 24px, 560px);
		padding-top: 12px;
	}

	.landing-links {
		display: none;
	}

	.landing-menu-btn,
	.landing-mobile {
		display: flex;
	}

	.landing-hero {
		grid-template-columns: 1fr;
		padding: 54px 0 26px;
	}

	.landing-hero-copy h1 {
		font-size: clamp(32px, 10.5vw, 48px);
		line-height: 1.12;
		letter-spacing: -0.035em;
	}

	.landing-hero-card {
		min-height: 320px;
	}

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

	.landing-steps {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 720px) {
	.onboarding-card {
		align-items: stretch;
		flex-direction: column;
		gap: var(--space-4);
		padding: var(--space-5);
	}

	.onboarding-action {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

@media (prefers-contrast: more) {
	:root {
		--glass-border: rgba(255, 255, 255, 0.34);
		--text-dim: rgba(232, 232, 240, 0.78);
		--line-subtle: rgba(255, 255, 255, 0.2);
	}

	.glass,
	.glass-hi,
	.glass-subtle {
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}
}

@media (max-width: 480px) {
	.landing-nav {
		align-items: flex-start;
	}

	.landing-actions {
		flex-direction: column;
		align-items: flex-end;
	}

	.landing-download {
		width: 100%;
	}
}

/* ── Correction workspace / liquid glass treatment ───────────────
   The correction screen is a working studio: the playlist gets the
   strongest contrast, while the assistant surfaces recede into glass. */
:root {
	--correction-panel-bg: var(--glass-bg);
	--correction-panel-hi: var(--glass-bg-hi);
	--correction-inset-bg: var(--control-bg);
	--correction-table-bg: var(--surface-subtle);
	--correction-table-head: var(--glass-bg-hi);
	--correction-edge: var(--glass-border);
	--correction-highlight: var(--glass-bg-hi);
	--correction-accent-wash: var(--accent-soft);
	--correction-shadow: var(--shadow-color);
}

.correction-workspace {
	position: relative;
	isolation: isolate;
	padding: clamp(18px, 2.4vw, 32px);
	border-radius: calc(var(--radius) + 8px);
	background:
		radial-gradient(circle at 12% 0%, var(--correction-accent-wash), transparent 32%),
		linear-gradient(135deg, var(--correction-highlight), transparent 58%);
}

.correction-workspace::before {
	position: absolute;
	inset: 0;
	z-index: -1;
	border: 1px solid var(--correction-edge);
	border-radius: inherit;
	content: "";
	pointer-events: none;
}

.correction-workspace > .panel-heading {
	max-width: 760px;
	margin: 0 0 clamp(18px, 2.5vw, 28px);
}

.correction-workspace > .panel-heading h2 {
	margin-top: 8px;
	letter-spacing: -0.035em;
	text-shadow: 0 0 28px var(--accent-glow);
}

.correction-workspace > .panel-heading > p:last-child {
	max-width: 64ch;
	color: var(--text-dim);
}

.correction-playlist-panel,
.correction-assistant-panel > .glass,
.playlist-history-card {
	position: relative;
	overflow: hidden;
	border-color: var(--correction-edge);
	background:
		linear-gradient(145deg, var(--correction-panel-hi), var(--correction-panel-bg) 42%),
		linear-gradient(120deg, var(--correction-accent-wash), transparent 45%),
		var(--correction-panel-bg);
	box-shadow:
		inset 0 1px 0 var(--correction-highlight),
		var(--glass-shadow-2),
		0 0 0 1px var(--accent-soft);
}

.correction-playlist-panel::after,
.correction-assistant-panel > .glass::after,
.playlist-history-card::after {
	position: absolute;
	top: 0;
	left: 12%;
	width: 40%;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--correction-highlight), transparent);
	content: "";
	pointer-events: none;
}

.correction-playlist-panel {
	padding: clamp(16px, 2vw, 24px);
	min-width: 0;
}

.correction-playlist-heading {
	min-height: 42px;
	margin-bottom: 16px;
	padding: 0 0 14px !important;
	border-bottom-color: var(--correction-edge) !important;
}

.correction-playlist-heading h3,
.correction-recommendations-card h3,
.correction-diff-card h3,
.chat-messages + .ai-editor {
	letter-spacing: -0.02em;
}

.correction-history-nav {
	padding: 4px;
	border: 1px solid var(--correction-edge);
	border-radius: 999px;
	background: var(--correction-inset-bg);
}

.correction-history-button.btn-secondary {
	width: 30px;
	min-width: 30px;
	height: 30px;
	min-height: 30px;
	border-radius: 50%;
}

.correction-playlist-table-scroll {
	position: relative;
	border-color: var(--correction-edge);
	background: var(--correction-table-bg);
	box-shadow: inset 0 1px 18px var(--shadow-color);
}

.generated-card.compact .correction-playlist-table thead th {
	background: var(--correction-table-head);
	color: var(--text-dim);
	letter-spacing: 0.1em;
}

.correction-playlist-table td {
	padding-top: 10px;
	padding-bottom: 10px;
	border-bottom-color: var(--line-subtle);
}

.correction-sortable-row:hover {
	background: var(--accent-soft) !important;
}

.correction-assistant-panel {
	gap: 14px;
}

.correction-assistant-panel > .glass {
	padding: clamp(16px, 2vw, 22px);
}

.correction-recommendations-card {
	background:
		linear-gradient(145deg, var(--success-soft), transparent 55%),
		var(--correction-panel-bg);
}

.correction-recommendations-list li {
	padding: 8px 10px;
	border: 1px solid var(--correction-edge);
	border-radius: 10px;
	background: var(--correction-inset-bg);
}

.correction-diff-card {
	border-color: var(--accent-soft-border) !important;
	background: linear-gradient(145deg, var(--accent-soft-hi), var(--correction-panel-bg));
}

.correction-diff-summary span {
	border: 1px solid var(--correction-edge);
	background: var(--correction-inset-bg);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.chat-messages {
	min-height: 150px;
	max-height: min(34vh, 360px);
	overflow-y: auto;
	background: var(--correction-inset-bg) !important;
}

.chat-bubble {
	border: 1px solid var(--correction-edge);
	box-shadow: var(--glass-shadow-1);
}

.ai-editor {
	border-color: var(--accent-soft-border-strong) !important;
	background: linear-gradient(145deg, var(--correction-accent-wash), var(--correction-panel-bg)) !important;
}

.ai-editor-textarea {
	min-height: 92px;
	border-color: var(--correction-edge) !important;
	background: var(--correction-inset-bg) !important;
}

.playlist-history-card {
	margin-top: clamp(18px, 2.5vw, 28px);
}

.correction-replace-modal {
	border-color: var(--correction-edge);
	background:
		linear-gradient(145deg, var(--correction-panel-hi), var(--correction-panel-bg)),
		var(--correction-panel-bg);
	box-shadow: var(--glass-shadow-3), inset 0 1px 0 var(--correction-highlight);
}

.correction-replace-current {
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Replacement picker: keep the selected track prominent and make the
   candidate search feel like a small, focused workspace. Explicit fallback
   colors keep this readable in Safari where newer color functions may vary. */
.correction-replace-overlay {
	align-items: flex-start;
	padding: 24px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.correction-replace-modal {
	width: min(680px, 100%);
	max-width: 680px;
	max-height: calc(100vh - 48px);
	max-height: calc(100svh - 48px);
	margin: auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding: clamp(20px, 4vw, 32px);
	gap: 20px;
	background: var(--correction-panel-bg, var(--glass-bg));
}

.correction-replace-header {
	align-items: flex-start;
	gap: 16px;
	margin-bottom: 0;
}

.correction-replace-heading {
	min-width: 0;
}

.correction-replace-heading h2 {
	margin: 6px 0 0;
	font-size: clamp(24px, 4vw, 32px);
	letter-spacing: -0.04em;
}

.correction-replace-intro {
	max-width: 48ch;
	margin: 8px 0 0;
	color: var(--text-dim);
	font-size: 13px;
	line-height: 1.5;
}

.correction-replace-close {
	display: inline-grid;
	place-items: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	min-width: 40px;
	border: 1px solid var(--glass-border);
	border-radius: 50%;
	background: var(--control-bg);
	color: var(--text-primary);
	font: inherit;
	cursor: pointer;
	transition:
		background var(--motion-base) var(--ease-standard),
		border-color var(--motion-base) var(--ease-standard),
		color var(--motion-base) var(--ease-standard),
		transform var(--motion-fast) var(--ease-standard),
		box-shadow var(--motion-base) var(--ease-standard);
}

.correction-replace-close svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

.correction-replace-close:hover {
	border-color: var(--accent-soft-border-strong);
	background: var(--accent-soft-hi);
	color: var(--accent);
	transform: translateY(-1px);
	box-shadow: 0 6px 16px var(--accent-glow);
}

.correction-replace-close:active {
	transform: translateY(0) scale(0.95);
	box-shadow: none;
}

.correction-replace-close:focus-visible {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

.correction-replace-current {
	gap: 5px;
	padding: 16px 18px;
	border-color: var(--accent-soft-border);
	border-radius: var(--radius-sm);
	background: var(--accent-soft);
}

.correction-replace-current-label,
.correction-replace-search-field > span,
.correction-replace-filters legend {
	color: var(--accent);
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.12em;
	line-height: 1.2;
	text-transform: uppercase;
}

.correction-replace-current strong {
	font-size: 17px;
	line-height: 1.25;
}

.correction-replace-current span {
	font-size: 13px;
}

.correction-replace-current small {
	margin-top: 4px;
	color: var(--text-dim);
	font-size: 11px;
	font-variant-numeric: tabular-nums;
	line-height: 1.4;
}

.correction-replace-search-field {
	display: grid;
	gap: 8px;
}

.correction-replace-search-field > span {
	display: inline-flex;
	align-items: baseline;
	gap: 7px;
}

.correction-replace-search-field > span small {
	color: var(--text-dim);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
}

.correction-replace-search {
	width: 100%;
	min-height: 46px;
	margin: 0;
	padding: 11px 14px;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	background: var(--control-bg);
	color: var(--text-primary);
	font: inherit;
	font-size: 14px;
	-webkit-appearance: none;
	appearance: none;
}

.correction-replace-search::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.correction-replace-search:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
	outline: none;
}

.correction-replace-filters {
	min-width: 0;
	margin: 0;
	padding: 12px 14px 14px;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
	background: var(--surface-subtle);
}

.correction-replace-filters legend {
	padding: 0 6px;
}

.correction-replace-filter-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.correction-replace-filters label {
	display: inline-flex;
	align-items: flex-start;
	gap: 8px;
	min-width: min(100%, 240px);
	min-height: 52px;
	padding: 7px 11px;
	border: 1px solid var(--glass-border);
	border-radius: 999px;
	background: var(--control-bg);
	color: var(--text-primary);
	font-size: 12px;
	cursor: pointer;
}

.correction-replace-filter-copy {
	display: grid;
	gap: 3px;
	min-width: 0;
}

.correction-replace-filter-copy strong {
	font-size: 12px;
	line-height: 1.2;
}

.correction-replace-filter-copy small {
	color: var(--text-dim);
	font-size: 10px;
	font-weight: 500;
	line-height: 1.35;
}

.correction-replace-filters label.is-selected {
	border-color: var(--accent-soft-border-strong);
	background: var(--accent-soft-hi);
}

.correction-replace-filters input {
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--accent);
}

.correction-ai-replace {
	width: 100%;
	min-height: 46px;
	margin: 0;
	border-color: var(--accent-soft-border-strong);
	background: var(--accent-soft-hi);
	font-weight: 750;
}

.correction-replace-list {
	min-height: 120px;
	max-height: 330px;
	gap: 8px;
	padding: 2px;
	margin-inline: -2px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.correction-replace-candidate {
	align-items: flex-start;
	padding: 13px 14px;
	border-color: var(--glass-border);
	background: var(--control-bg);
}

.correction-replace-candidate > span {
	gap: 4px;
}

.correction-replace-candidate > small {
	flex: 0 1 auto;
	color: var(--text-dim);
	font-size: 11px;
	line-height: 1.4;
	text-align: right;
}

.correction-replace-empty {
	display: grid;
	place-items: center;
	gap: 6px;
	min-height: 120px;
	padding: 20px;
	border: 1px dashed var(--glass-border);
	border-radius: var(--radius-sm);
	background: var(--surface-subtle);
	color: var(--text-dim);
	text-align: center;
}

.correction-replace-empty-icon {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border: 1px solid var(--accent-soft-border);
	border-radius: 50%;
	color: var(--accent);
	font-size: 22px;
}

.correction-replace-empty strong {
	color: var(--text-primary);
	font-size: 14px;
}

.correction-replace-empty p {
	max-width: 38ch;
	margin: 0;
	font-size: 12px;
	line-height: 1.45;
}

.correction-replace-note {
	margin: 0;
	padding-top: 14px;
	border-top: 1px solid var(--line-subtle);
	font-size: 12px;
	line-height: 1.5;
}

@media (max-width: 560px) {
	.correction-replace-overlay {
		align-items: flex-start;
		padding: 12px;
	}
	.correction-replace-modal {
		max-height: calc(100vh - 24px);
		max-height: calc(100svh - 24px);
		padding: 18px;
		gap: 16px;
	}
	.correction-replace-header {
		gap: 10px;
	}
	.correction-replace-heading h2 {
		font-size: 25px;
	}
	.correction-replace-candidate {
		flex-direction: column;
		gap: 7px;
	}
	.correction-replace-candidate > small {
		text-align: left;
		white-space: normal;
	}
	.correction-replace-filter-options {
		flex-direction: column;
	}
	.correction-replace-filters label {
		width: 100%;
		min-width: 0;
		border-radius: var(--radius-sm);
	}
}

@media (max-width: 900px) {
	.correction-workspace {
		padding: 16px;
	}
	.correction-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.correction-playlist-panel {
		order: 1;
	}
	.correction-assistant-panel {
		order: 2;
	}
}

@media (max-width: 560px) {
	.correction-workspace {
		padding: 12px;
		margin-inline: -4px;
	}
	.correction-playlist-panel,
	.correction-assistant-panel > .glass,
	.playlist-history-card {
		padding: 14px;
		border-radius: 14px;
	}
	.correction-playlist-heading {
		align-items: flex-start;
		flex-direction: column;
	}
	.correction-history-nav {
		align-self: flex-end;
	}
	.correction-playlist-table-scroll {
		margin-inline: -6px;
	}
	.correction-diff-actions,
	.ai-editor-footer {
		align-items: stretch;
		flex-direction: column;
	}
	.correction-diff-actions button,
	.ai-editor-footer button {
		width: 100%;
	}
	.ai-editor-toolbar {
		align-items: stretch;
		flex-wrap: wrap;
	}
}

/* Result surfaces: keep controls in the flow and make the table's width
   intentional. A narrow window scrolls the data surface; it never clips the
   transport or the final column. */
.playlist-actions {
	align-items: stretch;
	justify-content: flex-start;
	flex-wrap: wrap;
	margin: 14px 0 18px;
}

.playlist-actions > button {
	max-width: 100%;
	white-space: normal;
}

.playlist-table-scroll {
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-sm);
}

.playlist-table-scroll .playlist-table {
	margin: 0;
}

.playlist-table-scroll .track-playback {
	margin-inline: auto;
}

@media (max-width: 720px) {
	.playlist-actions {
		align-items: stretch;
		gap: 8px;
	}

	.playlist-actions > button {
		flex: 1 1 100%;
		margin-inline: 0;
	}
}

/* ── Correction composition repair ────────────────────────────────
   Keep the table useful without letting its transport controls define the
   width of the studio. The scroll surface remains the deliberate fallback
   for narrow windows and long metadata. */
.correction-workspace {
	width: 100%;
	min-width: 0;
	min-height: 0;
}

.correction-grid {
	grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
	align-items: start;
	min-width: 0;
}

.correction-playlist-panel,
.correction-assistant-panel,
.correction-assistant-panel > .glass,
.playlist-history-card {
	min-width: 0;
}

.correction-playlist-panel {
	width: 100%;
}

.correction-playlist-table {
	min-width: 1280px;
}

.correction-playlist-table th:nth-child(2) {
	width: 31%;
}

.correction-playlist-table th:nth-child(3) {
	width: 24%;
}

.correction-playlist-table th:nth-child(7),
.correction-playlist-table td:nth-child(7) {
	width: 176px;
	min-width: 176px;
}

.correction-playlist-table th:nth-child(8),
.correction-playlist-table td:nth-child(8) {
	width: 176px;
	min-width: 176px;
}

.correction-playlist-table th:nth-child(9),
.correction-playlist-table td:nth-child(9) {
	width: 84px;
}

.correction-assistant-panel {
	min-width: 0;
	min-height: 0;
	gap: 14px;
}

.correction-assistant-panel > .glass {
	width: 100%;
}

.correction-recommendations-card {
	min-height: 0;
	max-height: 320px;
	overflow-y: auto;
}

.correction-diff-card {
	min-height: 126px;
}

.correction-assistant-panel .chat-messages {
	min-height: 148px;
	max-height: 220px;
}

.correction-assistant-panel .ai-editor {
	min-height: 0;
}

.correction-assistant-panel .ai-editor-textarea {
	max-height: 190px;
}

.playlist-history-card {
	width: 100%;
	margin-inline: 0;
}

/* The application rail consumes 286px before the correction workspace gets
   any room. A 1,156px table plus a usable assistant column needs roughly
   1,656px of post-rail space, so keep the workspace stacked until the browser
   is genuinely wide enough for both working surfaces. */
@media (max-width: 1799px) {
	.correction-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.correction-playlist-table {
		min-width: 1156px;
	}
	.correction-playlist-table th:nth-child(7),
	.correction-playlist-table td:nth-child(7) {
		width: 176px;
		min-width: 176px;
	}
	.correction-playlist-table th:nth-child(8),
	.correction-playlist-table td:nth-child(8) {
		width: 176px;
		min-width: 176px;
	}
	.correction-playlist-table th:nth-child(9),
	.correction-playlist-table td:nth-child(9) {
		width: 84px;
	}
}

@media (max-width: 900px) {
	.correction-workspace {
		width: 100%;
		padding: 16px;
	}
	.correction-grid {
		grid-template-columns: minmax(0, 1fr);
		align-items: stretch;
	}
	.correction-playlist-panel,
	.correction-assistant-panel {
		order: initial;
	}
	.correction-assistant-panel .chat-messages {
		min-height: 136px;
		max-height: 200px;
	}
}

@media (max-width: 560px) {
	.correction-workspace {
		width: 100%;
		margin-inline: 0;
		padding: 12px;
	}
	.correction-grid {
		gap: 12px;
	}
	.correction-playlist-table {
		min-width: 1116px;
	}
	.correction-playlist-table th:nth-child(7),
	.correction-playlist-table td:nth-child(7) {
		width: 168px;
		min-width: 168px;
	}
	.correction-playlist-table th:nth-child(8),
	.correction-playlist-table td:nth-child(8) {
		width: 176px;
		min-width: 176px;
	}
	.correction-playlist-table th:nth-child(9),
	.correction-playlist-table td:nth-child(9) {
		width: 84px;
	}
	.correction-assistant-panel > .glass {
		min-height: 0;
	}
	.correction-recommendations-card,
	.correction-diff-card,
	.correction-assistant-panel .chat-messages,
	.correction-assistant-panel .ai-editor {
		min-height: 0;
	}
	.playlist-history-card {
		margin-top: 12px;
	}
}

/* Correction table spacing: preserve a comfortable working width instead of
   squeezing grouped loudness, transport, and row actions into the metadata
   columns. The scroll wrapper is the intentional narrow-window fallback. */
.correction-playlist-table-scroll {
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
}

.correction-playlist-table {
	min-width: 1580px;
	table-layout: fixed;
}

.correction-playlist-table th,
.correction-playlist-table td {
	padding: 13px 16px;
}

.correction-playlist-table th {
	line-height: 1.2;
}

/* #, title, artist, BPM, key, energy, loudness, listen, actions */
.correction-playlist-table th:nth-child(1),
.correction-playlist-table td:nth-child(1) {
	width: 64px;
}

.correction-playlist-table th:nth-child(2),
.correction-playlist-table td:nth-child(2) {
	width: 300px;
}

.correction-playlist-table th:nth-child(3),
.correction-playlist-table td:nth-child(3) {
	width: 260px;
}

.correction-playlist-table th:nth-child(4),
.correction-playlist-table td:nth-child(4) {
	width: 92px;
}

.correction-playlist-table th:nth-child(5),
.correction-playlist-table td:nth-child(5),
.correction-playlist-table th:nth-child(6),
.correction-playlist-table td:nth-child(6) {
	width: 110px;
	text-align: center;
}

.correction-playlist-table th:nth-child(7),
.correction-playlist-table td:nth-child(7) {
	width: 176px;
	min-width: 176px;
	text-align: left;
}

.correction-playlist-table td.pl-loudness {
	overflow: visible;
	white-space: normal;
}

.correction-playlist-table th:nth-child(8),
.correction-playlist-table td:nth-child(8) {
	width: 320px;
	min-width: 320px;
	text-align: left;
}

.correction-playlist-table th:nth-child(9),
.correction-playlist-table td:nth-child(9) {
	width: 148px;
	min-width: 148px;
	text-align: center;
}

.correction-playlist-table td:nth-child(8) .track-playback {
	width: 100%;
	max-width: none;
	min-width: 0;
}

.correction-row-actions {
	width: 148px;
	padding: 10px 14px !important;
}

.correction-action-group {
	justify-content: center;
	gap: 6px;
	padding: 6px;
}
