:root {
  --bg: #1a1b1e; --panel: #212226; --panel-2: #26272c; --border: #33353b;
  --text: #d9dbe0; --muted: #8a8e98; --accent: #4f8cf0; --accent-dim: rgba(79,140,240,.16);
  --ok: #5fb97a; --bad: #e06c6c;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: grid; grid-template-rows: 44px 1fr 190px; background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); overflow: hidden; }
button { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 5px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: #4a4d55; background: #2c2d33; }
button:focus-visible, .dropzone:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: #6199f3; border-color: #6199f3; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--border); }
.brand { font-weight: 600; letter-spacing: .2px; }
.tag { margin-left: 10px; color: var(--muted); font-weight: 400; font-size: 12px; }
.actions { display: flex; gap: 8px; }

.workspace { display: grid; grid-template-columns: 300px 1fr; min-height: 0; }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--border); }
.panel-title { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); border-bottom: 1px solid var(--border); }
.badge { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 7px; color: var(--text); }
.dropzone { margin: 10px; padding: 16px 10px; text-align: center; border: 1px dashed #494c54; border-radius: 6px; color: var(--muted); cursor: pointer; }
.dropzone small { display: block; margin-top: 4px; font-size: 11px; opacity: .8; }
.dropzone:hover, body.dragging-files .dropzone { border-color: var(--accent); color: var(--text); background: var(--accent-dim); }

.messages { padding: 0 10px; }
.msg { position: relative; margin-bottom: 6px; padding: 7px 24px 7px 9px; border: 1px solid var(--border); border-left: 3px solid var(--bad); border-radius: 4px; background: var(--panel-2); font-size: 12px; }
.msg b { display: block; word-break: break-all; }
.msg span { color: var(--muted); }
.msg .x { position: absolute; top: 2px; right: 2px; border: 0; background: none; padding: 2px 6px; color: var(--muted); }

.uv-list { flex: 1; overflow-y: auto; margin: 0; padding: 4px 10px; list-style: none; }
.uv-item { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 6px; margin-bottom: 3px; border: 1px solid transparent; border-radius: 4px; background: var(--panel-2); cursor: pointer; }
.uv-item:hover { border-color: var(--border); }
.uv-item.selected { border-color: var(--accent); background: var(--accent-dim); }
.uv-item.dragging { opacity: .4; }
.uv-item.drop-before::before, .uv-item.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); }
.uv-item.drop-before::before { top: -3px; } .uv-item.drop-after::after { bottom: -3px; }
.grip { color: #5b5e67; cursor: grab; letter-spacing: -2px; }
.idx { min-width: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dim { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.remove { border: 0; background: none; padding: 2px 6px; color: var(--muted); }
.remove:hover { color: var(--bad) !important; background: none !important; }
.info { padding: 8px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--border); }
.toolbar button { padding: 3px 10px; }
.zoom-label { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.hint { margin-left: auto; color: var(--muted); font-size: 11px; }
.viewport { position: relative; flex: 1; display: flex; overflow: auto; padding: 24px; background: #141518; cursor: grab; }
.viewport.panning { cursor: grabbing; user-select: none; }
.stage { position: relative; flex: none; margin: auto; box-shadow: 0 0 0 1px var(--border);
  background: conic-gradient(#2b2c31 25%, #222328 0 50%, #2b2c31 0 75%, #222328 0) 0 0 / 16px 16px; }
.stage canvas { display: block; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.section { position: absolute; top: 0; bottom: 0; border-right: 1px solid rgba(255,255,255,.28); overflow: hidden; }
.section:last-child { border-right: 0; }
.section .label { position: absolute; top: 0; left: 0; max-width: 100%; padding: 2px 8px; background: rgba(20,21,24,.82); color: var(--text); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overlay.has-selection .section:not(.selected) { background: rgba(0,0,0,.45); }
.section.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.section.selected .label { background: var(--accent); color: #fff; }
.empty { margin: auto; color: var(--muted); }
.statusbar { padding: 5px 12px; background: var(--panel); border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.tests { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-top: 1px solid var(--border); }
.test-actions { display: flex; gap: 8px; text-transform: none; letter-spacing: 0; }
.test-actions button { padding: 2px 10px; }
.report { flex: 1; overflow: auto; padding: 8px 14px; font-size: 12px; color: var(--muted); }
.report h4 { margin: 8px 0 3px; font-size: 12px; color: var(--text); }
.report .row { display: flex; gap: 8px; padding: 1px 0; color: var(--text); }
.report .mark { width: 14px; flex: none; font-weight: 700; }
.report .pass .mark { color: var(--ok); } .report .fail .mark { color: var(--bad); }
.report .detail { color: var(--muted); }
.report .summary { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); font-weight: 600; }

/* dropdown menus (shared) */
.menu { position: relative; }
.menu-list { position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; min-width: 300px; padding: 4px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.menu-list.right { left: auto; right: 0; }
.menu-list[hidden] { display: none; }
.menu-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 4px; }
.menu-list button:hover:not(:disabled) { background: var(--accent-dim) !important; }
.menu-list small { display: block; color: var(--muted); font-size: 11px; }
