@import url('/vendor/pretendard/pretendardvariable-dynamic-subset.css');

/* 디자인 토큰 — 클라이언트(design/gs-retail.DESIGN.md)와 같은 값 */
:root {
  --c-primary: #1e2530;
  --c-on-primary: #fff;
  --c-cyan: #00d4ea;
  --c-cyan-soft: #e3f9fc;
  --c-navy: #001c43;
  --c-link: #0072bb;
  --c-bg: #fff;
  --c-surface: #f4f5fb;
  --c-surface-2: #eaecf4;
  --c-border: #d6d9e1;
  --c-border-subtle: #e6e8ef;
  --c-border-strong: #c0c4cd;
  --c-text: #1e2530;
  --c-text-2: #515160;
  --c-text-3: #7c7f8e;
  --c-danger: #d93a2e;
  --c-danger-soft: #fdecea;
  --c-success: #16996a;
  --c-success-soft: #e3f6ee;
  --c-warn: #b25e00;
  --c-warn-soft: #fff1dc;
  --c-scrim: rgba(30, 37, 48, 0.38);
  --shadow-pop: 0 12px 32px rgba(30, 37, 48, 0.14), 0 2px 6px rgba(30, 37, 48, 0.06);
  --r-sm: 8px;
  --r-md: 12px;
  --r-card: 16px;
  --r-lg: 20px;
  --r-pill: 999px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', system-ui, 'Malgun Gothic', sans-serif;
  --mono: 'Cascadia Code', D2Coding, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-primary: #f4f5fb;
    --c-on-primary: #1e2530;
    --c-cyan-soft: rgba(0, 212, 234, 0.12);
    --c-link: #4fb3f0;
    --c-bg: #12161d;
    --c-surface: #181d26;
    --c-surface-2: #222835;
    --c-border: #2c3341;
    --c-border-subtle: #232a36;
    --c-border-strong: #3a4252;
    --c-text: #e9ebf2;
    --c-text-2: #b4b8c5;
    --c-text-3: #878c9b;
    --c-danger: #ff6b5e;
    --c-danger-soft: rgba(255, 107, 94, 0.12);
    --c-success: #3fd09a;
    --c-success-soft: rgba(63, 208, 154, 0.12);
    --c-warn: #ffb35c;
    --c-warn-soft: rgba(255, 179, 92, 0.12);
    --c-scrim: rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--c-link);
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid rgba(0, 212, 234, 0.55);
  outline-offset: 2px;
}
.hidden {
  display: none !important;
}

/* ── 공통 ── */
.logo {
  width: 32px;
  height: 32px;
  flex: none;
  display: block;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.12s, background 0.12s;
}
.btn-primary {
  background: var(--c-primary);
  color: var(--c-on-primary);
}
.btn-primary:hover {
  opacity: 0.9;
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: default;
}
.btn-ghost {
  background: transparent;
  border-color: var(--c-border);
  color: var(--c-text);
}
.btn-ghost:hover {
  background: var(--c-surface);
}
.btn-danger {
  background: transparent;
  border-color: var(--c-border);
  color: var(--c-danger);
}
.btn-danger:hover {
  background: var(--c-danger-soft);
}
.btn-ghost:disabled,
.btn-danger:disabled {
  opacity: 0.45;
  cursor: default;
  background: transparent;
}
.btn.sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--r-sm);
}
.btn.lg {
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
  border-radius: var(--r-md);
}
.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-bg);
  outline: none;
}
.input:focus {
  border-color: var(--c-text-2);
  box-shadow: 0 0 0 3px rgba(0, 212, 234, 0.25);
}
textarea.input {
  height: auto;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
}
.hint {
  font-size: 12.5px;
  color: var(--c-text-3);
  line-height: 1.5;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 700;
  background: var(--c-surface-2);
  color: var(--c-text-2);
  white-space: nowrap;
}
.badge.cyan {
  background: var(--c-cyan-soft);
  color: var(--c-navy);
}
@media (prefers-color-scheme: dark) {
  .badge.cyan {
    color: var(--c-cyan);
  }
}
.badge.green {
  background: var(--c-success-soft);
  color: var(--c-success);
}
.badge.red {
  background: var(--c-danger-soft);
  color: var(--c-danger);
}
.badge.warn {
  background: var(--c-warn-soft);
  color: var(--c-warn);
}
.notes {
  line-height: 1.7;
  font-size: 14.5px;
  color: var(--c-text);
}
.notes > :first-child {
  margin-top: 0;
}
.notes > :last-child {
  margin-bottom: 0;
}
.notes h1,
.notes h2,
.notes h3 {
  font-size: 15.5px;
  margin: 16px 0 6px;
}
.notes ul,
.notes ol {
  padding-left: 22px;
  margin: 6px 0 10px;
}
.notes code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--c-surface);
  border-radius: 6px;
  padding: 1px 5px;
}
.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--c-text-3);
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-text-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 제품 아이콘(올린 이미지 또는 기본 로고) — 둥근 정사각형으로 맞춘다 */
.picon {
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 22%;
}
.product .picon {
  width: 44px;
  height: 44px;
}
.nav a .picon {
  width: 22px;
  height: 22px;
}
.nav a .nav-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-head .head-picon {
  width: 48px;
  height: 48px;
}
.icon-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.icon-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--r-card);
  background: var(--c-surface);
  cursor: pointer;
}
.icon-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.icon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.icon-zone {
  transition: border-color 0.12s, background 0.12s;
}
.icon-zone.over {
  border-color: var(--c-cyan);
  background: var(--c-cyan-soft);
}
.field .icon-zone {
  border: 1px dashed var(--c-border);
  border-radius: var(--r-card);
  padding: 12px;
}
.field .icon-zone.over {
  border-color: var(--c-cyan);
}
.icon-zone.busy .icon-preview {
  opacity: 0.5;
}

/* ── 공개 다운로드 페이지 ── */
.site-head {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--c-border-subtle);
}
.site-head .name {
  font-weight: 700;
  font-size: 17px;
  flex: 1;
}
.site-head a.admin-link {
  font-size: 13px;
  color: var(--c-text-3);
  text-decoration: none;
}
.hero {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 16px 8px;
}
.hero h1 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.hero p {
  margin: 0;
  color: var(--c-text-2);
}
.products {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.product {
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--r-lg);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 24px;
}
.product .title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.product h2 {
  margin: 0;
  font-size: 20px;
}
.product .meta {
  color: var(--c-text-3);
  font-size: 13.5px;
  margin-top: 4px;
}
.product .desc {
  color: var(--c-text-2);
  margin: 12px 0 0;
  grid-column: 1 / -1;
}
.product .dl {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.product .latest-notes {
  grid-column: 1 / -1;
  margin-top: 14px;
  background: var(--c-surface);
  border-radius: var(--r-card);
  padding: 18px 20px;
}
.product details {
  grid-column: 1 / -1;
  margin-top: 6px;
}
.product summary {
  cursor: pointer;
  color: var(--c-text-2);
  font-size: 14px;
  padding: 6px 0;
}
.history {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.history li {
  border-top: 1px solid var(--c-border-subtle);
  padding: 14px 0;
}
.history .row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.history .row b {
  font-size: 15px;
}
.site-foot {
  text-align: center;
  color: var(--c-text-3);
  font-size: 12.5px;
  padding: 24px;
}
@media (max-width: 640px) {
  .product {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .product .dl {
    align-items: stretch;
  }
}

/* ── 관리자 ── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--c-surface);
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--r-lg);
  padding: 32px 28px;
}
.login-card .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  text-align: center;
}
.login-card h1 {
  margin: 0;
  font-size: 21px;
}
.error {
  background: var(--c-danger-soft);
  color: var(--c-danger);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}
.nav {
  background: var(--c-surface);
  border-right: 1px solid var(--c-border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 4px;
}
.nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  padding: 4px 6px 16px;
}
.nav .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-3);
  padding: 12px 8px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav .label button {
  border: 0;
  background: none;
  color: var(--c-text-2);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--c-text);
  text-decoration: none;
  font-size: 14px;
  border: 1px solid transparent;
}
.nav a:hover {
  background: var(--c-surface-2);
}
.nav a.on {
  background: var(--c-bg);
  border-color: var(--c-border-subtle);
  font-weight: 600;
}
.nav a .count {
  margin-left: auto;
  font-size: 12px;
  color: var(--c-text-3);
}
.nav .grow {
  flex: 1;
}
.nav .who {
  font-size: 13px;
  color: var(--c-text-3);
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.main {
  padding: 28px 32px 64px;
  min-width: 0;
}
.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h1 {
  font-size: 22px;
  margin: 0;
}
.page-head .sub {
  color: var(--c-text-3);
  font-size: 13.5px;
  margin-top: 4px;
}
.page-head .spacer {
  flex: 1;
}
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--c-border-subtle);
  margin-bottom: 20px;
}
.tabs button {
  border: 0;
  background: none;
  height: 40px;
  padding: 0 14px;
  color: var(--c-text-2);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.on {
  color: var(--c-text);
  font-weight: 700;
  border-bottom-color: var(--c-primary);
}
.card {
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--r-card);
  background: var(--c-bg);
}
.card.pad {
  padding: 20px;
}
table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.list th,
table.list td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border-subtle);
  vertical-align: middle;
}
table.list th {
  font-size: 12.5px;
  color: var(--c-text-3);
  font-weight: 600;
  background: var(--c-surface);
}
table.list tr:last-child td {
  border-bottom: 0;
}
table.list th:first-child {
  border-top-left-radius: var(--r-card);
}
table.list th:last-child {
  border-top-right-radius: var(--r-card);
}
table.list td.ver b {
  font-size: 15px;
}
table.list td.actions {
  text-align: right;
  white-space: nowrap;
}
.switch {
  width: 36px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--c-border-strong);
  border: 0;
  position: relative;
  vertical-align: middle;
  transition: background 0.15s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch.on {
  background: var(--c-success);
}
.switch.on.red {
  background: var(--c-danger);
}
.switch.on::after {
  transform: translateX(14px);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--c-surface);
  border-radius: var(--r-card);
  padding: 16px 18px;
}
.stat .k {
  font-size: 12.5px;
  color: var(--c-text-3);
}
.stat .v {
  font-size: 26px;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar {
  display: grid;
  grid-template-columns: 120px 1fr 60px;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
.bar .track {
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--c-surface-2);
  overflow: hidden;
}
.bar .fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--c-primary);
}
.bar .fill.latest {
  background: var(--c-cyan);
}
.bar .n {
  text-align: right;
  color: var(--c-text-2);
  font-variant-numeric: tabular-nums;
}
pre.code {
  background: var(--c-surface);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 8px 0 0;
}
.token-box {
  background: var(--c-warn-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  word-break: break-all;
}
.token-box code {
  font-family: var(--mono);
  font-size: 13px;
}

/* 모달 */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--c-scrim);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--c-bg);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: 24px;
}
.modal h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.drop {
  border: 2px dashed var(--c-border);
  border-radius: var(--r-card);
  padding: 22px;
  text-align: center;
  color: var(--c-text-2);
  cursor: pointer;
  margin-bottom: 14px;
}
.drop.over {
  border-color: var(--c-cyan);
  background: var(--c-cyan-soft);
}
.drop b {
  color: var(--c-text);
}
.checks {
  display: flex;
  gap: 20px;
  margin: 4px 0 6px;
  font-size: 14px;
}
.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--c-surface-2);
  overflow: hidden;
  margin-top: 12px;
}
.progress > div {
  height: 100%;
  background: var(--c-cyan);
  width: 0;
  transition: width 0.2s;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--c-primary);
  color: var(--c-on-primary);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-pop);
  z-index: 80;
  font-size: 14px;
}
.toast.err {
  background: var(--c-danger);
  color: #fff;
}
@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .nav {
    border-right: 0;
    border-bottom: 1px solid var(--c-border-subtle);
  }
  .main {
    padding: 20px 16px 48px;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .row2 {
    grid-template-columns: 1fr;
  }
}
