/* ============================================================
   BEAUTY STORY 디자인 시스템 — 미니멀·모던, 핑크는 '액센트'로만
   - 서피스/배경은 클린 뉴트럴(흰색·연한 그레이). 핑크(--accent)는 강조에만.
   - 모바일(≤860): 헤더=로고+햄버거, 메뉴는 애니메이션 드로어 + 하단 탭바.
   ============================================================ */
:root {
  --accent-community: #ec4899;   /* 로즈 핑크 — 커뮤니티/기본 */
  --accent-shop:      #e6156d;   /* 핫핑크 — 샵 */
  --accent-admin:     #0f766e;   /* 청록 — 관리자 */
  --accent: var(--accent-community);

  --c-text: #17151a; --c-sub: #5c5560; --c-muted: #9a939d;
  --c-line: #ececef; --c-line-2: #f4f4f6;
  --c-bg: #f7f7f9; --c-card: #ffffff;
  --c-danger: #e11d48; --c-ok: #16a34a; --c-warn: #d97706;

  --radius: 16px; --radius-sm: 11px;
  --accent-soft: color-mix(in srgb, var(--accent) 8%, #fff);
  --accent-line: color-mix(in srgb, var(--accent) 20%, #fff);
  --shadow-sm: 0 1px 2px rgb(20 16 22 / .04);
  --shadow-md: 0 2px 4px rgb(20 16 22 / .04), 0 12px 28px -18px rgb(20 16 22 / .16);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
body[data-site="shop"]  { --accent: var(--accent-shop); }
body[data-site="admin"] { --accent: var(--accent-admin); }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--c-text); background: var(--c-bg); font-size: 15px; line-height: 1.6;
  letter-spacing: -.01em; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---------- 헤더/GNB ---------- */
.site-header { background: rgba(255,255,255,.82); backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--c-line); position: sticky; top: 0; z-index: 50; }
.site-header .inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.header-top { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 16px; }
.logo { font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--accent); white-space: nowrap; line-height: 1.02; }
.logo small { display: block; font-size: 9px; font-weight: 700; color: var(--c-muted); letter-spacing: .32em; margin-top: 2px; }
.gnb { display: flex; gap: 2px; flex: 1; }
.gnb a { padding: 8px 12px; font-weight: 600; font-size: 14px; color: var(--c-sub); border-radius: 9px; white-space: nowrap; transition: color .15s var(--ease), background .15s var(--ease); }
.gnb a:hover, .gnb a.active { color: var(--accent); background: var(--accent-soft); }
.util { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--c-sub); white-space: nowrap; }
.util a:hover { color: var(--accent); }
.util .divider { color: var(--c-line); }
.nav-toggle-input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.nav-burger { display: none; width: 42px; height: 42px; border-radius: var(--radius-sm); border: 1px solid var(--c-line);
  background: #fff; align-items: center; justify-content: center; cursor: pointer; color: var(--c-text); flex: none; transition: background .15s var(--ease); }
.nav-burger:hover { background: var(--c-line-2); }
.nav-burger svg { width: 22px; height: 22px; }
.nav-burger svg line { transition: transform .3s var(--ease), opacity .2s var(--ease); transform-box: fill-box; transform-origin: center; }

/* ---------- 레이아웃 ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 24px 20px 72px; }
.container.narrow { max-width: 720px; }
.page-title { font-size: 23px; font-weight: 800; margin: 6px 0 20px; letter-spacing: -.03em; }
.page-title small { font-size: 13px; font-weight: 500; color: var(--c-muted); margin-left: 8px; letter-spacing: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.with-side { display: grid; grid-template-columns: 216px 1fr; gap: 28px; align-items: start; }

/* ---------- 카드/패널 ---------- */
.card { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card h3 { font-size: 15px; margin-bottom: 12px; letter-spacing: -.02em; }
.card + .card { margin-top: 14px; }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; margin: 30px 0 14px; }
.panel-title h2 { font-size: 18px; font-weight: 800; letter-spacing: -.03em; display: flex; align-items: center; gap: 9px; }
.panel-title h2::before { content: ""; width: 4px; height: 15px; border-radius: 3px; background: var(--accent); }
.panel-title a { font-size: 12.5px; color: var(--c-muted); font-weight: 600; }
.panel-title a:hover { color: var(--accent); }

/* ---------- 버튼 (탭 타깃 ≥42px) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--c-line); background: #fff; color: var(--c-text); font-size: 14px; font-weight: 700; cursor: pointer; letter-spacing: -.01em; white-space: nowrap;
  transition: transform .12s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease); }
/* 버튼 그룹 — 좁아지면 줄바꿈(레이아웃 붕괴 방지). 탭형 행은 가로 스크롤(.tab-row). */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tab-row { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.tab-row::-webkit-scrollbar { display: none; }
.tab-row > * { flex: none; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, #fff); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 20px -10px var(--accent); }
.btn.primary:hover { color: #fff; box-shadow: 0 10px 24px -8px var(--accent); }
.btn.danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn.danger:hover { color: #fff; }
.btn.sm { min-height: 34px; padding: 6px 13px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 폼 ---------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; letter-spacing: -.01em; }
.form-row .hint { font-size: 12px; color: var(--c-muted); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--c-line); border-radius: var(--radius-sm); font-size: 16px; font-family: inherit; background: #fff; color: var(--c-text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.checks label { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 14px; margin-bottom: 8px; }
.field-error { color: var(--c-danger); font-size: 12px; margin-top: 5px; }

/* ---------- 테이블 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
table.list th, table.list td { padding: 12px 14px; border-bottom: 1px solid var(--c-line-2); text-align: left; vertical-align: middle; }
table.list th { background: #fafafb; color: var(--c-sub); font-weight: 700; white-space: nowrap; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fcfcfd; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 뱃지/알림 ---------- */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; letter-spacing: 0;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.badge.gray { background: #f4f4f5; color: var(--c-sub); border-color: var(--c-line); }
.badge.ok { background: #f0fdf4; color: var(--c-ok); border-color: #bbf7d0; }
.badge.warn { background: #fffbeb; color: var(--c-warn); border-color: #fde68a; }
.badge.danger { background: #fff1f3; color: var(--c-danger); border-color: #fecdd6; }
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; border: 1px solid; }
.alert.info { background: #f7f7f9; border-color: var(--c-line); color: var(--c-sub); }
.alert.success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert.error { background: #fff1f3; border-color: #fecdd6; color: #be123c; }

/* ---------- 칩 탭 / 필터 바 (카테고리·상태 필터 공통) ---------- */
.chip-bar { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.chip-bar.scroll { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.chip-bar.scroll::-webkit-scrollbar { display: none; }
.chip-bar.scroll > * { flex: none; }
.chip { display: inline-flex; align-items: center; height: 36px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--c-line);
  background: #fff; color: var(--c-sub); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease); }
.chip:hover { border-color: var(--accent-line); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar input[type=text], .filter-bar input[type=search] { flex: 1; min-width: 160px; }
.filter-bar select { width: auto; min-width: 128px; flex: none; }
.filter-bar .btn { flex: none; }

/* ---------- 신고 드롭다운 패널 ---------- */
.report-box { position: relative; }
.report-box > summary { list-style: none; cursor: pointer; }
.report-box > summary::-webkit-details-marker { display: none; }
.report-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; width: 268px; text-align: left; box-shadow: var(--shadow-md); }
@media (max-width: 480px) { .report-panel { right: auto; left: 50%; transform: translateX(-50%); width: 250px; } }

/* ---------- 아바타 / 메타 (사용자 표시 공통) ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #ffe3ef, #f4f0ff);
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--accent); flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.meta { font-size: 12px; color: var(--c-muted); }

/* ---------- 상품 ---------- */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.product-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; transition: transform .16s var(--ease), box-shadow .16s var(--ease); }
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.product-card .thumb { aspect-ratio: 1; background: #f4f2f4; display: grid; place-items: center; color: var(--c-muted); font-size: 12px; position: relative; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .thumb .thumb-label { position: absolute; top: 9px; left: 9px; }
.product-card .info { padding: 12px 14px 15px; }
.product-card .brand { font-size: 11px; color: var(--c-muted); }
.product-card .name { font-size: 13.5px; font-weight: 600; margin: 3px 0 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; line-height: 1.45; }
.product-card .price { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.product-card .price .rate { color: var(--accent); margin-right: 6px; }
.product-card .price .original { font-size: 12px; color: var(--c-muted); text-decoration: line-through; font-weight: 400; margin-left: 6px; }
.price-locked { font-size: 12px; color: var(--c-muted); }

/* ---------- 메인 배너 ---------- */
.hero-banner { border-radius: 20px; overflow: hidden; position: relative;
  background: linear-gradient(120deg, #fdeff6, #f4f0ff); min-height: 200px;
  display: flex; flex-direction: column; justify-content: center; padding: 36px; margin-bottom: 6px; }
.hero-banner h2 { font-size: 27px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.03em; position: relative; }
.hero-banner p { color: var(--c-sub); position: relative; }
.strip-banner { border-radius: var(--radius); background: #fff; border: 1px solid var(--c-line); text-align: center;
  padding: 18px; font-size: 13px; color: var(--c-muted); margin: 22px 0; }

/* ---------- 게시판 ---------- */
.board-list .post-row { display: flex; gap: 12px; padding: 15px 6px; border-bottom: 1px solid var(--c-line-2); align-items: baseline; }
.board-list .post-row:hover { background: #fcfcfd; }
.board-list .post-row .title { font-weight: 600; flex: 1; }
.board-list .post-row .meta { font-size: 12px; color: var(--c-muted); white-space: nowrap; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--c-line-2); }
.comment .who { font-size: 12.5px; font-weight: 800; }
.comment .when { font-size: 11px; color: var(--c-muted); margin-left: 6px; }

/* ---------- 사이드 내비 ---------- */
.side-nav { background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.side-nav .group-label { padding: 13px 16px 5px; font-size: 11px; font-weight: 800; color: var(--c-muted); letter-spacing: .05em; }
.side-nav a { display: block; padding: 11px 16px; font-size: 14px; font-weight: 500; color: var(--c-sub); transition: background .15s var(--ease), color .15s var(--ease); }
.side-nav a:hover, .side-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---------- 통계 타일 ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-tile { background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); padding: 17px 19px; box-shadow: var(--shadow-sm); }
.stat-tile .label { font-size: 12px; color: var(--c-muted); }
.stat-tile .value { font-size: 23px; font-weight: 800; margin-top: 5px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-tile .value small { font-size: 12px; font-weight: 500; color: var(--c-muted); }

/* ---------- 페이지네이션/푸터 ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 11px; border: 1px solid var(--c-line); border-radius: 9px; font-size: 13px; background: #fff; transition: border-color .15s var(--ease); }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.site-footer { border-top: 1px solid var(--c-line); background: #fff; margin-top: 48px; }
.site-footer .inner { max-width: 1120px; margin: 0 auto; padding: 28px 20px; font-size: 12px; color: var(--c-muted); line-height: 1.85; }
.site-footer strong { color: var(--c-sub); }
.empty { text-align: center; color: var(--c-muted); padding: 52px 0; font-size: 14px; }

/* ---------- 하단 탭바 (모바일 전용, 기본 숨김) ---------- */
.tabbar, .tabbar-spacer, .buybar { display: none; }

/* ============================================================
   반응형
   ============================================================ */
@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(3, 1fr); }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .site-header .inner { padding: 0 16px; }
  .container { padding: 20px 16px 72px; }
  /* 모바일: 본문 먼저, 사이드 내비는 아래로(콘텐츠 우선) */
  .with-side { grid-template-columns: 1fr; gap: 18px; }
  .with-side > :first-child { order: 2; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }

  /* 헤더: 첫 줄=로고+햄버거, 메뉴는 아래로 부드럽게 펼쳐짐 */
  .nav-burger { display: inline-flex; }
  .header-top { gap: 8px; flex-wrap: wrap; height: auto; min-height: 62px; }
  .gnb, .util { flex-basis: 100%; order: 3; flex-direction: column; align-items: stretch;
    max-height: 0; opacity: 0; overflow: hidden;
    transition: max-height .34s var(--ease), opacity .26s var(--ease), padding .34s var(--ease), margin .34s var(--ease); }
  .gnb { gap: 1px; }
  .gnb a { padding: 13px 12px; font-size: 15px; border-radius: 10px; }
  .util { order: 4; font-size: 15px; gap: 4px; }
  .util a, .util form { padding: 7px 2px; }
  .util .divider { display: none; }
  .util .btn { width: 100%; margin-top: 4px; }
  #nav-toggle:checked ~ .inner .gnb { max-height: 62vh; opacity: 1; overflow-y: auto; padding: 6px 0 8px; margin-top: 6px; border-top: 1px solid var(--c-line); }
  #nav-toggle:checked ~ .inner .util { max-height: 40vh; opacity: 1; padding: 10px 0 14px; border-top: 1px solid var(--c-line); }
  /* 햄버거 → X 모션 */
  #nav-toggle:checked ~ .inner .nav-burger svg line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  #nav-toggle:checked ~ .inner .nav-burger svg line:nth-child(2) { opacity: 0; }
  #nav-toggle:checked ~ .inner .nav-burger svg line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* 하단 탭바 + 스페이서 */
  .tabbar-spacer { display: block; height: calc(var(--tabbar-h) + var(--safe-b)); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex;
    background: rgba(255,255,255,.9); backdrop-filter: saturate(1.6) blur(12px);
    border-top: 1px solid var(--c-line); padding-bottom: var(--safe-b); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    height: var(--tabbar-h); font-size: 11px; font-weight: 600; color: var(--c-muted); transition: color .15s var(--ease); }
  .tabbar a .ic { width: 23px; height: 23px; display: block; transition: transform .15s var(--ease); }
  .tabbar a:active .ic { transform: scale(.86); }
  .tabbar a.active { color: var(--accent); }
  .tabbar a.center { color: var(--c-sub); }
  .tabbar a.center .ic-wrap { width: 46px; height: 46px; margin-top: -20px; margin-bottom: 2px; border-radius: 16px;
    background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 18px -6px var(--accent); transition: transform .15s var(--ease); }
  .tabbar a.center:active .ic-wrap { transform: scale(.92); }
  .tabbar a.center .ic-wrap .ic { width: 24px; height: 24px; }

  /* 상품상세 하단 고정 구매바(테마 참고) — 항상 접근 가능한 장바구니 CTA */
  .buybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: flex; align-items: center; gap: 12px;
    background: rgba(255,255,255,.96); backdrop-filter: saturate(1.6) blur(12px);
    border-top: 1px solid var(--c-line); padding: 9px 16px calc(9px + var(--safe-b));
    box-shadow: 0 -6px 20px -12px rgb(20 16 22 / .2); }
  .buybar .bb-price { flex: 1; min-width: 0; line-height: 1.25; }
  .buybar .bb-price .amt { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
  .buybar .bb-price .lbl { font-size: 11px; color: var(--c-muted); }
  .buybar .btn { flex: none; min-width: 148px; min-height: 46px; }
  body:has(.buybar) .tabbar { display: none; }
}
@media (max-width: 640px) {
  .filter-bar .btn { flex: 1; }
  /* 커머스 테이블(장바구니·주문 등): 모바일에서 행을 카드로 스택 — 가로 스크롤 제거 */
  table.list.stack thead { display: none; }
  table.list.stack, table.list.stack tbody, table.list.stack tr, table.list.stack td { display: block; width: 100%; }
  table.list.stack tr { border: 1px solid var(--c-line); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 4px 2px; background: #fff; }
  table.list.stack tr:last-child { margin-bottom: 0; }
  table.list.stack tr:hover td { background: transparent; }
  table.list.stack td { border: 0; border-bottom: 1px solid var(--c-line-2); padding: 9px 13px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  table.list.stack td:last-child { border-bottom: 0; }
  table.list.stack td::before { content: attr(data-label); font-weight: 700; color: var(--c-sub); font-size: 12px; text-align: left; flex: none; }
  table.list.stack td[data-label=""]::before, table.list.stack td:not([data-label])::before { content: none; }
}
@media (max-width: 480px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero-banner { min-height: 168px; padding: 26px; border-radius: 18px; }
  .hero-banner h2 { font-size: 22px; }
  .page-title { font-size: 21px; }
}
