:root {
  --blue: #123d6b;
  --blue-dark: #0b2848;
  --gold: #caa85e;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --soft: #f7f9fc;
  --text: #253044;
  --muted: #68758a;
  --danger: #c93838;
  --ok: #16844a;
  --line: #dbe3ed;
  --shadow: 0 10px 30px rgba(24, 48, 80, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Poppins, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.site-head {
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
  color: #fff;
  padding: 18px 24px;
}
.site-head .inner {
  width: min(1080px, 100%);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-head a { color: #fff; }
.brand { color: #fff; text-decoration: none; font-size: 22px; font-weight: 700; }

.shell { width: min(1080px, 100%); margin: 28px auto; padding: 0 18px; }
.card-panel {
  margin-bottom: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.form-card { padding: 30px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(25px, 4vw, 31px); }
.hero p { margin: 0; color: var(--muted); }
h1, h2, h3 { line-height: 1.25; }
h2 { margin-top: 0; }

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.step {
  min-height: 90px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f8fbfe);
  font-size: 13px;
}
.step b { display: block; margin-bottom: 5px; color: var(--blue); }
.step span { color: var(--muted); }

fieldset { margin: 0 0 32px; padding: 0; border: 0; }
legend {
  width: 100%;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #edf1f6;
  color: var(--blue);
  font-size: 19px;
  font-weight: 700;
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 18px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
label { display: block; margin-bottom: 7px; font-weight: 600; }
.required::after { content: " *"; color: var(--danger); }
.hint, .muted { color: var(--muted); }
.hint { margin-top: 6px; font-size: 12px; }
.small { font-size: 12px; }

input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="tel"], input[type="month"], input[type="datetime-local"], select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #cbd6e2;
  border-radius: 10px;
  background: #fbfcfe;
  color: inherit;
  font: inherit;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: #3979b9;
  box-shadow: 0 0 0 3px rgba(57, 121, 185, 0.13);
}
input:disabled, select:disabled, textarea:disabled { background: #edf1f5; color: #7b8796; }

.choice-row { display: grid; gap: 12px; }
.choice-row-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice {
  display: flex;
  min-width: 0;
  min-height: 104px;
  align-items: flex-start;
  gap: 11px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.choice:hover { border-color: #9eb6cf; box-shadow: 0 7px 18px rgba(24, 48, 80, 0.07); }
.choice:has(input:checked) { border-color: var(--blue); background: #f1f7fd; box-shadow: inset 0 0 0 1px var(--blue); }
.choice input { flex: 0 0 auto; margin: 4px 0 0; }
.choice span { min-width: 0; }
.choice strong { display: block; margin-bottom: 4px; color: var(--blue); }
.choice small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.inline-check { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-weight: 400; }
.inline-check input { margin: 0; }

.hidden, .hidden-file { display: none !important; }
.photo-box {
  padding: 20px;
  border: 1px dashed #aec0d3;
  border-radius: 14px;
  background: var(--soft);
}

.photo-source-requirement {
  display: grid;
  gap: 4px;
  margin: 13px 0 2px;
  padding: 12px 14px;
  border: 1px solid #c8d8e8;
  border-radius: 10px;
  background: #eef6fd;
}
.photo-source-requirement strong { color: var(--blue); }
.photo-source-requirement span { color: var(--muted); font-size: 12px; }
.source-photo-info {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: #eaf7ef;
  color: #126c3d;
  font-size: 13px;
  font-weight: 600;
}
.source-photo-info.warning { background: #fff7df; color: #805a00; }
.source-photo-info.invalid { background: #fff0f0; color: #a22020; }
.field input.is-invalid { border-color: var(--danger); background: #fff8f8; }
.field input.is-valid { border-color: #69a985; background: #fbfffc; }
.hint.is-error { color: var(--danger); font-weight: 600; }

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 10px 0 0;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
}
#artworkPicker { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.prepared-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.prepared-photo {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.prepared-photo img { grid-row: 1 / 3; width: 82px; height: 110px; object-fit: cover; border-radius: 8px; background: #e9eef4; }
.prepared-photo small { color: var(--blue); font-weight: 700; }
.prepared-photo span { color: var(--muted); font-size: 12px; }
.photo-ready { margin-top: 12px; color: var(--ok); font-weight: 600; }

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.62; cursor: wait; }
.btn.secondary { background: #607087; }
.btn.success { background: var(--ok); }
.btn.danger { background: var(--danger); }
.btn.wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.upload-progress { margin: 18px 0; padding: 15px; border: 1px solid #bed1e4; border-radius: 12px; background: #f2f8fe; }
.progress-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 9px; }
.progress-track { height: 12px; overflow: hidden; border-radius: 999px; background: #dfe7f0; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #286aa7, #37a16a); transition: width 0.2s ease; }

.status, .badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf2fa;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.summary > div { min-height: 76px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.summary small { display: block; margin-bottom: 4px; color: var(--muted); }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.preview-frame { min-width: 0; overflow: auto; padding: 14px; border-radius: 14px; background: #eef2f7; text-align: center; }
.preview-frame img, .preview-frame canvas { display: block; max-width: 100%; height: auto; margin: auto; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); }
.preview-frame .btn { margin-top: 10px; }
.nametag-frame { grid-column: 1 / -1; }
.nametag-frame img, .nametag-frame canvas { max-height: 650px; }
.lock-note, .batch-countdown {
  padding: 14px;
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  background: #fff8e8;
}
.batch-countdown { display: flex; gap: 12px; align-items: flex-start; border: 1px solid #c7d9eb; border-left: 5px solid var(--blue); background: #f2f8fe; }
.batch-countdown b { color: var(--blue); }
.error-list { margin: 14px 0; padding: 13px; border-radius: 10px; background: #fff0f0; color: #a22020; }
.success-code { padding: 16px; border: 2px dashed #8eb7da; border-radius: 12px; background: #edf5fc; color: var(--blue); text-align: center; font-size: clamp(24px, 5vw, 34px); font-weight: 700; letter-spacing: 2px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.flash { width: min(980px, calc(100% - 32px)); margin: 18px auto 0; padding: 13px 16px; border-radius: 10px; }
.flash-success { background: #e8f7ef; color: #126c3d; }
.flash-error { background: #fff0f0; color: #a22020; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 16, 30, 0.84);
}
.modal.open { display: flex; }
.modal-card { width: min(920px, 100%); max-height: 96vh; overflow: auto; padding: 22px; border-radius: 16px; background: #fff; }
.crop-modal-card { text-align: center; }
.crop-heading h2 { margin: 5px 0 8px; }
.crop-step { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: #e8f1fa; color: var(--blue); font-size: 12px; font-weight: 700; }
.crop-instruction { margin: 0 auto; max-width: 690px; }
.crop-stage {
  position: relative;
  width: 342px;
  height: 552px;
  max-width: 86vw;
  max-height: 65vh;
  margin: 18px auto 0;
  overflow: hidden;
  border: 3px solid #28a745;
  background: #e9e9e9;
  box-sizing: border-box;
}
.crop-stage.tag-mode { width: 330px; height: 522px; }
.crop-stage img#cropImage { display: block; max-width: 100%; }
.crop-stage .cropper-container { z-index: 10; }
.crop-guide-image {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 20;
  width: 90%;
  height: 94%;
  transform: translate(-50%, -50%);
  object-fit: fill;
  pointer-events: none;
}
.nametag-guide { display: none; position: absolute; inset: 4% 6%; z-index: 20; pointer-events: none; }
.nametag-guide.active { display: block; }
.nametag-guide::before { content: ""; position: absolute; inset: 0; border: 2px dashed rgba(218, 36, 36, 0.95); border-radius: 14px; }
.face-guide { position: absolute; top: 8%; left: 50%; width: 35%; aspect-ratio: 0.82; transform: translateX(-50%); border: 2px solid rgba(218, 36, 36, 0.85); border-radius: 50%; }
.body-guide { position: absolute; left: 13%; right: 13%; bottom: 8%; height: 54%; border: 2px solid rgba(218, 36, 36, 0.85); border-radius: 50% 50% 14% 14%; }
.modal-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

@media (max-width: 820px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-choices { grid-template-columns: 1fr; }
  .choice { min-height: 0; }
}

@media (max-width: 620px) {
  .site-head .inner { align-items: flex-start; flex-direction: column; }
  .shell { margin-top: 18px; padding: 0 12px; }
  .card-panel, .form-card { padding: 19px; border-radius: 14px; }
  .grid, .preview-grid, .steps, .choice-row-two, .prepared-photos { grid-template-columns: 1fr; }
  .nametag-frame, .field.full { grid-column: auto; }
  .prepared-photo { grid-template-columns: 72px minmax(0, 1fr); }
  .prepared-photo img { width: 72px; height: 96px; }
  .crop-stage { width: 304px; height: 491px; }
  .crop-stage.tag-mode { width: 286px; height: 452px; }
  .modal-card { padding: 16px 12px; }
  .modal-controls .btn { flex: 1 1 125px; }
}

.batch-deadline-banner {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid #f3d58a;
  border-radius: 14px;
  background: #fff8e6;
}
.batch-deadline-banner strong { color: #8a5a00; font-size: 17px; }
.batch-deadline-banner span { color: #6f5a2d; font-size: 13px; }

.agent-approval-callout,
.agent-change-callout,
.agent-confirmed-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-width: 2px;
}
.agent-approval-callout { border-color: #e2b643; background: #fff8df; }
.agent-change-callout { display: block; border-color: #d7a6a6; background: #fff3f3; }
.agent-confirmed-callout { display: block; border-color: #9bcdb1; background: #eefaf3; }
.agent-approval-callout h2,
.agent-change-callout h2,
.agent-confirmed-callout h2 { margin: 4px 0 6px; }
.agent-approval-callout p,
.agent-change-callout p,
.agent-confirmed-callout p { margin: 0; }
.action-label { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #8b5a00; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.agent-confirm-button { min-width: 230px; font-size: 16px; font-weight: 700; }
@media (max-width: 620px) {
  .agent-approval-callout { align-items: stretch; flex-direction: column; }
  .agent-approval-callout .btn, .agent-confirm-button { width: 100%; }
}

/* v2.11 public order summary and workflow statuses */
.order-hero-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
.order-number-label { margin: 0 0 3px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.order-product-summary {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid #ccd9e7;
  border-radius: 13px;
  background: #f7fafc;
}
.order-product-summary small { display: block; margin-bottom: 4px; color: var(--muted); font-weight: 600; }
.order-product-summary strong { color: var(--blue-dark); font-size: clamp(18px, 3vw, 24px); }
.status-pending { background: #fff3c4; color: #775500; }
.status-rejected { background: #ffe0e0; color: #a42222; }
.status-approved { background: #d9f5f4; color: #006d6a; }
.status-printing { background: #ffe5c7; color: #9b4b00; }
.status-completed { background: #ddf4e6; color: #126b3d; }
.inline-title-row { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; flex-wrap:wrap; }
.inline-title-row h2 { margin-bottom:5px; }

@media (max-width: 680px) {
  .order-hero-main .status { width: 100%; justify-content: center; text-align: center; }
}

/* v2.13 preview refinements */
.combined-download { grid-column: 1 / -1; text-align: center; }
.nametag-frame img, .nametag-frame canvas { border-radius: 18px; overflow: hidden; }

canvas[data-preview-svg]{display:block;max-width:100%;height:auto;margin:auto;background:#fff;border-radius:8px;box-shadow:0 8px 20px rgba(0,0,0,.15);-webkit-user-select:none;user-select:none}
