:root {
  --bg: #faf7f2; --card: #fff; --ink: #1f1d1a; --muted: #6b665e; --line: #e6e0d6;
  --accent: #c8102e; --accent-ink: #fff; --ok: #2f7d4f; --warn: #b7791f; --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
header.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--card); }
header.top .brand { font-weight: 700; text-decoration: none; color: var(--ink); }
main { max-width: 1100px; margin: 0 auto; padding: 24px; }
h1 { font-size: 28px; margin: 0 0 6px; } h2 { font-size: 20px; margin: 28px 0 10px; }
.muted { color: var(--muted); } .small { font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } main { padding: 14px; } }
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; }
input[type=text], input[type=tel], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
button, .btn { display: inline-block; border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.small, .btn.small { padding: 6px 10px; font-size: 14px; }
button:disabled { opacity: .5; cursor: default; }
.err { color: var(--accent); font-weight: 600; } .ok { color: var(--ok); }
.hp { position: absolute; left: -9999px; }

/* редактор */
.editor { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .editor { grid-template-columns: 1fr; } }
.ed-crop { width: 100%; aspect-ratio: 1; border-radius: 12px; touch-action: none; cursor: grab; background: #1b1b1f; display: block; }
.ed-crop:active { cursor: grabbing; }
.previews { display: flex; gap: 14px; flex-wrap: wrap; }
.previews figure { margin: 0; text-align: center; }
.previews canvas { width: 180px; height: 180px; border-radius: 50%; display: block; }
.ed-light { background: #111; box-shadow: 0 0 24px rgba(255,160,70,.35); }
.ed-white { background: #ddd; }
.previews figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.controls { display: grid; gap: 8px; margin-top: 12px; }
.controls .row { display: flex; align-items: center; gap: 10px; }
.controls .row span:first-child { width: 90px; font-size: 14px; }
.controls input[type=range] { flex: 1; }
.nudge { display: flex; gap: 6px; flex-wrap: wrap; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 30px; text-align: center; cursor: pointer; background: #fff; }
.dropzone.over { border-color: var(--accent); }

/* статусы */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #eee; white-space: nowrap; }
.st-new { background: #e7eefc; color: #234a9b; } .st-sketch_ready { background: #fdf1d8; color: #7a5200; }
.st-awaiting_print { background: #f3e6fb; color: #6a2c8f; } .st-printed { background: #e2f4ea; color: #1f6b41; }
.st-shipped { background: #e9e9e9; color: #333; } .st-cancelled { background: #f6e1e1; color: #8a1c1c; }
.steps { display: flex; gap: 0; margin: 14px 0; flex-wrap: wrap; }
.steps div { flex: 1; min-width: 110px; padding: 10px 8px; border-top: 4px solid var(--line); font-size: 14px; color: var(--muted); }
.steps div.done { border-color: var(--ok); color: var(--ink); } .steps div.cur { border-color: var(--accent); color: var(--ink); font-weight: 700; }
.events { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.events li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.sketch-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }

/* менеджер */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { background: #f3efe8; font-weight: 600; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: #fcfaf6; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 14px; }
.tabs a.on { background: var(--ink); color: #fff; }
.printer { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #bbb; margin-right: 6px; }
.dot.on { background: var(--ok); } .dot.busy { background: var(--warn); }
.progress { height: 8px; background: #eee; border-radius: 999px; overflow: hidden; width: 220px; }
.progress div { height: 100%; background: var(--accent); }
pre.log { white-space: pre-wrap; background: #1b1b1f; color: #ddd; padding: 10px; border-radius: 8px; font-size: 12px; max-height: 240px; overflow: auto; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 8px; background: #fff; cursor: pointer; margin: 0; font-weight: 500; }
.swatch input { display: none; }
.swatch span { width: 22px; height: 22px; border-radius: 50%; display: inline-block; }
.swatch:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: -1px; }
