:root {
  --bg: #0f1012;
  --bg2: #17181b;
  --card: #1d1f23;
  --line: #2c2f35;
  --text: #ececec;
  --muted: #a3a7ae;
  --accent: #ff5a1f;
  --accent2: #17b072;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); display: flex; flex-direction: column;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }

.bar { display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: var(--bg); flex: none; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -.5px; color: var(--text); }
.logo span { color: var(--accent); }
.tag { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.spacer { flex: 1; }
.back { color: var(--muted); font-size: 14px; }

.app { flex: 1; display: grid; grid-template-columns: 320px 1fr; min-height: 0; }
.panel { border-right: 1px solid var(--line); background: var(--bg2); overflow-y: auto; padding: 16px; }
.panel section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.panel section:first-child { padding-top: 0; }
.panel section:last-child { border-bottom: 0; }
.panel h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; }

.drop { display: block; border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px 14px; text-align: center;
  cursor: pointer; background: var(--card); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: #24211f; }
.drop input { display: none; }
.drop strong { display: block; margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: 13px; }
.status { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 1em; overflow-wrap: anywhere; }
.status.err { color: #ff8a80; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.swatches button, .swatches .custom { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--c); cursor: pointer; padding: 0; position: relative; }
.swatches button.on, .swatches .custom.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--bg2), 0 0 0 4px var(--accent); }
.swatches .custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); overflow: hidden; }
.swatches .custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); cursor: pointer; }
.pages { margin-top: 10px; }
select { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font: inherit; }
.row { display: flex; gap: 14px; margin-bottom: 12px; }
.row label { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; }

.layers { list-style: none; margin: 0; padding: 0; }
.layers li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.layers li:hover { background: var(--card); }
.layers li.on { background: var(--card); outline: 1px solid var(--accent); }
.layers li.empty { color: var(--muted); cursor: default; }
.layers li.empty:hover { background: none; }
.layers li.group { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; cursor: default; padding-top: 12px; }
.layers li.group:hover { background: none; }
.layers .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(255,255,255,.25); flex: none; }
.layers .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers .pct { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.layers .pct.hot { color: #ff8a80; }

.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; padding: 9px 16px; border-radius: 10px;
  font: 600 14px/1.2 inherit; font-family: inherit; cursor: pointer; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.active { background: #fff; color: #111; }

.info { font-size: 13px; color: var(--muted); }
.info .warn { color: #ffcc80; }
.info ul { margin: 6px 0 0; padding-left: 18px; }

.stage { position: relative; min-width: 0; min-height: 0; background: #0a0a0b; }
#viewer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
#viewer.picking { cursor: crosshair; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 24px; pointer-events: none; }
.overlay div { max-width: 420px; }
.overlay h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.3px; }
.overlay p { margin: 0; color: var(--muted); }
.pickhint, .busy { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(20,21,24,.92);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.pickhint { border-color: var(--accent); }
.busy span { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

.modes { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.modes button { background: none; border: 0; color: var(--muted); font: 600 14px/1.2 inherit; font-family: inherit; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.modes button.on { background: var(--accent); color: #fff; }
body.proofing .screen-only, body:not(.proofing) .proof-only { display: none !important; }
.proofset { display: grid; gap: 8px; margin-top: 4px; }
.proofset label { font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.proofset select { width: 100%; }
.readout { position: absolute; left: 14px; bottom: 14px; background: rgba(20,21,24,.94); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; pointer-events: none; min-width: 150px; font-variant-numeric: tabular-nums; }
.readout div { display: flex; justify-content: space-between; gap: 14px; }
.readout .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.readout .tot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; font-weight: 600; }
.readout .tot.over { color: #ff8a80; }
.note { flex: none; border-top: 1px solid var(--line); padding: 8px 18px; font-size: 12px; color: var(--muted); }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 60vh; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .stage { min-height: 60vh; }
}
