:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --success: #16a34a;
  --success-dark: #15803d;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 20px rgba(0, 0, 0, .06);
  --shadow-modal: 0 24px 70px rgba(0, 0, 0, .28);
}

/* 사진 색이 가장 정확하게 보이는 중간 회색 (편집 프로그램과 같은 계열) */
:root[data-theme="gray"] {
  --bg: #3c3f44;
  --surface: #4a4e55;
  --border: #5c626b;
  --text: #f2f4f6;
  --text-muted: #c2c8d0;
  --danger-soft: #4a3030;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px rgba(0, 0, 0, .25);
  --shadow-modal: 0 24px 70px rgba(0, 0, 0, .5);
}

:root[data-theme="gray"] .thumb-wrap { background: #33363a; }
:root[data-theme="gray"] .paper-bg { background: #f8fafc; }
:root[data-theme="gray"] .btn-seg:hover { background: rgba(255, 255, 255, .08); }
:root[data-theme="gray"] .step { background: var(--surface); }
:root[data-theme="gray"] .guide-demo { background: #565b63; }
:root[data-theme="gray"] .size-sample .paper-shape { border-color: rgba(255, 255, 255, .3); }
:root[data-theme="gray"] .crop-warn { background: #4d4326; border-color: #8a7534; color: #fde68a; }
:root[data-theme="gray"] .submitted-check { background: #2c4a3c; }
:root[data-theme="gray"] .order-tab.submitted { background: #33473d; }
:root[data-theme="gray"] input, :root[data-theme="gray"] select, :root[data-theme="gray"] textarea {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="gray"] .size-select { background: #3f434a; }

:root[data-theme="dark"] {
  --bg: #0f1420;
  --surface: #1a2130;
  --border: #2f3a4d;
  --text: #f1f5f9;
  --text-muted: #9aa7bd;
  --danger-soft: #3a1e1e;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 20px rgba(0, 0, 0, .35);
  --shadow-modal: 0 24px 70px rgba(0, 0, 0, .6);
}

:root[data-theme="dark"] .thumb-wrap { background: #0b111c; }
:root[data-theme="dark"] .paper-bg { background: #f8fafc; }
:root[data-theme="dark"] .btn-seg:hover { background: rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .step { background: var(--surface); }
:root[data-theme="dark"] .guide-demo { background: #263145; }
:root[data-theme="dark"] .size-sample .paper-shape { border-color: rgba(255, 255, 255, .25); }
:root[data-theme="dark"] .crop-warn { background: #3a2d10; border-color: #7c5e14; color: #fcd34d; }
:root[data-theme="dark"] .submitted-check { background: #0f2f22; }
:root[data-theme="dark"] .order-tab.submitted { background: #10281d; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="dark"] .size-select { background: #131a27; }

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "맑은 고딕", "Malgun Gothic", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button, select, input { font-family: inherit; }

/* ── 상단 바 ─────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 70px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { font-size: 17px; font-weight: 700; white-space: nowrap; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.group { display: flex; align-items: center; gap: 6px; }
.group-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* ── 버튼 ────────────────────────────────────────────── */
.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s ease, background-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
  color: var(--text);
  background: transparent;
}
.btn:active { transform: scale(.97); }

.btn-secondary { background: var(--surface); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }

.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .28);
}
.btn-accent:hover { background: var(--accent-dark); }

.btn-ghost { color: var(--accent-text, var(--accent)); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-ghost.btn-danger { color: var(--danger); }
.btn-ghost.btn-danger:hover { background: var(--danger-soft); }

.btn-primary {
  background: var(--success);
  color: #fff;
  font-size: 17px;
  padding: 14px 26px;
  box-shadow: 0 4px 14px rgba(22, 163, 74, .32);
}
.btn-primary:hover { background: var(--success-dark); }

.btn-lg { padding: 14px 22px; font-size: 16px; }

.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.segmented-lg { padding: 4px; }
.btn-seg {
  padding: 8px 14px;
  font-size: 13.5px;
  border-radius: 7px;
  color: var(--text-muted);
}
.segmented-lg .btn-seg { padding: 11px 18px; font-size: 14.5px; }
.btn-seg:hover { background: rgba(255, 255, 255, .7); color: var(--text); }
.btn-seg.on {
  background: var(--surface);
  color: var(--accent-text, var(--accent));
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

/* ── 사진 카드 그리드 ────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 18px;
  padding: 20px;
  padding-bottom: 120px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.7;
  margin-top: 90px;
}
.empty-sub { font-size: 14px; opacity: .8; }

.card {
  container-type: inline-size;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 2px solid transparent;
  transition: border-color .15s ease;
  animation: pop-in .18s ease;
}
.card.active { border-color: var(--accent); }

/* 0장(주문에서 빠진) 사진은 흐리게 — 무엇을 담았는지 한눈에 구분된다 */
.card .thumb-wrap { transition: opacity .15s ease; }
.card:not(.active) .thumb-wrap { opacity: .5; }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
}

.thumb-wrap { background: #eceef1; }

/* 사진 전체를 보여주고, 그 위에 인화지 영역을 겹쳐 그린다 */
.thumb {
  position: absolute;
  display: block;
  object-fit: fill;
}
.thumb.plain { position: static; width: 100%; height: 100%; object-fit: cover; }

/* 피트인: 인화지(흰 종이) 위에 사진이 통째로 올라간다 */
.paper-bg {
  position: absolute;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
}

/* 필인: 인화 영역 밖(=잘려나갈 부분)을 어둡게 덮는다 */
.crop-frame {
  position: absolute;
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55);
  pointer-events: none;
}

.mode-tag {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(17, 24, 39, .72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.square-tag {
  position: absolute;
  left: 6px;
  top: 6px;
  background: rgba(37, 99, 235, .92);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(17, 24, 39, .55);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb-remove:hover { background: var(--danger); }

.badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
}

.card-name {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 6px; }

.mode-btn {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.mode-btn { color: var(--accent-text, var(--accent)); }
.mode-btn:hover { background: var(--accent-soft); }
.mode-btn.fit { color: #b45309; }
.mode-btn.fit:hover { background: #fffbeb; }

.size-select {
  flex: 1;
  min-width: 0;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.step {
  width: 30px;
  height: 34px;
  border: none;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}
.step:active { transform: scale(.94); }

.qty { min-width: 22px; text-align: center; font-weight: 700; font-size: 14.5px; }

.row-remove {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}
.row-remove:hover { background: var(--danger-soft); color: var(--danger); }

/* 카드가 좁으면 크기/여백 · 수량을 두 줄로 나눈다 (가로 모드·좁은 칼럼 모두 커버) */
@container (max-width: 218px) {
  .row { flex-wrap: wrap; row-gap: 6px; }
  .size-select { flex: 1 1 82px; font-size: 12.5px; padding: 0 6px; }
  .mode-btn { flex: 0 0 auto; padding: 0 8px; font-size: 11.5px; }
  .stepper { flex: 1 1 calc(100% - 32px); justify-content: space-between; }
}

.add-size {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--accent-text, var(--accent));
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
}
.add-size:hover { text-decoration: underline; }

/* ── 하단 바 ────────────────────────────────────────── */
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: 88px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
}

.summary { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.count { font-size: 15px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.total { font-size: 26px; font-weight: 800; white-space: nowrap; }
.bottom-actions { display: flex; align-items: center; gap: 10px; }

/* ── 전체화면 미리보기 ─────────────────────────────── */
/* 화면을 [사진 | 패널] 로 나누고, 사진 칸은 minmax(0,1fr) 이라 남는 만큼만 차지한다.
   → 사진이 세로로 길어도 패널(메뉴)이 화면 밖으로 밀리지 않는다. */
.detail {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, .93);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  animation: fade-in .15s ease;
  overflow: hidden;
}

.detail-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px;
  overflow: hidden;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* 스테이지 크기는 JS 가 '남은 칸에 맞춘 사진 크기' 그대로 픽셀로 지정한다.
   CSS 로만 맞추면 이미지와 크롭 틀의 기준이 어긋나 틀이 사진 밖으로 나간다. */
.fullscreen-stage {
  position: relative;
  display: block;
  overflow: visible;
}
.detail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain; /* 늘어남 방지 */
  border-radius: 4px;
}
.fullscreen-stage .crop-frame {
  border: 3px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .48), 0 0 14px rgba(0, 0, 0, .55);
}

/* 3분할선 — 인물 배치를 잡기 쉽게 */
.fullscreen-stage .crop-frame::before,
.fullscreen-stage .crop-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fullscreen-stage .crop-frame::before {
  background:
    linear-gradient(to right, transparent calc(33.33% - 1px), rgba(255, 255, 255, .45) calc(33.33% - 1px) 33.33%,
      transparent 33.33%, transparent calc(66.66% - 1px), rgba(255, 255, 255, .45) calc(66.66% - 1px) 66.66%, transparent 66.66%);
}
.fullscreen-stage .crop-frame::after {
  background:
    linear-gradient(to bottom, transparent calc(33.33% - 1px), rgba(255, 255, 255, .45) calc(33.33% - 1px) 33.33%,
      transparent 33.33%, transparent calc(66.66% - 1px), rgba(255, 255, 255, .45) calc(66.66% - 1px) 66.66%, transparent 66.66%);
}

/* 모서리 표시 */
.crop-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 4px solid #fff;
  pointer-events: none;
}
.crop-corner.tl { top: -3px; left: -3px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.crop-corner.tr { top: -3px; right: -3px; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
.crop-corner.bl { bottom: -3px; left: -3px; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
.crop-corner.br { bottom: -3px; right: -3px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }

/* 피트인일 때 인화지 테두리(여백이 생기는 범위)를 점선으로 보여준다 */
.paper-outline {
  position: absolute;
  border: 2px dashed rgba(255, 255, 255, .75);
  background: rgba(255, 255, 255, .14);
  border-radius: 3px;
  pointer-events: none;
}

.fullscreen-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 94%;
  text-align: center;
  color: #fff;
  background: rgba(17, 24, 39, .88);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
}

/* ── 모달 ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(17, 24, 39, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in .12s ease;
  padding: 20px;
}

.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 24px;
}

.modal h2 { margin: 0 0 14px; font-size: 20px; }
.modal .muted { color: var(--text-muted); font-size: 14px; margin: -6px 0 14px; line-height: 1.6; }

.field { margin-bottom: 22px; }
.field-label { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.hint { color: var(--text-muted); font-size: 12.5px; margin: 8px 0 0; }

.price-head {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) 76px 76px 82px 82px 62px 30px;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 2px 6px;
}

.price-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

.price-row {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) 76px 76px 82px 82px 62px 30px;
  gap: 8px;
  align-items: center;
}

.order-btns { display: flex; gap: 4px; }
.order-btns button {
  width: 28px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.order-btns button:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.order-btns button:disabled { opacity: .35; cursor: default; }

.modal-actions-split { justify-content: space-between; }
.left-actions, .right-actions { display: flex; gap: 8px; }
.price-row input {
  height: 42px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.price-row input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.price-remove {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.price-remove:hover { background: var(--danger-soft); color: var(--danger); }

.text-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.text-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── 영수증 ─────────────────────────────────────────── */
.receipt { font-size: 14px; }
.receipt-row {
  display: grid;
  grid-template-columns: 1fr 64px 46px 92px;
  gap: 6px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.receipt-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.receipt-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.receipt-head { font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.receipt-fee { display: flex; justify-content: space-between; padding: 9px 2px; color: var(--text-muted); }
.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--text);
  font-size: 20px;
  font-weight: 800;
}
.receipt-empty { color: var(--text-muted); text-align: center; padding: 30px 0; }

/* ── 연결(QR) ───────────────────────────────────────── */
.qr-wrap { display: flex; justify-content: center; margin: 6px 0 14px; }
.qr-wrap img {
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  background: #fff;
}

.tablet-addrs { display: flex; flex-direction: column; gap: 8px; }
.tablet-addrs div {
  font-size: 17px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-text, var(--accent-dark));
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  text-align: center;
  user-select: text;
}

/* ── 토스트 ─────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(17, 24, 39, .93);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  animation: fade-in .15s ease;
  max-width: 90vw;
  text-align: center;
}

/* ── 손님용(태블릿) 모드 ─────────────────────────────── */
body.mode-customer .topbar-actions,
body.mode-customer #btnSave { display: none; }




/* ── 필인/피트인 설명 ───────────────────────────────── */
.modal-wide { width: min(720px, 100%); }

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0 6px;
}

.guide-card {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 14px;
}

.guide-demo {
  position: relative;
  height: 130px;
  border-radius: var(--radius-sm);
  background: #dfe3e8;
  overflow: hidden;
  margin-bottom: 10px;
}

.demo-photo {
  position: absolute;
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 55%, #f472b6 100%);
}
/* 필인: 사진이 인화지보다 크고, 인화지 밖은 잘린다 */
.demo-photo-fill { left: 22%; top: 0; width: 56%; height: 100%; }
.demo-paper {
  position: absolute;
  left: 14%;
  top: 18%;
  width: 72%;
  height: 64%;
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .5);
}
/* 피트인: 인화지 안에 사진 전체가 들어가고 좌우 여백이 남는다 */
.demo-paper-fit {
  left: 14%;
  top: 18%;
  width: 72%;
  height: 64%;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: none;
}
.demo-photo-fit { left: 27%; top: 18%; width: 46%; height: 64%; }

.guide-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.guide-desc { font-size: 13px; line-height: 1.65; color: var(--text-muted); margin: 0; }

/* ── 사이즈표 ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 6px 0 4px; }
.size-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.size-table th, .size-table td { padding: 10px 8px; text-align: right; white-space: nowrap; }
.size-table th {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.size-table td { border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.size-table th:first-child, .size-table td:first-child { text-align: left; font-weight: 700; }


/* ── 외부 연결 토글 ─────────────────────────────────── */
.tunnel-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.tunnel-info { flex: 1; min-width: 0; }
.tunnel-title { font-size: 14px; font-weight: 700; }
.tunnel-state { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; overflow-wrap: anywhere; }
.tunnel-box.on { background: #ecfdf5; border-color: #a7f3d0; }
.tunnel-box.on .tunnel-state { color: #047857; }
.tunnel-box.busy .tunnel-state { color: var(--accent-dark); }
.tunnel-box.error { background: var(--danger-soft); border-color: #fecaca; }
.tunnel-box.error .tunnel-state { color: var(--danger); }
#btnTunnel { flex: 0 0 auto; min-width: 78px; }

/* ── 연결(QR) 주소 · 복사 ────────────────────────────── */
.qr-actions { display: flex; justify-content: center; margin-bottom: 14px; }

.addr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 8px 8px 8px 14px;
}
.addr-text {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-dark);
  overflow-wrap: anywhere;
  user-select: text;
  text-align: left;
}
.addr-copy { flex: 0 0 auto; padding: 8px 12px; font-size: 13px; }
.addr-tag {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 999px;
}

/* 클립보드 API 가 막혔을 때만 드러나는 대체 복사용 입력칸 */
.copy-fallback {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
  border: 0;
}
.copy-fallback.visible {
  position: static;
  opacity: 1;
  pointer-events: auto;
  width: 100%;
  height: 64px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  resize: none;
  user-select: text;
}

/* ── 반응형: 화면 크기 · 방향 ─────────────────────────── */

/* 태블릿 가로/작은 노트북 */
@media (max-width: 1024px) {
  .topbar { height: auto; min-height: 64px; padding: 10px 14px; flex-wrap: wrap; }
  .topbar-actions { gap: 6px; }
  .btn { padding: 10px 13px; font-size: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 16px; }
  .bottom-actions .btn-secondary { padding: 11px 12px; font-size: 13.5px; }
}

/* 태블릿 세로 */
@media (max-width: 820px) {
  .brand { font-size: 15px; }
  .group-label { display: none; }
  .bottombar { height: auto; min-height: 0; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .summary { width: 100%; justify-content: space-between; }
  .bottom-actions { width: 100%; flex-wrap: wrap; }
  .bottom-actions .btn { flex: 1 1 auto; }
  .grid { padding-bottom: 170px; }
}

/* 휴대폰 */
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .topbar-actions { justify-content: flex-start; }
  .guide-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 12px; padding-bottom: 220px; }
  .card { padding: 10px; border-radius: 14px; }
  .step { width: 30px; }

  .total { font-size: 21px; }
  .count { font-size: 13px; }
  .bottom-actions { gap: 6px; }
  .bottom-actions .btn-secondary { flex: 1 1 30%; padding: 10px 8px; font-size: 12.5px; }
  .bottom-actions .btn-primary { flex: 1 1 100%; padding: 12px 18px; font-size: 15px; }
  .modal { padding: 18px; border-radius: 14px; }
  .modal-actions-split { flex-direction: column; gap: 10px; }
  .left-actions, .right-actions { width: 100%; }
  .left-actions .btn, .right-actions .btn { flex: 1; }
  .price-head { display: none; }
  .price-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
  }
  .price-row .price-name { grid-column: 1 / -1; }
  .qr-wrap img { width: 180px; height: 180px; }
  .addr-text { font-size: 13.5px; }
}

/* 가로로 눕힌 휴대폰·작은 태블릿: 세로 공간이 부족하므로 상·하단을 납작하게 */
@media (orientation: landscape) and (max-height: 560px) {
  .topbar { min-height: 52px; height: 52px; padding: 0 12px; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; }
  .topbar-actions { flex-wrap: nowrap; }
  .bottombar { height: 62px; flex-wrap: nowrap; padding: 0 12px; }
  .summary { width: auto; }
  .bottom-actions { width: auto; flex-wrap: nowrap; }
  .total { font-size: 19px; }
  .btn-primary { padding: 10px 16px; font-size: 15px; }
  .grid { padding-bottom: 84px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .modal { max-height: 92vh; padding: 16px; }
  .qr-wrap img { width: 150px; height: 150px; }
  .fullscreen img { max-height: 82vh; }
}

/* 노치/홈 인디케이터 여백 */
@supports (padding: max(0px)) {
  .bottombar {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}


/* ── 손님(주문) 탭 ──────────────────────────────────── */
.orderbar {
  position: sticky;
  top: 70px;
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.order-tabs { display: flex; gap: 8px; flex: 1; min-width: 0; }

.order-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  padding: 8px 8px 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.order-tab:hover { background: var(--surface); }
.order-tab.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text, var(--accent-dark));
}
.order-tab .tab-sum { font-size: 12px; font-weight: 700; opacity: .85; }
.order-tab .tab-close {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 11px;
  cursor: pointer;
  opacity: .65;
}
.order-tab .tab-close:hover { background: var(--danger-soft); color: var(--danger); opacity: 1; }

body.mode-customer .orderbar { display: none; }

/* ── 전체화면 크롭 이동 ─────────────────────────────── */
.fullscreen-stage.cropping { cursor: grab; touch-action: none; }
.fullscreen-stage.cropping:active { cursor: grabbing; }

/* ── 사진 편집 패널 ─────────────────────────────────── */
.detail-panel {
  min-height: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-head { display: flex; align-items: center; gap: 10px; }
.detail-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-x { padding: 8px 12px; font-size: 13px; }

.detail-rows { display: flex; flex-direction: column; gap: 10px; }

.detail-row {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color .15s ease, background-color .15s ease;
}
.detail-row.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.detail-row-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.detail-row-mid { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.detail-row-mid .fit-toggle { flex: 1 1 auto; }
.detail-row-mid .fit-toggle button { flex: 1; }

.detail-actions-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.detail-row-top .size-select { height: 40px; }
.detail-row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.fit-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.fit-toggle button {
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}
.fit-toggle button {
  min-height: 40px;
  transition: background-color .12s ease, color .12s ease;
}
.fit-toggle button.on {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.fit-toggle button:not(.on):hover { background: var(--accent-soft); color: var(--accent-text, var(--accent)); }

.detail-price { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.detail-add { align-self: flex-start; }
.detail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.detail-foot .btn { width: 100%; }

/* 좁거나 세로인 화면: 위=사진, 아래=메뉴.
   메뉴 높이를 먼저 정하고(auto, 최대 56%) 사진은 남은 만큼만 쓴다. */
@media (max-width: 900px), (orientation: portrait) {
  .detail {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .detail-main { padding: 10px; }
  .detail-panel {
    max-height: min(56vh, 460px);
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .detail-foot {
    flex-direction: row;
    position: sticky;
    bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    margin-bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 16px -10px rgba(0, 0, 0, .35);
  }
}

/* 가로로 눕힌 휴대폰: 세로 공간이 거의 없으므로 좌우로 나눈다 */
@media (orientation: landscape) and (max-height: 560px) {
  .detail { grid-template-columns: minmax(0, 1fr) min(46vw, 330px); grid-template-rows: none; }
  .detail-main { padding: 8px; }
  .detail-panel { max-height: none; border-top: none; border-left: 1px solid var(--border); border-radius: 0; padding: 12px; }
  .fullscreen-hint { font-size: 12px; padding: 6px 12px; top: 6px; }
}

/* 휴대폰: 손가락으로 누르기 좋은 크기로 */
@media (max-width: 640px) {
  .detail-panel { max-height: min(58vh, 440px); gap: 10px; }
  .detail-head { position: sticky; top: -14px; background: var(--surface); padding: 4px 0 6px; z-index: 1; }
  .detail-row { padding: 12px; }
  .detail-row-top { gap: 6px; }
  .detail-row-top .size-select { height: 48px; font-size: 15.5px; flex: 1 1 auto; }
  .detail-row-mid { gap: 6px; }
  .fit-toggle button { padding: 12px 10px; font-size: 14px; min-height: 46px; }
  .detail-actions-row .btn { min-height: 44px; font-size: 14.5px; }
  .detail-row-bottom .stepper { padding: 3px; }
  .detail-row-bottom .step { width: 44px; height: 44px; font-size: 18px; }
  .detail-row-bottom .qty { min-width: 34px; font-size: 17px; }
  .detail-row-bottom .row-remove { width: 38px; height: 38px; font-size: 14px; }
  .detail-price { font-size: 13px; }
  .crop-open, .detail-add { min-height: 46px; font-size: 15px; }
  #cropZoom { height: 40px; }
  .crop-step { width: 46px; padding: 11px 0; font-size: 18px; }
  .crop-row .btn { min-height: 44px; }
  .detail-foot .btn { min-height: 50px; font-size: 16px; }
  .fullscreen-hint { font-size: 12.5px; padding: 8px 12px; top: 10px; }
  .crop-corner { width: 18px; height: 18px; }
}

/* ── 사이즈표(비율 그림) ────────────────────────────── */
.size-chart {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 0 6px;
}

.size-sample { text-align: center; }
.size-sample .paper-shape {
  margin: 0 auto 6px;
  background: linear-gradient(140deg, #cfe3ff 0%, #e4d7ff 50%, #ffd9ec 100%);
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 2px;
}
.size-sample .shape-name { font-size: 12px; font-weight: 700; }
.size-sample .shape-price { font-size: 11.5px; color: var(--accent-text, var(--accent-dark)); font-weight: 700; }
.size-sample .shape-cm { font-size: 10.5px; color: var(--text-muted); }


/* ── 크롭 조정 도구 ─────────────────────────────────── */
.crop-tools { display: flex; flex-direction: column; gap: 10px; }
.crop-open { width: 100%; }
.crop-open.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text, var(--accent-dark)); }

.crop-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crop-row { display: flex; align-items: center; gap: 8px; }
.crop-row .btn { flex: 1; }
.crop-label { font-size: 13px; font-weight: 700; flex: 0 0 auto; }
.crop-value { font-size: 12.5px; font-weight: 700; color: var(--accent-text, var(--accent-dark)); min-width: 42px; text-align: right; flex: 0 0 auto; }
.crop-hint { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.6; }
.crop-warn {
  font-size: 12.5px;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 0;
  line-height: 1.55;
}

.crop-step { flex: 0 0 auto !important; width: 38px; padding: 8px 0; font-size: 15px; font-weight: 700; }

#cropZoom {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
  height: 28px;
}

/* ── 손님 주문 접수 안내 ────────────────────────────── */
.submitted-banner {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(17, 24, 39, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in .15s ease;
}

.submitted-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 34px 28px;
  text-align: center;
  max-width: 420px;
  width: 100%;
}
.submitted-check {
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #ecfdf5;
  color: var(--success);
  font-size: 34px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.submitted-title { font-size: 21px; font-weight: 800; margin-bottom: 8px; }
.submitted-desc { color: var(--text-muted); font-size: 14.5px; line-height: 1.7; margin: 0 0 20px; }

/* 매장 화면에서는 접수 안내 대신 탭에 표시만 */
body:not(.mode-customer) .submitted-banner { display: none !important; }
body:not(.mode-customer) #btnSubmit { display: none; }
body.mode-customer #btnSubmit { display: inline-block; }

.order-tab .tab-flag {
  background: var(--success);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.order-tab.submitted { border-color: var(--success); background: #ecfdf5; }


/* ── 화면 색상 설정 ─────────────────────────────────── */
.theme-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }

.color-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px 6px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.color-pick input[type="color"] {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}


/* ── 휴지통 ─────────────────────────────────────────── */
.trash-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 4px; max-height: 46vh; overflow-y: auto; }

.trash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
}
.trash-item img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface);
  flex: 0 0 auto;
}
.trash-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trash-item .btn { min-height: 42px; padding: 10px 14px; }
.trash-empty { color: var(--text-muted); text-align: center; padding: 26px 0; font-size: 14px; }

#btnTrash { position: relative; }
#trashCount {
  display: inline-block;
  min-width: 20px;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .trash-item { padding: 8px; gap: 8px; }
  .trash-item img { width: 48px; height: 48px; }
  .trash-item .btn { padding: 10px; font-size: 13px; }
}

/* ══════════════════════════════════════════════════════
   2차 정리: 아이콘 · 진행 단계 · 접근성
   (간격은 4px 격자, 누르는 곳은 최소 44px — macOS/HIG 기준)
   ══════════════════════════════════════════════════════ */

.icon-sprite { display: none; }

/* 아이콘은 전부 같은 굵기의 선으로 그린다 */
.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-ic { width: 22px; height: 22px; color: var(--accent-text, var(--accent)); }

.btn-icon-text { display: inline-flex; align-items: center; gap: 7px; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  padding: 11px 0;
}
.btn-icon .ic { width: 19px; height: 19px; }
.btn-block { width: 100%; justify-content: center; }
.btn-danger-ghost:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

.brand { display: flex; align-items: center; gap: 9px; }
.topbar-sep {
  width: 1px;
  height: 26px;
  background: var(--border);
  margin: 0 2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text, var(--accent));
  font-size: 12px;
  font-weight: 700;
}

/* ── 진행 단계 ─────────────────────────────────────── */
.steps {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }

.step-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 14px 8px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.step-chip + .step-chip { margin-left: 10px; position: relative; }
.step-chip + .step-chip::before {
  content: "";
  position: absolute;
  left: -11px;
  width: 12px;
  height: 1px;
  background: var(--border);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
}
.step-chip:hover { background: var(--accent-soft); color: var(--accent-text, var(--accent)); }
.step-chip.done .step-num { background: var(--success); color: #fff; }
.step-chip.done { color: var(--text); }
.step-chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text, var(--accent));
}
.step-chip.on .step-num { background: var(--accent); color: #fff; }

/* ── 편집 패널: 머리 · 본문(스크롤) · 바닥 ─────────── */
.detail-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.detail-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 2px;
}
.detail-foot { margin-top: 0; }

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .01em;
}
.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text, var(--accent));
  font-size: 11.5px;
  font-weight: 700;
}

.submitted-check .ic { width: 30px; height: 30px; stroke-width: 2.4; color: var(--success); }

/* ── 언어 선택 ─────────────────────────────────────── */
.modal-narrow { max-width: 420px; }

.lang-choices { display: grid; gap: 10px; margin-top: 18px; }
.lang-choice {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 64px;
  transition: border-color .15s ease, background-color .15s ease;
}
.lang-choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.lang-name { font-size: 17px; font-weight: 700; }
.lang-sub { font-size: 13px; color: var(--text-muted); }

/* ── 접근성 ───────────────────────────────────────── */
:where(button, [href], input, select, textarea, .step-chip, .lang-choice, .order-tab):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* 누르는 곳은 손가락·마우스 모두 놓치지 않을 크기로 */
.btn, .step-chip, .lang-choice, .fit-toggle button, .size-select { min-height: 40px; }
.bottom-actions .btn, .topbar-actions .btn { min-height: 42px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .btn:active { transform: none; }
}

@media (prefers-contrast: more) {
  :root { --border: #9aa3af; --text-muted: #4b5563; }
  .btn-secondary { border-width: 1.5px; }
}

/* 단계 표시는 좁은 화면에서 번호만 남긴다 */
@media (max-width: 640px) {
  .steps { padding: 8px 12px; gap: 4px; }
  .step-chip { padding: 7px 10px 7px 7px; font-size: 12.5px; }
  .step-chip:not(.on) .step-text { display: none; }
  .step-chip + .step-chip { margin-left: 8px; }
  .step-chip + .step-chip::before { left: -9px; width: 9px; }
  .topbar-sep { display: none; }
}

/* 손님 화면에서는 매장 전용 단계(사진 올리기)를 누를 일이 없다 */
body.mode-customer .step-chip[data-step="1"] { pointer-events: none; opacity: .65; }

/* Keep photo controls legible and previews separate from the order behind them. */
.detail { background: #17191c; animation: none; }
.preview-status { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 16px 22px; border-radius: 12px; background: var(--surface); color: var(--text); max-width: 85%; text-align: center; pointer-events: none; }
.thumb-wrap:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.detail-foot { padding-top: 12px; border-top: 1px solid var(--border); background: var(--surface); }
.detail-scroll { scrollbar-gutter: stable; }

/* v0.18.1: constrain intrinsic filename/control widths and the visual viewport. */
.detail { width: 100%; height: 100vh; height: 100dvh; grid-template-rows: minmax(0, 1fr); }
.detail-panel, .detail-head, .detail-scroll, .detail-rows, .detail-row,
.detail-row-top, .detail-row-mid, .detail-row-bottom { min-width: 0; max-width: 100%; }
.detail-panel { width: 100%; }
.detail-row-top .size-select { min-width: 0; width: 100%; }
.detail-row-bottom, .detail-actions-row { flex-wrap: wrap; }
.detail-main { flex-direction: column; gap: 8px; }
.fullscreen-stage { flex: none; }
.fullscreen-hint { position: static; transform: none; flex: none; order: -1; max-width: 100%; margin: 0; border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.detail-head { position: static; }
.detail-foot { position: static; margin-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
@media (max-width: 900px), (orientation: portrait) {
  .detail { grid-template-rows: minmax(0, 1fr) minmax(0, 52%); }
  .detail-panel { max-height: none; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .detail { grid-template-rows: minmax(0, 1fr); }
}

/* Cards have two stable rows so added-size remove buttons cannot crush the select. */
.card .rows > .row { display: grid; grid-template-columns: minmax(0, 1fr) auto 30px; gap: 6px; }
.card .rows > .row > .size-select { grid-column: 1 / -1; width: 100%; min-width: 0; height: 42px; }
.card .rows > .row > .mode-btn { grid-column: 1; justify-self: start; }
.card .rows > .row > .stepper { grid-column: 2; }
.card .rows > .row > .row-remove { grid-column: 3; }
.date-option { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; }
.date-option label { display: flex; gap: 8px; align-items: center; min-height: 40px; }
.date-option input[type=date] { width: 100%; min-width: 0; padding: 8px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }

.bulk-custom { display: grid; gap: 8px; }

.selection-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 24px; }
.photo-selection { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; font-weight: 600; }
.photo-selection input { width: 20px; height: 20px; accent-color: var(--accent); }
.card.batch-selected { outline: 2px solid var(--accent); outline-offset: 2px; }
body.mode-customer .photo-selection { display: none; }

.photo-remove { margin-top: 8px; color: var(--danger); width: 100%; }

.price-original { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.price-row .preserve-original { width: 20px; height: 20px; }

.book-order { margin: 12px 20px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.book-order label { display: flex; flex-direction: column; gap: 6px; }
.book-order select, .book-order input, .book-price-row input { min-height: 44px; min-width: 0; max-width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--surface); }
.book-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap: 12px; margin-top: 12px; align-items: end; }
.book-price-row { display: grid; grid-template-columns: minmax(0,1fr) 130px; gap: 8px; align-items: center; margin: 8px 0; }
.photo-book-order #steps, .photo-book-order #btnBulk, .photo-book-order #btnSelectedQty, .photo-book-order .add-size { display: none; }

.photo-book-order #selectionTools, .photo-book-order .photo-selection { display: none !important; }

.book-details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.book-details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.book-details summary::before { content: "＋"; margin-right: 8px; }
.book-details[open] > summary::before { content: "−"; }
.book-details img { display: block; width: 100%; max-width: 812px; height: auto; margin: 12px auto; }

#bookDesignSummary { overflow-wrap: anywhere; }

.photo-order-controls { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 6px; align-items: end; }
.photo-order-controls label { font-size: 12px; display: grid; gap: 4px; }
.photo-order-controls input { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--border); border-radius: 8px; text-align: center; background: var(--surface); color: var(--text); }
.photo-order-controls button { padding: 8px; font-size: 12px; min-height: 44px; }

#albumEditor { width: min(1400px, 96vw); max-width:96vw; height:94dvh; max-height:94dvh; padding:20px; color:var(--text); background:var(--bg); border:1px solid #888; border-radius:16px; }
#albumEditor[open] { display:flex; flex-direction:column; gap:12px; }
#albumEditor::backdrop { background:#0009; }
.album-header,.album-footer,.album-tools { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.album-header { justify-content:space-between; }
.album-tools input { width:82px; }
.album-body { display:grid; grid-template-columns:220px minmax(0,1fr); gap:20px; min-height:180px; flex:1; overflow:auto; }
.album-body aside { overflow:auto; display:flex; flex-direction:column; gap:10px; }
#albumEditor input,#albumEditor select,#albumEditor textarea { min-height:36px; max-width:100%; }
#albumProperties label { display:block; margin:8px 0; }
#albumProperties input[type=number] { width:85px; }
.album-workspace { background:#777; overflow:auto; padding:20px; }
#albumStage { position:relative; width:min(100%,750px); background:white; margin:auto; overflow:hidden; color:#222; }
.album-element { position:absolute; white-space:pre; overflow:hidden; touch-action:none; cursor:move; line-height:normal; }
.album-element img { width:100%;height:100%; background:white;pointer-events:none; }
.album-element.selected { outline:2px solid #2876ff;outline-offset:-2px; }
.album-footer { flex-shrink:0; }
@media(max-width:700px){#albumEditor{padding:10px}.album-body{grid-template-columns:130px minmax(0,1fr);gap:8px}.album-workspace{padding:8px}.album-tools{max-height:140px;overflow:auto}.album-tools label{font-size:12px}}

.minimum-settings { margin: 20px 0; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.minimum-settings h3 { margin: 0 0 16px; font-size: 16px; }
.minimum-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr); gap: 16px; align-items: end; }
.minimum-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; font-size: 13px; font-weight: 600; }
.minimum-field select, .minimum-money { width: 100%; min-height: 46px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.minimum-field select { padding: 10px 12px; font: inherit; }
.minimum-money { display: flex; align-items: center; padding: 0 12px; gap: 8px; }
.minimum-money input { width: 100%; min-width: 0; min-height: 44px; border: 0; background: transparent; color: var(--text); text-align: right; font: inherit; font-size: 16px; }
.minimum-money:focus-within, .minimum-field select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.minimum-settings p { margin: 14px 0 0; line-height: 1.65; font-size: 13px; color: var(--text-muted); }
.minimum-settings .minimum-example { padding: 12px; background: var(--accent-soft); border-radius: 8px; color: var(--text); }
.fee-badge { display: block; color: var(--accent-text); font-size: 11px; font-weight: 600; margin-bottom: 3px; }
@media(max-width: 600px) { .minimum-fields { grid-template-columns: minmax(0,1fr); } .minimum-settings { padding: 14px; } }
.minimum-money input:focus { outline: none; box-shadow: none; }

/* Phone editor: give the selected task enough room without scrolling the page behind it. */
.detail-mobile-nav { display: none; }
.detail-size-section { display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; }
@media (max-width: 600px) {
  .detail { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(90px, 20%) minmax(0, 1fr); }
  .detail-mobile-nav { display: flex; gap: 8px; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--surface); }
  .detail-mobile-nav .btn { flex: 1; min-height: 48px; font-size: 16px; }
  .detail-mobile-nav [aria-pressed="true"] { background: var(--accent); color: white; }
  .detail-panel { padding: 12px; border-left: 0; border-top: 1px solid var(--border); }
  .detail[data-view="sizes"] #cropTools { display: none; }
  .detail[data-view="sizes"] .fullscreen-hint { display: none; }
  .detail[data-view="sizes"] .detail-main { cursor: pointer; }
  .detail[data-view="crop"] { grid-template-rows: auto minmax(0, 1fr) minmax(220px, 38%); }
  .detail[data-view="crop"] .detail-size-section { display: none; }
  .detail[data-view="crop"] #btnCropOpen, .detail[data-view="crop"] #cropTools > .section-label { display: none; }
  .detail-row-top .size-select { min-height: 52px; font-size: 18px; }
  .detail-add { width: 100%; min-height: 52px; font-size: 17px; background: var(--accent-soft); border: 1px solid var(--accent); }
  .detail-row-mid .fit-toggle button { min-height: 46px; font-size: 15px; }
  .detail-row-bottom .step { min-width: 46px; min-height: 46px; }
  .detail-row-bottom .qty { font-size: 18px; }
}

.crop-corner { pointer-events: auto; touch-action: none; }
.crop-corner.tl, .crop-corner.br { cursor: nwse-resize; }
.crop-corner.tr, .crop-corner.bl { cursor: nesw-resize; }
.crop-corner:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@media (pointer: fine) { .crop-corner { width: 24px; height: 24px; } }

.nas-order-filters { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 16px; }
.nas-periods { display:flex; gap:8px; flex-wrap:wrap; margin:12px 0; }
.nas-periods [aria-pressed="true"] { background:var(--accent); color:white; }
.nas-filter-fields { display:flex; gap:16px; flex-wrap:wrap; }
.nas-filter-fields label { display:flex; flex-direction:column; gap:8px; flex:1 1 220px; min-width:0; }
.nas-filter-fields input, .nas-filter-fields select { min-height:48px; width:100%; font-size:16px; padding:10px; border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--text); }
.nas-order { border:1px solid var(--border); border-radius:12px; padding:16px; margin:12px 0; }
.nas-order h3 { overflow-wrap:anywhere; }
.nas-order-badge { display:inline-block; border-radius:6px; padding:6px 10px; background:var(--accent-soft); margin-right:12px; }

#connectionSettings, .nas-price-settings { border:1px solid var(--border); border-radius:12px; padding:12px; margin:12px 0; }
#connectionSettings summary, .nas-price-settings summary { min-height:44px; cursor:pointer; font-weight:600; padding:10px 0; }

.nas-notification { position:fixed; bottom:24px; right:24px; z-index:10000; max-width:calc(100vw - 48px); padding:20px; border:2px solid var(--accent,#2864eb); border-radius:16px; background:var(--panel,#fff); color:var(--text,#222); box-shadow:0 8px 32px #0003; display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.nas-notification strong { flex-basis:100%; font-size:20px; }
.nas-portal { max-width:640px; margin:5vh auto; padding:24px; }
.nas-portal input:not([type=checkbox]),.nas-settings input:not([type=checkbox]) { display:block; width:100%; min-height:48px; margin:10px 0 18px; padding:10px; box-sizing:border-box; font:inherit; }
.nas-portal fieldset { border:0; padding:0; margin:0; min-width:0; }
.privacy-notice { padding:20px; border:1px solid #8886; border-radius:14px; margin:20px 0; line-height:1.65; }
.privacy-notice h2 { margin-top:0; font-size:20px; }
.privacy-notice dt { font-weight:700; margin-top:14px; }
.privacy-notice dd { margin:5px 0 0; }
.privacy-check { display:flex; gap:12px; align-items:flex-start; padding:14px 0; line-height:1.5; }
.privacy-check input { flex:0 0 22px; width:22px; height:22px; margin:2px 0; }

.nas-approval { padding:16px; margin:16px 0; border:1px solid #8895a555; border-radius:12px; }
.nas-approval label { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-bottom:12px; }
.nas-approval select { min-height:44px; min-width:180px; font:inherit; padding:8px 12px; border-radius:8px; }

/* Staff account forms keep controls readable on phones and desktop. */
.nas-portal select { display:block; width:100%; min-height:48px; margin:10px 0 18px; padding:10px; font:inherit; }

/* Studio UI: quiet surfaces, clear actions, and theme-aware controls.
   Crop-stage dimensions remain owned by layoutStage(), not this layer. */
:root {
  --radius-lg: 20px;
  --radius-md: 13px;
  --radius-sm: 10px;
  --shadow-card: 0 2px 8px rgba(0,0,0,.035);
}
:root:not([data-theme="gray"]):not([data-theme="dark"]) {
  --bg: #f3f5f6;
  --border: #dce2e6;
  --text: #202b33;
  --text-muted: #596772;
}
body { -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
.topbar { height: auto; min-height: 76px; padding: 14px 24px; gap: 20px; }
.brand { font-size: 18px; letter-spacing: -.04em; }
.brand-ic { width: 38px; height: 38px; padding: 8px; border-radius: 12px; background: var(--accent-soft); }
.topbar-actions { gap: 8px; }
.btn, .step-chip { min-height: 44px; }
.topbar-actions .btn, .bottom-actions .btn { min-height: 44px; }
.btn { letter-spacing: -.015em; }
.btn-icon { min-width: 44px; width: 44px; }
.btn-accent, .btn-primary { box-shadow: 0 2px 4px rgba(0,0,0,.10); }
.btn-secondary { box-shadow: 0 1px 2px rgba(0,0,0,.025); }
.orderbar { padding: 12px 24px; background: var(--bg); }
.order-tab { border-radius: 12px; padding: 10px 14px; }
.order-tab.on { box-shadow: 0 2px 5px rgba(0,0,0,.04); }
.order-tab .tab-sum { font-variant-numeric: tabular-nums; }
.steps { padding: 14px 24px; gap: 8px; background: var(--bg); }
.step-chip { border-radius: 12px; padding: 9px 16px 9px 10px; }
.step-chip.on { background: var(--surface); box-shadow: 0 2px 5px rgba(0,0,0,.04); }
.step-num { width: 26px; height: 26px; flex-shrink: 0; }
.grid { gap: 22px; padding: 24px; padding-bottom: 140px; }
.card { padding: 14px; gap: 12px; border-color: var(--border); }
.card.active { border-color: var(--border); }
.card.active:focus-within, .card.batch-selected { border-color: var(--accent); }
.card .rows { gap: 10px; }
.card .rows > .row > .size-select { height: 46px; font-size: 14px; }
.card .thumb-wrap { border-radius: 10px; }
.size-select, .text-input, .price-row input { border-radius: 10px; }
.empty-state { max-width: 600px; margin: 32px auto 180px; padding: 36px 24px; }
.empty-art { display: block; width: 100px; height: 88px; margin: 0 auto 24px; color: var(--accent-text,var(--accent)); }
.empty-state > span:first-of-type { display: inline-block; color: var(--text); font-size: 23px; font-weight: 750; letter-spacing: -.04em; margin-bottom: 10px; }
.empty-sub { display: inline-block; max-width: 440px; opacity: 1; line-height: 1.8; }
.bottombar { box-shadow: 0 -4px 24px rgba(0,0,0,.04); }
.total { font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.summary { gap: 20px; }
.modal { border: 1px solid var(--border); border-radius: 22px; padding: 28px; }
.modal h2 { font-size: 23px; letter-spacing: -.035em; }
.modal h3 { letter-spacing: -.02em; }
.price-row { gap: 10px; }
.price-row input { min-height: 44px; }
.receipt-row { padding-top: 12px; padding-bottom: 12px; }
.receipt-total { border-radius: 12px; background: var(--bg); padding: 16px; }
.detail-head { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.detail-name { font-size: 16px; line-height: 1.5; }
.detail-row { border-radius: 14px; padding: 14px; }
.detail-add { border: 1px dashed var(--border); width: 100%; justify-content: center; min-height: 48px; }
.detail-foot .btn { min-height: 48px; }
.section-label { font-size: 13px; }
.book-order { margin: 12px 24px; padding: 18px; }
#openAlbum { margin-left: 24px; margin-top: 10px; border: 1px solid var(--border); background: var(--surface); }
.nas-portal { max-width: 680px; margin: 40px auto; padding: 36px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-card); line-height: 1.65; }
.nas-portal h1 { margin: 0 0 12px; font-size: clamp(25px,4vw,34px); letter-spacing: -.045em; line-height: 1.25; }
.nas-portal #intro { color: var(--text-muted); margin-bottom: 28px; }
.nas-portal label:not(.privacy-check) { font-size: 14px; font-weight: 650; }
.nas-portal input:not([type=checkbox]), .nas-settings input:not([type=checkbox]) { border: 1px solid var(--border); border-radius: 10px; padding: 13px 14px; background: var(--bg); color: var(--text); }
.nas-portal #start { width: 100%; min-height: 52px; margin-top: 18px; white-space: normal; }
.nas-portal > a { display: inline-block; min-height: 44px; padding: 10px 0; color: var(--accent-text,var(--accent)); }
.privacy-notice { background: var(--bg); border-color: var(--border); font-size: 14px; }
.privacy-notice h2 { font-size: 17px; line-height: 1.5; }
.privacy-notice dd { color: var(--text-muted); }
.privacy-check { border-bottom: 1px solid var(--border); font-size: 14px; }
.privacy-check input { accent-color: var(--accent); }
.nas-order { background: var(--surface); border-radius: 16px; padding: 20px; }
.nas-order h3 { margin-top: 0; }
@media (min-width: 901px) {
  .grid { grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); }
}
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; }
  .topbar-actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .topbar { padding: 12px; gap: 12px; }
  .brand { font-size: 16px; }
  .brand-ic { width: 32px; height: 32px; padding: 6px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn { font-size: 13px; padding: 10px 12px; }
  .orderbar { padding: 10px 12px; }
  .steps { padding: 10px 12px; gap: 4px; }
  .step-chip { padding: 7px; font-size: 12px; gap: 5px; }
  .grid { grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 12px; padding: 12px; padding-bottom: 230px; }
  .card { padding: 10px; border-radius: 16px; }
  .empty-state { margin: 20px auto 210px; padding: 24px 20px; }
  .empty-state > span:first-of-type { font-size: 20px; }
  .empty-art { width: 80px; height: 70px; margin-bottom: 18px; }
  .modal { padding: 20px; border-radius: 18px; }
  .price-row { gap: 8px; }
  .book-order { margin: 10px 12px; }
  #openAlbum { margin-left: 12px; }
  .nas-portal { margin: 16px 12px; padding: 24px 20px; border-radius: 20px; }
  .privacy-notice { padding: 16px; }
  /* 16px prevents Safari's input-focus zoom. */
  .nas-portal input:not([type=checkbox]), .size-select, .text-input { font-size: 16px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .topbar { min-height: 52px; padding: 6px 12px; flex-wrap: nowrap; }
  .grid { padding-bottom: 90px; }
}
.grid:empty { display: none; }
.book-order:has(#bookOptions[hidden]) { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.book-order:has(#bookOptions[hidden]) > label { flex-direction: row; align-items: center; gap: 16px; flex: 1; }
.book-order:has(#bookOptions[hidden]) > label select { width: min(240px,100%); flex: 1; }
.book-order #openAlbum { margin: 0; order: 2; }
@media (max-width:640px) {
  .book-order:has(#bookOptions[hidden]) { gap: 10px; padding: 12px; }
  .book-order:has(#bookOptions[hidden]) > label { gap: 8px; font-size: 13px; }
}
#settingsModal .field { padding: 18px; border: 1px solid var(--border); border-radius: 14px; margin-bottom: 14px; }
#settingsModal .field-label { margin-bottom: 12px; }
#settingsModal .field > label { display: flex; align-items: center; gap: 10px; line-height: 1.5; }
#settingsModal .hint { line-height: 1.7; }
#settingsModal .segmented { flex-wrap: wrap; max-width: 100%; }
#settingsModal input[role=switch] { appearance: none; width: 44px; height: 26px; flex: 0 0 44px; margin: 0; border-radius: 20px; background: var(--text-muted); cursor: pointer; position: relative; }
#settingsModal input[role=switch]::after { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: white; }
#settingsModal input[role=switch]:checked { background: var(--accent); }
#settingsModal input[role=switch]:checked::after { left: 21px; }
.studio-admin { border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-card); line-height: 1.6; }
.studio-admin h1 { letter-spacing: -.04em; }
.studio-admin form input:not([type=checkbox]), .studio-admin form select { min-height: 48px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--bg); font: inherit; max-width: 100%; }
.studio-admin details { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 16px 0; }
.studio-admin summary { cursor: pointer; font-weight: 650; min-height: 32px; }
.studio-admin .nas-periods .btn { border: 1px solid var(--border); }
@media (max-width:640px) {
  #settingsModal .field { padding: 14px; }
  #settingsModal .segmented-lg .btn-seg { padding: 10px 12px; font-size: 13px; }
  .studio-admin { border-radius: 0; border-left: 0; border-right: 0; }
}
@media (max-width:640px) {
  .card .rows > .row > .size-select { font-size: 16px; }
}
@media (prefers-contrast: more) {
  :root:not([data-theme="gray"]):not([data-theme="dark"]) { --border: #89949d; --text-muted: #37434c; }
}

/* Order workflow uses labels and numbers as well as color. */
.nas-order[data-workflow] { border-inline-start:6px solid var(--workflow-color); padding:20px; margin-block:16px; border-radius:16px; }
.nas-order[data-workflow="pending"] { --workflow-color:#b87500; }
.nas-order[data-workflow="approved"] { --workflow-color:#427de5; }
.nas-order[data-workflow="printed"] { --workflow-color:#8e65d3; }
.nas-order[data-workflow="completed"] { --workflow-color:#2f9a71; }
.nas-workflow-badge { font-size:1.12rem; font-weight:750; border-bottom:2px solid var(--workflow-color); padding-bottom:12px; }
.nas-order.notification-target { outline:3px solid var(--workflow-color); outline-offset:3px; }
.nas-order > .btn { margin:8px 8px 0 0; min-height:44px; }
.nas-order details { margin-block:12px; }
