/* ==========================================================================
   AI 셀러 LIVE — 공용 디자인 시스템 (뷰어 + 관리자)
   ========================================================================== */
:root {
  --bg: #0b1020;
  --bg-soft: #121a33;
  --card: #151d38;
  --card-2: #1b2447;
  --line: #273156;
  --txt: #e9edfb;
  --muted: #93a0c4;
  --accent: #6366f1;
  --accent-2: #a855f7;
  --live: #ff3b5c;
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 520px at 85% -12%, #1e2a58 0%, transparent 62%),
    radial-gradient(900px 460px at -10% 10%, #2a1c4d 0%, transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ---------- 스크롤바 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c3char; }
::-webkit-scrollbar-thumb { background: #2b3560; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a80; }

/* ---------- 상단 헤더 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: rgba(11, 16, 32, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.4px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(99, 102, 241, .45);
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.topbar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--card-2); border: 1px solid var(--line); color: var(--txt);
  white-space: nowrap;
}
.chip.live { background: rgba(255, 59, 92, .14); border-color: rgba(255, 59, 92, .5); color: #ff8fa3; }
.chip.viewers { background: rgba(99, 102, 241, .14); border-color: rgba(99, 102, 241, .45); color: #b9bcff; }
.nav-link { padding: 7px 13px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--muted); border: 1px solid transparent; }
.nav-link:hover { color: var(--txt); background: var(--card-2); border-color: var(--line); }

/* ---------- LIVE 점 ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,59,92,.6); } 50% { opacity: .7; box-shadow: 0 0 0 7px rgba(255,59,92,0); } }

/* ---------- 레이아웃 ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 18px 20px 60px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 18px; align-items: start; }

/* ---------- 방송 화면 ---------- */
.stage { display: flex; flex-direction: column; gap: 14px; }
.screen {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  background: linear-gradient(135deg, #1a2350, #2a1a4d);
  transition: background .8s ease;
  isolation: isolate;
}
.screen::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(620px 320px at 50% 110%, rgba(0,0,0,.55), transparent 70%);
  pointer-events: none;
}
.screen .glow {
  position: absolute; width: 70%; height: 70%; left: 15%; top: -20%;
  background: radial-gradient(circle, var(--seller-color, #6366f1) 0%, transparent 62%);
  opacity: .5; filter: blur(46px); animation: float 9s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(22px) scale(1.07); } }

.screen .live-tag {
  position: absolute; top: 14px; left: 14px; z-index: 3;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--live); color: #fff; font-weight: 800; font-size: 12.5px; letter-spacing: .8px;
  padding: 6px 13px; border-radius: 8px; box-shadow: 0 6px 18px rgba(255,59,92,.4);
}
.screen .timer-tag {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.14);
  padding: 6px 12px; border-radius: 8px; backdrop-filter: blur(8px);
}
.screen .ai-tag {
  position: absolute; bottom: 14px; left: 14px; z-index: 3;
  font-size: 11.5px; font-weight: 700; color: #cbd5ff;
  background: rgba(0,0,0,.42); border: 1px solid rgba(255,255,255,.12);
  padding: 5px 11px; border-radius: 999px; backdrop-filter: blur(8px);
}

/* AI 셀러 음성 토글 버튼 */
.screen .voice-btn {
  position: absolute; top: 14px; right: 92px; z-index: 4;
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 800; color: #e6ebff;
  background: rgba(0,0,0,.48); border: 1px solid rgba(255,255,255,.16);
  padding: 6px 13px; border-radius: 999px; backdrop-filter: blur(8px);
  transition: background .18s, border-color .18s, transform .12s;
}
.screen .voice-btn:hover { background: rgba(0,0,0,.64); }
.screen .voice-btn:active { transform: scale(.96); }
.screen .voice-btn.on {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: voicePulse 2.4s ease-in-out infinite;
}
.screen .voice-btn .vb-icon { font-size: 13px; line-height: 1; }
@keyframes voicePulse {
  0%,100% { box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
  50% { box-shadow: 0 6px 26px color-mix(in srgb, var(--accent) 78%, transparent); }
}
@media (max-width: 620px) {
  .screen .voice-btn { right: 12px; top: 52px; }
  .screen .voice-btn .vb-label { display: none; }
}

/* ---------- 홈쇼핑 스테이지 (낭만 홈쇼핑 셀러 진행 화면) ---------- */
.screen.homeshop { background: linear-gradient(135deg, #0a1226 0%, #131a3d 46%, #251a52 100%); }
.hs-topbar {
  position: absolute; top: 14px; left: 14px; right: 14px; z-index: 4;
  display: flex; align-items: center; gap: 10px;
}
.hs-prog {
  font-size: 12.5px; font-weight: 800; color: #e6ebff; letter-spacing: -.2px;
  background: rgba(0,0,0,.44); border: 1px solid rgba(255,255,255,.12);
  padding: 6px 12px; border-radius: 8px; max-width: 46%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hs-spacer { flex: 1; }
/* LIVE 배지가 홈쇼핑 상단바 안에서는 flex 흐름을 따라가도록 (프로그램 pill과 겹침 방지) */
.hs-topbar .live-tag { position: static; top: auto; left: auto; z-index: 1; }

.hs-grid {
  position: absolute; inset: 58px 16px 104px; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 16px;
}

/* 셀러 (제스처하며 상품 설명) */
.hs-seller {
  position: relative; border-radius: 18px; overflow: hidden;
  background: radial-gradient(120% 120% at 30% 0%, #1c2450 0%, #0b1128 100%);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 22px 52px rgba(0,0,0,.55);
}
.hs-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hs-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.hs-avatar-img {
  width: 148px; height: 148px; border-radius: 30px; object-fit: cover;
  background: #fff; border: 4px solid rgba(255,255,255,.9);
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
}
.hs-onair {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  font-size: 11px; font-weight: 800; color: #fff; background: var(--live);
  padding: 4px 9px; border-radius: 7px; letter-spacing: .3px;
  box-shadow: 0 6px 16px rgba(255,59,92,.45);
}
.hs-nameplate {
  /* 셀러를 가리지 않도록 폭 전체 띠가 아닌 내용 크기의 작은 알약(pill) 형태로 표시 */
  position: absolute; left: 12px; bottom: 12px; z-index: 3;
  display: inline-flex; align-items: center; gap: 7px;
  max-width: calc(100% - 24px);
  background: rgba(6,9,20,.5); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; padding: 4px 9px; backdrop-filter: blur(10px);
}
.hs-np-avatar {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center; font-size: 14px; background: #fff;
  border: 2px solid rgba(255,255,255,.85); overflow: hidden;
}
.hs-np-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hs-np-meta { min-width: 0; }
.hs-np-name { font-size: 12px; font-weight: 800; letter-spacing: -.4px; color: #f2f5ff; }
.hs-np-cat {
  font-size: 10.5px; color: #c3cbf0; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 상품 패널 */
.hs-product {
  position: relative; border-radius: 18px; overflow: hidden;
  background: rgba(255,255,255,.97); display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: 0 22px 52px rgba(0,0,0,.55);
}
.hs-product img { width: 100%; height: 100%; object-fit: contain; }
.hs-product .bigemoji { font-size: 96px; }
.hs-product .badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--live); color: #fff; font-size: 11.5px; font-weight: 800;
  padding: 5px 11px; border-radius: 7px; letter-spacing: .4px;
  box-shadow: 0 6px 16px rgba(255,59,92,.42);
}

/* 스트리밍 자막 (음성 대본) */
.hs-cc {
  position: absolute; left: 8%; right: 8%; bottom: 18px; z-index: 5;
  display: flex; gap: 9px; align-items: flex-start;
  background: rgba(6,9,20,.8); border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px; padding: 11px 15px; backdrop-filter: blur(10px);
  box-shadow: 0 14px 34px rgba(0,0,0,.5);
}
.hs-cc.hidden { display: none; }
.cc-tag {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 800; color: #0b1020;
  background: #ffd166; padding: 3px 8px; border-radius: 6px; letter-spacing: .3px;
}
.cc-text {
  font-size: 15px; font-weight: 700; color: #f2f5ff; line-height: 1.5;
  min-height: 22px; word-break: keep-all;
}
.cc-text.fade { animation: ccIn .32s ease-out; }
@keyframes ccIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.screen .offair {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 4;
  background: rgba(6,10,22,.86); color: var(--muted);
}

/* ---------- 제품 정보 바 ---------- */
.product-bar {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.pb-top { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.pb-thumb {
  width: 74px; height: 74px; border-radius: 14px; flex: 0 0 auto; display: grid; place-items: center;
  font-size: 36px; background: #0f1630; border: 1px solid var(--line); overflow: hidden;
}
.pb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pb-main { flex: 1; min-width: 200px; }
.pb-name { font-size: 19px; font-weight: 800; letter-spacing: -.4px; }
.pb-desc { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.pb-feats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.feat { font-size: 11.5px; color: #b9c2ea; background: #0f1630; border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; }

.price-row { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.price-disc { font-size: 27px; font-weight: 900; color: #ff6b85; letter-spacing: -1px; }
.price-orig { font-size: 14px; color: var(--muted); text-decoration: line-through; }
.price-now { font-size: 27px; font-weight: 900; letter-spacing: -1px; }
.save { font-size: 12px; font-weight: 700; color: var(--ok); background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.35); padding: 3px 9px; border-radius: 999px; }
.stock { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.stock b { color: var(--warn); }

.slot {
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.slot-label { font-size: 12px; color: var(--muted); }
.slot-track { position: relative; flex: 1; min-width: 140px; height: 8px; border-radius: 99px; background: #0d142c; overflow: hidden; }
.slot-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width 1s linear; }
.slot-time { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; color: #c7cdf5; }

.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: var(--card-2); color: var(--txt);
  padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px; transition: .16s;
}
.btn:hover { transform: translateY(-1px); border-color: #3c4a86; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; box-shadow: 0 10px 24px rgba(99,102,241,.4); }
.btn.buy { background: linear-gradient(135deg, #ff3b5c, #ff7a45); border: none; box-shadow: 0 10px 24px rgba(255,59,92,.36); flex: 1; justify-content: center; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 13px; font-size: 12.5px; border-radius: 9px; }
.btn.danger { background: rgba(255,59,92,.12); border-color: rgba(255,59,92,.4); color: #ff8fa3; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- 셀러 소개 카드 ---------- */
.seller-card {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.seller-card img, .seller-card .se { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: #fff; display: grid; place-items: center; font-size: 26px; flex: 0 0 auto; }
.seller-card .sc-name { font-weight: 800; font-size: 15px; }
.seller-card .sc-tag { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.seller-card .sc-bio { font-size: 12.5px; color: #b7c0e6; margin-top: 6px; line-height: 1.5; }

/* ---------- 사이드 ---------- */
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 74px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 8px; padding: 13px 16px;
  border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 800;
}
.panel-head .sub { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* 채팅 */
.chat-list { height: 320px; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-item { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.45; animation: slidein .28s ease; }
@keyframes slidein { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.chat-item .who { font-weight: 700; flex: 0 0 auto; }
.chat-item .body { color: #d8def6; word-break: break-word; }
.chat-item.me .body { color: #bcd0ff; background: rgba(99,102,241,.14); padding: 2px 8px; border-radius: 8px; }
.chat-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 26px 0; }
.chat-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.chat-form input[type=text] {
  flex: 1; background: #0d142c; border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; outline: none;
}
.chat-form input:focus { border-color: var(--accent); }
.nick-row { display: flex; gap: 8px; padding: 10px 14px 0; }
.nick-row input { width: 100%; background: #0d142c; border: 1px solid var(--line); color: var(--txt); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; outline: none; }

/* 편성 목록 */
.up-list { max-height: 268px; overflow-y: auto; }
.up-item { display: flex; gap: 11px; align-items: center; padding: 11px 15px; border-bottom: 1px solid rgba(39,49,86,.6); }
.up-item:last-child { border-bottom: none; }
.up-item.now { background: rgba(99,102,241,.13); }
.up-dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex: 0 0 auto; }
.up-info { flex: 1; min-width: 0; }
.up-info .t { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-info .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.up-time { font-size: 11.5px; font-weight: 700; color: #b9c2ea; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 카테고리 그리드 ---------- */
.grid-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 15px;
  display: flex; flex-direction: column; gap: 6px; transition: .16s;
}
.cat-card:hover { transform: translateY(-2px); border-color: #3c4a86; }
.cat-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cat-card .ce { font-size: 26px; }
.cat-card .cn { font-size: 14px; font-weight: 800; }
.cat-card .cs { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* ---------- 섹션 ---------- */
.section-title { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.section-title .bar { width: 4px; height: 19px; border-radius: 4px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.section-title .cnt { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* 상품 그리드(카테고리별) */
.grid-prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 13px; }
.prod-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: .16s; color: inherit; text-decoration: none; }
.prod-card:hover { transform: translateY(-2px); border-color: #3c4a86; }
.prod-card.live { border-color: var(--live); box-shadow: 0 0 0 1px rgba(255,59,92,.5); }
.prod-share {
  margin-top: 8px; font-size: 11.5px; font-weight: 700; color: #b9c2ea;
  background: #0f1630; border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 10px; text-align: center; cursor: pointer; transition: .15s;
}
.prod-share:hover { border-color: var(--accent); color: #e9edfb; }
.prod-shot { aspect-ratio: 4/3; display: grid; place-items: center; font-size: 54px; background: #0f1630; position: relative; overflow: hidden; }
.prod-shot img { width: 100%; height: 100%; object-fit: cover; }
.prod-shot .livepill { position: absolute; top: 8px; left: 8px; background: var(--live); color: #fff; font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 6px; }
.prod-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prod-name { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.prod-seller { font-size: 11.5px; color: var(--muted); }
.prod-price { display: flex; align-items: baseline; gap: 7px; margin-top: auto; }
.prod-price .p { font-size: 16px; font-weight: 900; }
.prod-price .d { font-size: 13.5px; font-weight: 800; color: #ff6b85; }
.prod-price .o { font-size: 11.5px; color: var(--muted); text-decoration: line-through; }

/* ---------- 모달 ---------- */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(5,8,18,.72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); animation: pop .2s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 15px; }
.modal-head .x { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 20px; line-height: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ---------- 폼 ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: #c3cbe9; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: #0d142c; border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 74px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ---------- 토스트 ---------- */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--card-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 11px; font-size: 13px; box-shadow: var(--shadow);
  animation: slidein .25s ease; max-width: 320px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--live); }

/* ---------- 관리자 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 30px 26px; box-shadow: var(--shadow); }
.login-box h1 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.4px; }
.login-box p { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { padding: 9px 15px; border-radius: 10px; font-size: 13px; font-weight: 700; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.tab.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.tab .n { margin-left: 6px; font-size: 11px; opacity: .85; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 12px 14px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid rgba(39,49,86,.55); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(99,102,241,.06); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mini-thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: #0f1630; display: grid; place-items: center; font-size: 19px; overflow: hidden; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #0f1630; border: 1px solid var(--line); color: #b9c2ea; }
.tag.on { color: #86efac; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1); }
.tag.off { color: #fca5a5; border-color: rgba(255,59,92,.35); background: rgba(255,59,92,.1); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 25px; font-weight: 900; letter-spacing: -1px; margin-top: 5px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.banner { padding: 13px 16px; border-radius: 12px; font-size: 13px; border: 1px solid var(--line); background: var(--card-2); margin-bottom: 16px; line-height: 1.55; }
.banner.warn { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.08); color: #fcd9a0; }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); font-size: 13.5px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- 반응형 ---------- */
@media (max-width: 1040px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .chat-list { height: 250px; }
}
@media (max-width: 620px) {
  .wrap { padding: 14px 13px 46px; }
  .topbar { padding: 10px 13px; gap: 9px; }
  .brand { font-size: 16px; }
  .brand small, .hide-sm { display: none; }
  /* 모바일: 16:9 고정 비율을 풀고 절대배치 그리드를 세로 흐름으로 전환한다.
     각 패널이 고유 비율을 유지해 셀러 영상이 납작해지지 않고(네임플레이트가 얼굴을 가리지 않음),
     제품 이미지도 잘리지 않는다. 자막은 흐름의 마지막 요소로 자연스럽게 이어진다. */
  .screen { aspect-ratio: auto; height: auto; min-height: 0; border-radius: 16px; }
  .hs-topbar { position: static; inset: auto; padding: 11px 12px 0; }
  .hs-grid {
    position: static; inset: auto; display: flex; flex-direction: column;
    gap: 10px; padding: 10px 12px 12px;
  }
  .hs-seller,
  .hs-product { width: 100%; }
  .hs-seller { aspect-ratio: 16 / 10; }
  .hs-product { aspect-ratio: 4 / 3; }
  .hs-cc { position: static; left: auto; right: auto; bottom: auto; margin: 0 12px 12px; padding: 9px 12px; }
  .hs-avatar-img { width: 92px; height: 92px; border-radius: 20px; }
  .hs-product .bigemoji { font-size: 56px; }
  .cc-text { font-size: 13.5px; }
  .hs-prog { font-size: 11.5px; padding: 5px 9px; }
  .price-disc, .price-now { font-size: 22px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .grid-cats { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .grid-prods { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------- 미디어 섹션 (AI 아바타 영상 · TTS 더빙 · 상세 이미지) ---------- */
.media-block {
  margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line);
}
.media-head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; flex-wrap: wrap; }
.media-head .mtag {
  font-size: 12.5px; font-weight: 800; color: #e9edfb;
  background: linear-gradient(135deg, rgba(99,102,241,.22), rgba(168,85,247,.22));
  border: 1px solid rgba(99,102,241,.42); padding: 4px 11px; border-radius: 999px;
}
.media-head .mhint { font-size: 11.5px; color: var(--muted); margin-left: auto; }

/* AI 아바타 영상 */
.av-video {
  width: 100%; aspect-ratio: 16/9; border-radius: 14px; background: #070b18;
  border: 1px solid var(--line); display: block;
}

/* TTS 더빙 */
.voice-row { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.voice-row .btn.playing { background: linear-gradient(135deg, #22c55e, #16a34a); border: none; }
.voice-status { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 140px; line-height: 1.5; }
.script-box { margin-top: 11px; background: #0d142c; border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; }
.script-box summary { font-size: 12.5px; font-weight: 700; color: #c3cbe9; cursor: pointer; }
.script-box p { margin: 9px 0 0; font-size: 12.5px; line-height: 1.75; color: #b7c0e6; }

/* 상세 이미지 갤러리 */
.detail-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 11px; align-items: start; }
.detail-main {
  border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: #0f1630;
  aspect-ratio: 4/3; display: grid; place-items: center; cursor: zoom-in;
}
.detail-main img { width: 100%; height: 100%; object-fit: contain; }
.detail-thumbs { display: flex; flex-direction: column; gap: 8px; max-height: 330px; overflow-y: auto; padding-right: 2px; }
.detail-thumb {
  padding: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #0f1630; aspect-ratio: 1/1; cursor: pointer; transition: .15s;
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-thumb:hover { border-color: #3c4a86; }
.detail-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* 라이트박스 */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(4,7,15,.9);
  display: grid; place-items: center; padding: 26px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 12px; box-shadow: var(--shadow); }

@media (max-width: 620px) {
  .detail-wrap { grid-template-columns: 1fr; }
  .detail-thumbs { flex-direction: row; max-height: none; overflow-x: auto; }
  .detail-thumb { flex: 0 0 70px; }
  .media-head .mhint { margin-left: 0; }
}

/* ---- 관리자: AI 미디어 입력 영역 ---- */
.media-fieldset { border:1px solid var(--line); border-radius:12px; padding:14px 14px 4px; margin:14px 0 4px; }
.media-fieldset legend { padding:0 8px; font-size:12.5px; font-weight:700; color:var(--sub); }
.media-fieldset .field { margin-bottom:12px; }
