:root {
  --bg: #f4f5f3;
  --card: #ffffff;
  --ink: #1c2321;
  --ink-dim: #6b7370;
  --line: #dde1dc;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --pending: #96631d;
  --pending-bg: #f7ecd8;
  --approved: #2f6f5e;
  --approved-bg: #e2efe9;
  --rejected: #8c2f3d;
  --rejected-bg: #f4e3e5;
  --completed: #3a4a63;
  --completed-bg: #e5e9f0;
  --printing: #3d5a8a;
  --printing-bg: #e4eaf5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Apple SD Gothic Neo", "Pretendard Variable", Pretendard, "Malgun Gothic", sans-serif;
  line-height: 1.6;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.page.wide { max-width: 880px; }

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.3rem;
}

.subtitle {
  color: var(--ink-dim);
  font-size: 0.92rem;
  margin: 0 0 2rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 1rem 0 0.4rem;
}
label:first-child { margin-top: 0; }

input[type="text"], textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
}

textarea { resize: vertical; min-height: 4.5rem; }

input[type="file"] {
  width: 100%;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

button {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
  margin-top: 1.3rem;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-approve { background: var(--approved-bg); color: var(--approved); }
.btn-reject { background: var(--rejected-bg); color: var(--rejected); }
.btn-complete { background: var(--completed-bg); color: var(--completed); }

.status-msg {
  margin-top: 1rem;
  font-size: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  display: none;
}
.status-msg.show { display: block; }
.status-msg.ok { background: var(--approved-bg); color: var(--approved); }
.status-msg.err { background: var(--rejected-bg); color: var(--rejected); }

.orders {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.order {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: flex;
  gap: 1rem;
}

.order img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
  flex-shrink: 0;
}

.file-icon {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  background: var(--completed-bg);
  color: var(--completed);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  padding: 0.3rem;
  text-decoration: none;
}
.file-icon .ext { font-size: 1.3rem; }
.file-icon span.name {
  font-weight: 500;
  word-break: break-all;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.hint {
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-top: 0.4rem;
}

select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
}

.pickup-box {
  margin-top: 0.8rem;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}
.pickup-label { font-size: 0.8rem; color: var(--ink-dim); margin-bottom: 0.4rem; }
.pickup-row { display: flex; gap: 0.5rem; }
.pickup-row input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--card);
  color: var(--ink-dim);
}
.pickup-row button {
  background: var(--completed-bg);
  color: var(--completed);
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.printer-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.5rem;
}
.printer-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  text-decoration: none;
  color: var(--ink);
}
.printer-card:hover { border-color: var(--accent); }
.printer-name { font-weight: 700; }
.printer-location { font-size: 0.85rem; color: var(--ink-dim); }
.printer-arrow { color: var(--ink-dim); }

.pickup-page-name {
  font-size: 0.95rem;
  color: var(--ink-dim);
  margin-bottom: 0.2rem;
}

.order-body { flex: 1; min-width: 0; }

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.order-requester { font-weight: 700; }

.order-time { font-size: 0.78rem; color: var(--ink-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }

.order-note { color: var(--ink-dim); font-size: 0.88rem; margin: 0.25rem 0 0.6rem; }

.badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}
.badge.pending { background: var(--pending-bg); color: var(--pending); }
.badge.scheduled { background: var(--pending-bg); color: var(--pending); }
.badge.approved { background: var(--approved-bg); color: var(--approved); }
.badge.confirmed { background: var(--approved-bg); color: var(--approved); }
.badge.sent_to_printer { background: var(--approved-bg); color: var(--approved); }
.badge.rejected { background: var(--rejected-bg); color: var(--rejected); }
.badge.declined { background: var(--rejected-bg); color: var(--rejected); }
.badge.schedule_rejected { background: var(--rejected-bg); color: var(--rejected); }
.badge.printing { background: var(--printing-bg); color: var(--printing); }
.badge.completed { background: var(--completed-bg); color: var(--completed); }
.badge.submitted { background: var(--pending-bg); color: var(--pending); }
.badge.assigned { background: var(--approved-bg); color: var(--approved); }
.badge.printed { background: var(--printing-bg); color: var(--printing); }
.badge.shipped { background: var(--approved-bg); color: var(--approved); }

.order-actions { display: flex; gap: 0.5rem; }

.empty {
  text-align: center;
  color: var(--ink-dim);
  padding: 2.5rem 1rem;
  font-size: 0.9rem;
}

.conn-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rejected);
  margin-right: 0.4rem;
}
.conn-dot.live { background: var(--approved); }

.conn-label {
  font-size: 0.8rem;
  color: var(--ink-dim);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
}

nav.top {
  max-width: 880px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0;
  font-size: 0.85rem;
}
nav.top a { color: var(--ink-dim); text-decoration: none; }
nav.top a:hover { color: var(--accent); }

/* --- VIZO NAIL ART additions --- */

.fulfillment-toggle {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.fulfillment-toggle button {
  flex: 1;
  background: var(--bg);
  color: var(--ink-dim);
  border: 1px solid var(--line);
}
.fulfillment-toggle button.active {
  background: var(--approved-bg);
  color: var(--approved);
  border-color: var(--approved);
}

.hand-group { margin-top: 1.2rem; }
.hand-group h3 { font-size: 0.9rem; color: var(--ink-dim); margin: 0 0 0.6rem; }

.nail-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
}
@media (max-width: 520px) {
  .nail-grid { grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
}

.nail-slot {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
  cursor: pointer;
}
.nail-slot.filled { border-color: var(--accent); }
.nail-slot .slot-label { font-size: 0.68rem; color: var(--ink-dim); margin-bottom: 0.35rem; }
.nail-slot select.slot-size {
  width: 100%;
  padding: 0.15rem 0.2rem;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}
.nail-slot .slot-preview {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  background: var(--card);
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.nail-slot .slot-preview img { width: 100%; height: 100%; object-fit: cover; }
.nail-slot .slot-preview .plus { color: var(--ink-dim); font-size: 1.3rem; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--card);
  border-radius: 14px;
  padding: 1.3rem;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-box h3 { margin-top: 0; }
.modal-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.modal-tabs button {
  flex: 1;
  background: var(--bg);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 0.5rem;
}
.modal-tabs button.active { background: var(--approved-bg); color: var(--approved); border-color: var(--approved); }

.design-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}
.design-thumb {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem;
  cursor: pointer;
  text-align: center;
  background: var(--bg);
}
.design-thumb:hover { border-color: var(--accent); }
.design-thumb img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 6px; }
.design-thumb .name { font-size: 0.72rem; margin-top: 0.3rem; color: var(--ink-dim); }

.modal-close {
  width: 100%;
  margin-top: 1rem;
  background: var(--bg);
  color: var(--ink-dim);
  border: 1px solid var(--line);
}

.upload-box { text-align: center; padding: 1.5rem 0.5rem; }
.upload-box input[type="file"] { margin-top: 0.8rem; }

.timeline {
  display: flex;
  justify-content: space-between;
  margin: 1.5rem 0;
}
.timeline .step {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--ink-dim);
  position: relative;
}
.timeline .step .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--line);
  margin: 0 auto 0.4rem;
}
.timeline .step.done .dot { background: var(--approved); }
.timeline .step.current .dot { background: var(--printing); }
.timeline .step::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: -1;
}
.timeline .step:last-child::after { display: none; }
.timeline .step.done::after { background: var(--approved); }

.mini-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  margin-top: 1rem;
}
.mini-grid img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.mini-cell { text-align: center; }
.mini-size { display: block; font-size: 0.68rem; color: var(--ink-dim); margin-top: 0.15rem; }
.pass-download-btn {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.15rem 0.2rem;
  font-size: 0.62rem;
  background: var(--printing-bg);
  color: var(--printing);
  border: none;
  border-radius: 5px;
}

.fulfillment-box {
  margin-top: 1rem;
  background: var(--bg);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
}

.crop-wrap { display: flex; justify-content: center; margin: 1rem 0; }
.crop-stage {
  width: 240px;
  height: 320px;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  clip-path: path("M120,16 C184,16 214,104 214,184 C214,268 170,308 120,308 C70,308 26,268 26,184 C26,104 56,16 120,16 Z");
}
.crop-stage img {
  position: absolute;
  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
}
.crop-stage.dragging img { cursor: grabbing; }
#crop-zoom { width: 100%; margin-top: 0.3rem; }

.studio-order { margin-bottom: 1.2rem; }
.studio-actions { display: flex; gap: 0.5rem; margin-top: 0.9rem; flex-wrap: wrap; }
.tracking-input {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
}
.tracking-input input { flex: 1; }
.tracking-input button { flex-shrink: 0; }
