/* zds-nest-web — tool UI. Dark print-shop theme, system font stack. */

:root {
  --bg: #0e1116;
  --bg2: #141922;
  --panel: #1a2029;
  --line: #2a323f;
  --text: #e6e9ee;
  --muted: #93a0b3;
  --accent: #ffb454;
  --accent-ink: #1c1407;
  --ok: #58d68d;
  --warn: #ffcf6b;
  --err: #ff6b6b;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2 { margin: 0; font-weight: 650; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }

/* ── Top bar ─────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #ff8f3f);
  color: var(--accent-ink);
  font-weight: 800; font-size: 20px;
}
.brand h1 { font-size: 17px; }
.tag { margin: 0; font-size: 12px; color: var(--muted); }
.privacy-note {
  font-size: 12px; color: var(--ok);
  border: 1px solid rgba(88, 214, 141, .35);
  padding: 5px 10px; border-radius: 999px;
}

/* ── Layout ──────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 18px 20px;
  max-width: 1600px;
  margin: 0 auto;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

.panel { display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

/* ── Upload ──────────────────────────────────────── */
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: rgba(255, 180, 84, .06);
}
.dropzone p { margin: 2px 0; }
.hint { font-size: 12px; color: var(--muted); }

.piece-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.piece-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
}
.piece-thumb {
  width: 40px; height: 40px;
  border-radius: 6px;
  background: repeating-conic-gradient(#20262f 0 25%, #191f28 0 50%) 0 0 / 12px 12px;
  object-fit: contain;
}
.piece-info { flex: 1; min-width: 0; }
.piece-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.piece-meta { font-size: 11px; color: var(--muted); }
.piece-size { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; }
.piece-size input {
  width: 64px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 3px 6px;
  font: 12px var(--mono);
}
.piece-remove {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; padding: 4px;
}
.piece-remove:hover { color: var(--err); }

/* ── Form controls ──────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field > span { font-size: 12px; color: var(--muted); }
.field b { color: var(--accent); font-family: var(--mono); font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.range-labels i { font-style: normal; }

select, input[type="number"], input[type="text"] {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 13px;
  width: 100%;
}
select:focus, input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.preset {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 4px;
  font-size: 12px;
  cursor: pointer;
}
.preset.active { border-color: var(--accent); color: var(--accent); background: rgba(255, 180, 84, .08); }

/* ── Buttons ────────────────────────────────────── */
.primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #ff8f3f);
  color: var(--accent-ink);
  border: none;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 700;
  padding: 13px;
  cursor: pointer;
}
.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary:not(:disabled):hover { filter: brightness(1.06); }

.stale-note { margin: 6px 0 0; font-size: 12px; color: var(--warn); text-align: center; }

.export { display: flex; flex-direction: column; gap: 8px; }
.export-btn {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 9px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.export-btn:hover { border-color: var(--ok); color: var(--ok); }

/* ── Stage ──────────────────────────────────────── */
.stage { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  color: var(--muted);
  min-height: 42px;
}
.statusbar.error { color: var(--err); border-color: rgba(255,107,107,.4); }
.statusbar.ok { color: var(--ok); border-color: rgba(88,214,141,.35); }

.progress { display: flex; align-items: center; gap: 8px; }
.bar { width: 120px; height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; display: inline-block; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.sheet-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); padding: 0 4px; }
.sheet-meta b { color: var(--text); font-family: var(--mono); font-weight: 600; }

.canvas-wrap {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  place-items: center;
  min-height: 320px;
  overflow: auto;
  max-height: calc(100vh - 150px);
}
#preview {
  max-width: 100%;
  max-height: calc(100vh - 190px);
  image-rendering: auto;
  background: repeating-conic-gradient(#1c222b 0 25%, #161b23 0 50%) 0 0 / 24px 24px;
}
.empty-state { text-align: center; color: var(--muted); }
.empty-state p { margin: 4px 0; }

.footer {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 16px;
  border-top: 1px solid var(--line);
}
