:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #f0ede7;
  --text: #1d1f24;
  --muted: #6a6f7a;
  --line: #e2ddd4;
  --accent: #e2622b;
  --accent-ink: #ffffff;
  --accent-soft: #fde9df;
  --ok: #2f8a57;
  --ok-soft: #e1f3e8;
  --warn: #9a6a00;
  --warn-soft: #fff3d1;
  --err: #b3261e;
  --err-soft: #fde4e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 6px 24px rgba(20, 20, 30, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --surface: #1e2128;
    --surface-2: #262a33;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #333844;
    --accent: #f07a45;
    --accent-soft: #3a2519;
    --ok: #5cc18a;
    --ok-soft: #1c3227;
    --warn: #e0b54a;
    --warn-soft: #362d14;
    --err: #ff8a80;
    --err-soft: #3b1f1d;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; }
h2 { font-size: 20px; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
header.top { border-bottom: 1px solid var(--line); background: var(--surface); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; display: flex; gap: 8px; align-items: center; }
.logo b { color: var(--accent); }
nav a { color: var(--muted); text-decoration: none; margin-left: 18px; font-size: 15px; }

.hero { padding: 40px 0 16px; }
.hero p { color: var(--muted); max-width: 640px; font-size: 18px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; padding: 0; list-style: none; }
.steps li { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-size: 14px; color: var(--muted); }

.grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; align-items: start; padding-bottom: 60px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.disabled { opacity: .5; pointer-events: none; }
.card h2 { display: flex; align-items: center; gap: 10px; }
.num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 14px; flex: none; }

.drop {
  display: block;
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; }
.drop strong { display: block; font-size: 17px; margin-bottom: 4px; }

#viewer { width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; background: var(--surface-2); margin-top: 14px; display: none; touch-action: none; }
#viewer.on { display: block; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); margin-top: 10px; }
.facts b { color: var(--text); font-weight: 600; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; align-items: flex-start; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 4px; accent-color: var(--accent); }
.choice small { display: block; color: var(--muted); }

.colors { display: flex; flex-wrap: wrap; gap: 6px; }
.colors label { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 14px; }
.colors label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.colors input { display: none; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.big { width: 100%; padding: 16px; font-size: 18px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small { padding: 6px 10px; font-size: 14px; font-weight: 500; }

#map { height: 300px; border-radius: 10px; margin: 10px 0; z-index: 0; }
.points { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.point { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.point:last-child { border-bottom: 0; }
.point:hover { background: var(--surface-2); }
.point.sel { background: var(--accent-soft); }
.point b { display: block; font-size: 15px; }

.summary { position: sticky; top: 16px; }
.lines { width: 100%; border-collapse: collapse; font-size: 15px; }
.lines td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.lines td:last-child { text-align: right; white-space: nowrap; }
.lines tr.total td { border-bottom: 0; font-size: 20px; font-weight: 700; padding-top: 12px; }
.date { background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-weight: 600; }

.note { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.err { background: var(--err-soft); color: var(--err); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.info { background: var(--surface-2); color: var(--muted); }

.check { display: flex; gap: 10px; font-size: 14px; color: var(--muted); margin: 12px 0; align-items: flex-start; }
.check input { margin-top: 3px; accent-color: var(--accent); }

.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Страница заказа */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 30px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.timeline li::after { content: ""; position: absolute; left: 12px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--text); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.now { color: var(--text); font-weight: 600; }
.timeline li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .5s; }
.camera { width: 100%; border-radius: 10px; background: #111; aspect-ratio: 16 / 9; object-fit: contain; display: block; }

/* Админка */
.printers { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.printers .card { margin-bottom: 0; }
.printers + .card { margin-top: 20px; }
.loaded { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.state { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 15px; }
.state::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.state.ready { background: var(--ok-soft); color: var(--ok); }
.state.printing { background: var(--accent-soft); color: var(--accent); }
.state.needs_clearing, .state.paused { background: var(--warn-soft); color: var(--warn); }
.free-btn { font-size: 20px; padding: 18px; width: 100%; margin-top: 14px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.queued { background: var(--accent-soft); color: var(--accent); }
.badge.printing { background: var(--accent); color: var(--accent-ink); }
.badge.printed { background: var(--warn-soft); color: var(--warn); }
.badge.shipped, .badge.delivered { background: var(--ok-soft); color: var(--ok); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
footer a { color: var(--muted); }
.doc { max-width: 760px; padding: 32px 16px 60px; }
.doc h2 { margin-top: 28px; }
