:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d7deea;
  --brand: #2457a6;
  --brand-dark: #153a73;
  --ok: #16803c;
  --warn: #c13a2d;
  --shadow: 0 22px 70px rgba(23, 32, 51, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #eef5ff, var(--bg) 46%, #f9fafb);
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12px;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.02;
}

h2 { margin-bottom: 14px; font-size: 18px; }

.lead {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
}

.status-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 10px 32px rgba(23, 32, 51, .07);
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: var(--warn); }

.order-panel,
.customer-summary,
.production-sheet,
.canvas-card,
.panel {
  border: 1px solid rgba(215, 222, 234, .9);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.order-panel,
.customer-summary,
.production-sheet {
  margin-bottom: 22px;
  padding: 18px;
  border-radius: 18px;
}

.order-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(240px, 1.4fr) minmax(120px, .7fr);
  gap: 14px;
  align-items: end;
}

.field-line,
.variant-field { display: grid; gap: 8px; margin: 0; }
.field-line span,
.variant-field legend { color: var(--text); font-weight: 800; }

select,
input[type="number"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.variant-field {
  grid-template-columns: 1fr 1fr;
  border: 0;
  padding: 0;
}
.variant-field legend { grid-column: 1 / -1; padding: 0; }

.radio-card {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.radio-card:has(input:checked) {
  border-color: var(--brand);
  background: rgba(36, 87, 166, .08);
  color: var(--brand-dark);
}

.order-alert,
.no-print-info,
.add-cart-message,
.summary-note {
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: 12px;
  line-height: 1.45;
}
.order-alert {
  border: 1px solid rgba(193, 58, 45, .25);
  color: var(--warn);
  background: rgba(193, 58, 45, .08);
  font-weight: 800;
}
.validation-message ul { margin: 0; padding-left: 18px; }
.validation-message li + li { margin-top: 4px; }
.no-print-info {
  border: 1px solid rgba(22, 128, 60, .22);
  color: var(--ok);
  background: rgba(22, 128, 60, .08);
}
.add-cart-message {
  border: 1px solid rgba(22, 128, 60, .24);
  background: rgba(22, 128, 60, .08);
  color: var(--ok);
  font-weight: 800;
}
.summary-note {
  background: rgba(36, 87, 166, .08);
  color: var(--brand-dark);
  font-weight: 800;
}
.field-error {
  border-color: var(--warn) !important;
  box-shadow: 0 0 0 3px rgba(193, 58, 45, .12);
}
.validation-highlight {
  outline: 3px solid var(--warn);
  outline-offset: 4px;
  border-radius: 12px;
  animation: validationPulse 1.2s ease-in-out 2;
}
@keyframes validationPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 8px rgba(193, 58, 45, .14); }
}

.designer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
}
.canvas-card,
.panel { border-radius: 24px; }
.canvas-card { overflow: hidden; }
.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .84);
}
.canvas-wrap { width: 100%; padding: 18px; overflow: auto; }
canvas {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  margin: 0 auto;
  border-radius: 18px;
  background: #ffffff;
  touch-action: none;
}
.hint { margin: 0; padding: 0 18px 18px; color: var(--muted); font-size: 14px; }
.panel { padding: 18px; }
.control-block { padding: 0 0 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.control-block:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }

.side-switch { display: grid; grid-template-columns: 1fr; gap: 10px; }
.side-tab {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
}
.side-tab.active {
  border-color: var(--brand);
  background: rgba(36, 87, 166, .08);
  color: var(--brand-dark);
}

.upload-box {
  display: block;
  cursor: pointer;
  padding: 18px;
  border: 2px dashed #b8c3d6;
  border-radius: 18px;
  background: #f9fbff;
  transition: border-color .2s ease, transform .2s ease;
}
.upload-box:hover { border-color: var(--brand); transform: translateY(-1px); }
.upload-title, .upload-subtitle { display: block; }
.upload-title { font-weight: 800; margin-bottom: 6px; }
.upload-subtitle, .file-meta { color: var(--muted); font-size: 14px; }
.file-meta { margin-top: 10px; line-height: 1.45; }
input[type="file"] { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }

label[for="scaleRange"],
label[for="rotationRange"] {
  display: flex;
  justify-content: space-between;
  margin: 14px 0 6px;
  font-weight: 700;
}
input[type="range"] { width: 100%; min-height: 34px; accent-color: var(--brand); }

button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  min-height: 44px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(23, 32, 51, .10); }
button:disabled { cursor: not-allowed; opacity: .48; }
.primary-button { width: 100%; border-color: var(--brand); background: var(--brand); color: #ffffff; }
.primary-button:hover:not(:disabled) { background: var(--brand-dark); }
.ghost-button { background: #f8fbff; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.compact-row { margin-top: 0; justify-content: flex-end; }
.checkbox-line { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; color: var(--muted); line-height: 1.45; }
.checkbox-line input { margin-top: 3px; accent-color: var(--brand); }
.add-cart-button { margin-top: 14px; min-height: 56px; font-size: 17px; }

.internal-export,
.internal-output {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed rgba(102, 112, 133, .38);
  border-radius: 12px;
  background: rgba(249, 251, 255, .72);
}
.internal-export strong { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.internal-export button { width: 100%; min-height: 40px; padding: 9px 11px; font-size: 13px; font-weight: 700; }
#downloadPreviewButton, #downloadJsonButton, #copyNoteButton, #downloadOrderJsonButton { width: 100%; margin-top: 10px; }
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: #fcfdff;
  resize: vertical;
}
.customer-summary { border-color: rgba(36, 87, 166, .22); background: #ffffff; }
.customer-summary p, .production-sheet p { margin: 7px 0; }

input[type="range"], button, .upload-box, .side-tab, .checkbox-line input { touch-action: manipulation; }

@media (max-width: 980px) {
  .hero { display: block; }
  .status-card { margin-top: 18px; }
  .designer-grid { grid-template-columns: 1fr; }
  .panel { order: -1; }
}

@media (max-width: 700px) {
  .app-shell { width: min(100% - 16px, 1240px); padding: 14px 0 28px; }
  .hero { margin-bottom: 14px; }
  h1 { font-size: 28px; line-height: 1.08; }
  h2 { font-size: 16px; }
  .lead { font-size: 15px; }
  .status-card { width: 100%; justify-content: flex-start; white-space: normal; border-radius: 14px; }
  .order-panel, .customer-summary, .production-sheet { margin-bottom: 14px; padding: 14px; border-radius: 16px; }
  .order-grid, .variant-field { grid-template-columns: 1fr; }
  select, input[type="number"], .radio-card { min-height: 52px; }
  .designer-grid { gap: 14px; }
  .canvas-card, .panel { border-radius: 16px; }
  .panel { order: -1; padding: 14px; }
  .control-block { margin-bottom: 14px; padding-bottom: 14px; }
  .side-switch { grid-template-columns: 1fr 1fr; gap: 8px; }
  .side-tab { min-height: 54px; padding: 12px 10px; text-align: center; }
  .upload-box { padding: 16px; }
  .canvas-toolbar { display: block; padding: 12px 14px; font-size: 14px; }
  .compact-row { justify-content: stretch; }
  .compact-row button { flex: 1 1 100%; }
  .canvas-wrap { padding: 10px; overflow: hidden; }
  canvas { max-width: 100%; border-radius: 14px; }
  .button-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
  button, .primary-button, #downloadPreviewButton, #downloadJsonButton, #copyNoteButton, #downloadOrderJsonButton { width: 100%; min-height: 50px; padding: 13px 14px; }
  input[type="range"] { min-height: 44px; }
  .hint { padding: 0 14px 14px; }
}

@media print {
  body { background: #ffffff; }
  .hero, .order-panel, .designer-grid, .customer-summary { display: none !important; }
  .app-shell { width: 100%; padding: 0; }
  .production-sheet { display: block !important; border: 0; box-shadow: none; padding: 0; }
}
