:root {
  --bg: #f6f7f9; --panel: #fff; --line: #e5e8ec; --text: #1b1f24; --sub: #6b7280;
  --brand: #0f9d8a; --brand-d: #0b7f70; --brand-soft: #e6f6f3; --danger: #e5484d; --warn: #f5a524;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", sans-serif; font-size: 14px; }
a { color: var(--brand-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--sub); }
.small { font-size: 12px; }

/* 버튼·입력 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit;
  font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f2f4f6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; height: 46px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
label.f { display: block; margin: 0 0 14px; }
label.f > span { display: block; font-weight: 600; margin-bottom: 6px; }
input, select, textarea { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text); }
textarea { height: auto; padding: 10px 12px; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox] { width: 16px; height: 16px; vertical-align: -3px; accent-color: var(--brand); }
.err { color: var(--danger); font-size: 12px; margin-top: 4px; min-height: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.spacer { flex: 1; }

/* 인증 화면 */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; }
.logo { font-weight: 800; font-size: 22px; color: var(--brand); letter-spacing: -.5px; }
.logo b { color: var(--text); }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { flex: 1; height: 42px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--sub);
  cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-color: var(--text); }
.agree { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.agree label { display: block; padding: 5px 0; cursor: pointer; }
.agree .all { font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 6px; }

/* 앱 레이아웃 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .logo { padding: 4px 10px 18px; }
.side nav a { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.side nav a:hover { background: #f2f4f6; text-decoration: none; }
.side nav a.on { background: var(--brand-soft); color: var(--brand-d); font-weight: 700; }
.side .sec { font-size: 12px; color: var(--sub); padding: 14px 10px 6px; }
.side .who { border-top: 1px solid var(--line); margin-top: 16px; padding: 14px 10px 0; font-size: 13px; }
.main { padding: 28px 32px 60px; max-width: 1200px; width: 100%; }
.topbar { display: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .v { font-size: 22px; font-weight: 800; margin-top: 4px; }
.banner { background: linear-gradient(120deg, #0f9d8a, #1f6fd1); color: #fff; border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.banner .btn { background: #fff; color: var(--brand-d); border: 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.steps .card { padding: 18px; }
.steps .n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-d);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 8px; }

/* 표 */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--sub); font-weight: 600; background: #fafbfc; }
td.num, th.num { text-align: right; white-space: nowrap; }
th { white-space: nowrap; }
.main { min-width: 0; }
.tbl { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; background: #eee; display: block; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f3; color: #4b5563; }
.badge.ready { background: #fff4e0; color: #a05a00; }
.badge.uploaded { background: var(--brand-soft); color: var(--brand-d); }
.badge.failed { background: #fde8e8; color: var(--danger); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar input, .toolbar select { width: auto; height: 36px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }

/* 상품 편집 */
.edit { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.imgs .it { position: relative; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #eee; aspect-ratio: 1; }
.imgs .it img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imgs .it.main { border-color: var(--brand); }
.imgs .it .tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; background: rgba(0,0,0,.5); }
.imgs .it .tools button { border: 0; background: none; color: #fff; cursor: pointer; padding: 3px 6px; font-size: 12px; }
.imgs .it .tag { position: absolute; top: 4px; left: 4px; background: var(--brand); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.price-box { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.price-box div { display: flex; justify-content: space-between; padding: 3px 0; }
pre.payload { max-height: 360px; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; font-size: 12px; }

/* 플랜 */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan .price { font-size: 26px; font-weight: 800; margin: 8px 0; }
.plan ul { padding-left: 18px; color: var(--sub); margin: 8px 0 16px; }

/* 모달·토스트 */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 480px; padding: 24px; max-height: 90vh; overflow: auto; }
.choice { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 8px; cursor: pointer; }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 6px; align-items: center; }
#toast div { background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); }
.devbox { background: #fff8e6; border: 1px dashed var(--warn); padding: 10px; border-radius: 8px; font-size: 12px; word-break: break-all; margin-top: 12px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; position: fixed; z-index: 40; width: 240px; box-shadow: var(--shadow); }
  .side.open { display: block; }
  .topbar { display: flex; align-items: center; gap: 10px; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .main { padding: 18px 16px 60px; min-width: 0; }
  .toolbar > * { flex: 1 1 auto; }
  .toolbar input { flex-basis: 100%; }
  .toolbar .spacer { display: none; }
  .tbl table { min-width: 720px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps, .edit, .grid2 { grid-template-columns: 1fr; }
}

/* 검수 */
.risk { border-left: 3px solid var(--line); background: #fafbfc; padding: 8px 10px; border-radius: 6px; margin-bottom: 6px; font-size: 13px; }
.risk.block { border-color: var(--danger); background: #fdf2f2; }
.risk.warn { border-color: var(--warn); background: #fff8eb; }
.risk.info { border-color: #9ca3af; }
.risk.ok { border-color: var(--brand); background: var(--brand-soft); }
.risk .hits { color: var(--sub); font-size: 12px; }
.review-item { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; padding: 14px; }
.pipe { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pipe i { color: var(--sub); font-style: normal; }
.pipe .p { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--text); min-width: 92px; }
.pipe .p:hover { text-decoration: none; border-color: var(--brand); }
.pipe .p span { display: block; font-size: 12px; color: var(--sub); }
.pipe .p b { font-size: 20px; }
.pipe .p.b b { color: var(--danger); }
.pipe .p.w b { color: #a05a00; }
.pipe .p.ok b { color: var(--brand-d); }
.plan.hot { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.tabs button { white-space: nowrap; }
@media (max-width: 860px) { .tabs { overflow-x: auto; } .tabs button { flex: 0 0 auto; padding: 0 12px; } }
