@font-face {
  font-family: "Inter";
  src: url("fonts/InterVariable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: block;
}

:root {
  --bg: #0b0e10;
  --panel: #14181b;
  --card: #1a1f23;
  --line: #2a3238;
  --line-soft: #222a30;
  --text: #eef3f6;
  --muted: #8b979e;
  --accent: #89c6d2;
  --accent-ink: #08222a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

.top {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: #090c0e;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}
.mark {
  width: 16px; height: 16px;
  border-radius: 5px;
  background: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(8,34,42,.55);
}
.tag { margin: 0; color: var(--muted); font-size: 12px; }

.shell {
  display: grid;
  grid-template-columns: 358px minmax(0, 1fr);
  min-height: calc(100dvh - 49px);
}

.panel.form {
  border-right: 1px solid var(--line-soft);
  padding: 4px 16px 28px;
  overflow: auto;
  max-height: calc(100dvh - 49px);
}

.group { padding: 14px 0 4px; border-bottom: 1px solid var(--line-soft); }
.group:last-child { border-bottom: 0; }
.group h2 {
  margin: 0 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.field { display: block; margin: 0 0 9px; }
.field > span {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
input[type="text"], input:not([type]), select, textarea {
  width: 100%;
  padding: 7px 9px;
  background: #0e1214;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
textarea { resize: vertical; min-height: 62px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #4a97a8;
  box-shadow: 0 0 0 2px rgba(137,198,210,.14);
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row.tight { gap: 8px; align-items: start; }
.row > .field { margin-bottom: 9px; }

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0 8px;
  font-size: 12px;
  color: #c6d2d8;
  cursor: pointer;
}
.check input { accent-color: #4a97a8; width: 14px; height: 14px; margin: 0; }

.photo-row { display: flex; gap: 12px; align-items: flex-start; }
.thumb {
  width: 62px; height: 80px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: #0e1214 center/cover no-repeat;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.thumb span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.photo-actions .check { margin: 2px 0 0; width: 100%; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #1b2125;
  color: var(--text);
  border-radius: 9px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: #212a2f; border-color: #3a464d; }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  width: 100%;
  padding: 11px 12px;
  font-weight: 750;
  font-size: 13px;
}
.btn.primary:hover { background: #9ad4df; }
.btn.ghost { background: transparent; color: #b9c6cc; }

.actions .row.tight .btn { width: 100%; }
.actions .row.tight .field > span:empty { display: none; }

.hint { margin: 8px 0 0; font-size: 11px; line-height: 1.45; color: var(--muted); }
.hint.center { text-align: center; }
#status.ok { color: #6ee7a8; }
#status.err { color: #ff8f8f; }

.stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 24px 24px;
  min-width: 0;
  background:
    radial-gradient(1200px 500px at 60% -10%, #172027, var(--bg) 65%);
}
.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.stage-bar .dim { opacity: .55; letter-spacing: .04em; font-weight: 600; }
.canvas-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}
#card {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  border-radius: 18px;
  box-shadow:
    0 26px 60px -18px rgba(0,0,0,.75),
    0 0 0 1px rgba(255,255,255,.06);
  background: #0e1417;
}

#print-area { display: none; }

body.dropping .canvas-wrap { outline: 2px dashed var(--accent); outline-offset: 10px; border-radius: 22px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .panel.form {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    max-height: none;
    order: 2;
  }
  .stage { order: 1; padding: 14px 14px 4px; }
  .canvas-wrap { flex: 0 0 auto; }
  #card { max-width: 100%; }
}

@media print {
  @page { size: 85.6mm 54mm; margin: 0; }
  html, body { background: #fff; }
  .top, .panel.form, .stage-bar, .hint, #card { display: none !important; }
  .shell { display: block; min-height: 0; }
  .stage { padding: 0; background: none; }
  .canvas-wrap { display: block; }
  #print-area { display: block !important; }
  #print-img { display: block; width: 85.6mm; height: 54mm; }
}
