:root {
	--bg: #000000;
	--panel: #0e142c;
	--panel-2: #2c2f39;
	--border: #3a3d48;
	--text: #e6e6ea;
	--muted: #9a9ca6;
	--accent: #6d8dfa;
	--accent-2: #59c78a;
	--danger: #e8615c;
	--warn: #e8b25c;
	--radius: 8px;
}

* { box-sizing: border-box; }

body {
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	margin: 0;
	line-height: 1.45;
}

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

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

header.topbar .brand { font-weight: 600; font-size: 1.15rem; }
header.topbar nav a, header.topbar nav .muted { margin-left: 18px; color: var(--muted); text-decoration: none; font-size: 0.92rem; }
header.topbar nav a:hover { color: var(--text); }
header.topbar nav form { display: inline; margin-left: 18px; }

.lang-switch { margin-left: 18px; }
header.topbar nav .lang-switch a { margin-left: 4px; font-size: 0.82rem; font-weight: 600; }
header.topbar nav .lang-switch a:first-child { margin-left: 0; }
header.topbar nav .lang-switch a.active { color: var(--accent); }
header.topbar nav .lang-switch .muted { margin: 0 2px; }

.link-btn {
	background: none;
	border: none;
	padding: 0;
	color: var(--muted);
	font-size: 0.92rem;
	cursor: pointer;
	text-decoration: none;
	font-family: inherit;
}
.link-btn:hover { color: var(--text); }

main {
	max-width: 1400px;
	margin: 0 auto;
	padding: 24px;
}

.card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	margin-bottom: 20px;
}

h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.15rem; margin-top: 0; }

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

.btn {
	display: inline-block;
	background: var(--accent);
	color: #10121a;
	border: none;
	border-radius: var(--radius);
	padding: 10px 18px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); color: #1a0d0d; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.dropzone {
	border: 2px dashed var(--border);
	border-radius: var(--radius);
	padding: 40px 20px;
	text-align: center;
	color: var(--muted);
}
.dropzone.dragover { border-color: var(--accent); color: var(--text); }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.badge {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
}
.badge.uploaded { background: #3a3d48; color: var(--muted); }
.badge.queued { background: #4a4020; color: var(--warn); }
.badge.processing { background: #223a4d; color: #7ec7ff; }
.badge.done { background: #1e3a2c; color: var(--accent-2); }
.badge.error { background: #3a2020; color: var(--danger); }

.progress-outer {
	background: var(--panel-2);
	border-radius: 999px;
	overflow: hidden;
	height: 10px;
	width: 100%;
}
.progress-inner { background: var(--accent); height: 100%; transition: width 0.3s ease; }

fieldset {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin: 0 0 16px 0;
	padding: 14px 16px;
}
legend { padding: 0 6px; color: var(--muted); font-weight: 600; font-size: 0.88rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 20px; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 0.92rem; }
label.inline input[type=checkbox] { width: auto; margin: 0; }

input[type=text], input[type=number], select {
	width: 100%;
	background: var(--panel-2);
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: 6px;
	padding: 7px 9px;
	font-size: 0.92rem;
}
input[type=range] { width: 100%; }
input[type=color] { width: 42px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; }

.color-row {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 6px 8px;
	margin-bottom: 6px;
}
.color-row .ch-input { width: 50px; }
.color-row button { flex-shrink: 0; }

#previewWrap { position: relative; display: inline-block; max-width: 100%; }
#previewCanvas { display: block; border-radius: 2px; cursor: default; }
#previewCanvas.pick-mode { cursor: crosshair; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.pipette-btn.active, .btn.secondary.active { background: var(--accent); color: #10121a; border-color: var(--accent); }

.canvas-scroll {
	overflow: auto;
	max-height: 75vh;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #000;
	padding: 6px;
}
.canvas-scroll.panning, .canvas-scroll.panning canvas { cursor: grabbing !important; }

#pianoRoll { display: block; }
.note-toolbar-gap { height: 8px; }

.color-row { transition: outline 0.15s ease, box-shadow 0.15s ease; outline: 2px solid transparent; }
.color-row.match-frame { outline: 2px solid var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.color-row.match-hover { outline: 2px solid var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

.pipette-popover {
	position: fixed;
	z-index: 1000;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 10px;
	box-shadow: 0 8px 24px rgba(0,0,0,0.5);
	max-width: 260px;
}
.pipette-popover .ppv-title { font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }
.pipette-popover .ppv-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pipette-popover .ppv-swatch {
	width: 26px; height: 26px; border-radius: 5px; border: 2px solid var(--border);
	cursor: pointer; padding: 0;
}
.pipette-popover .ppv-swatch:hover { border-color: var(--accent); }
.pipette-popover .ppv-current { width: 26px; height: 26px; border-radius: 5px; border: 1px solid var(--border); display: inline-block; vertical-align: middle; margin-right: 6px; }

.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2000;
}
.modal-box {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	max-width: 380px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.modal-title { margin-bottom: 16px; font-size: 0.95rem; line-height: 1.4; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.error { background: #3a2020; color: #ffb3ae; }
.flash.info { background: #223a4d; color: #bfe4ff; }
