:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #646b75;
  --line: #e2e5ea;
  --brand: #0b5cad;
  --brand-dark: #08457f;
  --accent: #f0f5fb;
  --danger: #c62828;
  --ok: #1b7f45;
  --radius: 10px;
  font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
h1 { font-size: 24px; margin: 28px 0 16px; }
h2 { font-size: 19px; margin: 32px 0 14px; }

/* 머리말 */
#siteHeader { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--brand); white-space: nowrap; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 17px; }
.search { flex: 1; }
.search input { width: 100%; height: 40px; border: 1.5px solid var(--line); border-radius: 999px; padding: 0 16px; background: var(--bg); }
.search input:focus { outline: none; border-color: var(--brand); background: #fff; }
.header-links { display: flex; gap: 16px; white-space: nowrap; font-weight: 600; }
.badge[hidden] { display: none; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; text-align: center; }
.cat-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; }
.cat-nav a { padding: 6px 12px; border-radius: 999px; white-space: nowrap; color: var(--muted); font-weight: 600; }
.cat-nav a:hover, .cat-nav a.on { background: var(--accent); color: var(--brand); }

/* 메인 */
.hero { background: linear-gradient(135deg, #0b3d6e, #0b5cad); color: #fff; }
.hero .wrap { padding-top: 48px; padding-bottom: 48px; }
.hero h1 { font-size: 32px; margin: 0 0 10px; }
.hero p { margin: 0 0 22px; opacity: .9; font-size: 16px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-points span { background: rgba(255,255,255,.14); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.cat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.cat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 6px 14px; text-align: center; font-weight: 600; color: var(--brand); display: flex; flex-direction: column; align-items: center; }
.cat-tile .icon { max-width: 100%; height: auto; }
.cat-tile span { display: block; color: var(--text); margin-top: 6px; font-size: 14px; }
.cat-tile:hover { border-color: var(--brand); }

/* 상품 카드 */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s; }
.card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.card-img { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--accent); color: var(--brand); overflow: hidden; }
.card-img .icon, .detail-img .icon { max-width: 80%; height: auto; }
.card-img img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.detail-img { overflow: hidden; }
.detail-img img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.card-cat { font-size: 12px; color: var(--brand); font-weight: 700; }
.card-name { font-size: 15px; }
.card-sum { font-size: 13px; color: var(--muted); }
.card-price { font-weight: 800; font-size: 17px; margin-top: 6px; }
.card-price small { font-weight: 400; color: var(--muted); }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }

/* 상품 상세 */
.detail { display: grid; grid-template-columns: 360px 1fr; gap: 32px; margin-top: 28px; }
.detail-img { aspect-ratio: 1; background: var(--accent); color: var(--brand); border-radius: var(--radius); display: grid; place-items: center; }
.detail h1 { margin-top: 4px; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb a:hover { color: var(--brand); }

/* 표 */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.wrap-cell { white-space: normal; min-width: 180px; }
th { background: #fafbfc; font-size: 13px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.qty { width: 72px; height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; text-align: right; }
.soldout { color: var(--danger); font-size: 13px; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 22px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-link { border: 0; background: none; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* 장바구니·주문서 */
.layout-2 { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; }
.summary-total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-weight: 800; font-size: 18px; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; }
.field input, .field textarea { height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: #fff; }
.field textarea { height: 70px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--brand); }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin-top: 8px; }
.alert { background: #fff7e6; border: 1px solid #f3d38a; border-radius: 8px; padding: 12px 14px; font-size: 14px; margin: 16px 0; }
.alert-error { background: #fdecec; border-color: #f2b8b8; color: var(--danger); }
.alert-ok { background: #e9f6ee; border-color: #a9d8bb; color: var(--ok); }

/* 안내 문서 */
.doc section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; }
.doc h2 { margin-top: 0; }

/* 꼬리말 */
#siteFooter { margin-top: 64px; padding: 28px 0 40px; background: var(--surface); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
#siteFooter p { margin: 4px 0; }
.footer-links { display: flex; gap: 16px; margin-bottom: 10px; color: var(--text); }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .detail, .layout-2 { grid-template-columns: 1fr; }
  .detail-img { max-width: 320px; }
}
@media (max-width: 600px) {
  .header-row { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 8px; gap: 10px; }
  .search { order: 3; flex-basis: 100%; }
  .header-links { margin-left: auto; }
  .hero h1 { font-size: 25px; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .grid { gap: 10px; }
  .card-body { padding: 10px; }
}
