* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR",
               "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: #222; background: #f5f5f5; font-size: 14px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { width: 1180px; max-width: 96%; margin: 0 auto; }
.narrow { width: 760px; max-width: 96%; }
.muted { color: #888; }
.small { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- header ---------- */
.topbar { background: #fff; border-bottom: 2px solid #ff5000; position: sticky; top: 0; z-index: 50; }
.topbar-in { display: flex; align-items: center; gap: 24px; height: 72px; }
.logo { display: flex; align-items: baseline; gap: 2px; font-size: 26px; font-weight: 800; letter-spacing: -1px; }
.logo-mark { color: #ff5000; }
.logo-txt { color: #222; }
.logo small { font-size: 10px; letter-spacing: 2px; color: #bbb; margin-left: 6px; font-weight: 600; }
.search { flex: 1; display: flex; max-width: 560px; }
.search input {
  flex: 1; height: 40px; border: 2px solid #ff5000; border-right: 0; padding: 0 14px;
  font-size: 14px; outline: none; border-radius: 3px 0 0 3px;
}
.search button {
  width: 88px; height: 40px; border: 0; background: #ff5000; color: #fff;
  font-size: 15px; font-weight: 700; cursor: pointer; border-radius: 0 3px 3px 0;
}
.topnav { display: flex; gap: 18px; align-items: center; font-size: 13px; color: #555; }
.topnav a:hover { color: #ff5000; }
.badge {
  display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 4px;
  background: #ff5000; color: #fff; border-radius: 9px; font-size: 11px; text-align: center;
}

/* ---------- flash ---------- */
.flash {
  background: #fff7e6; border: 1px solid #ffd591; color: #a35b00;
  padding: 10px 14px; border-radius: 4px; margin: 12px 0;
}

/* ---------- layout ---------- */
.layout { display: flex; gap: 16px; padding: 16px 0 40px; align-items: flex-start; }
.sidebar {
  width: 200px; flex: 0 0 200px; background: #fff; border-radius: 4px;
  padding: 8px 0; position: sticky; top: 88px;
}
.side-title { font-size: 15px; font-weight: 700; padding: 10px 16px 12px; border-bottom: 1px solid #f0f0f0; }
.side-list { list-style: none; margin: 0; padding: 4px 0; }
.side-list li a { display: block; padding: 9px 16px; font-size: 13.5px; color: #444; }
.side-list li a:hover { background: #fff5f0; color: #ff5000; }
.side-list li.active a { background: #fff5f0; color: #ff5000; font-weight: 700; border-left: 3px solid #ff5000; padding-left: 13px; }

.content { flex: 1; min-width: 0; }
.content-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 14px; }
.content-head h1 { font-size: 19px; margin: 0; }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.card { background: #fff; border-radius: 4px; overflow: hidden; transition: .15s; border: 1px solid #fff; }
.card:hover { border-color: #ff5000; box-shadow: 0 4px 14px rgba(255,80,0,.12); transform: translateY(-2px); }
.thumb { aspect-ratio: 1/1; background: #f7f7f7; display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.noimg { color: #ccc; font-size: 12px; }
.noimg.big { font-size: 15px; }
.card-body { padding: 10px 12px 14px; }
.card-title { margin: 0 0 8px; font-size: 13px; line-height: 1.45; height: 38px; overflow: hidden; color: #333; }
.price { margin: 0; color: #ff5000; font-size: 17px; font-weight: 800; }
.meta { margin: 4px 0 0; font-size: 12px; color: #999; }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 26px 0; }
.pager a { border: 1px solid #ddd; padding: 6px 16px; border-radius: 3px; background: #fff; }
.pager a:hover { border-color: #ff5000; color: #ff5000; }

.empty { background: #fff; padding: 70px 20px; text-align: center; color: #999; border-radius: 4px; }

/* ---------- detail ---------- */
.crumb { padding: 14px 0; font-size: 12.5px; color: #999; }
.detail { display: flex; gap: 30px; background: #fff; padding: 22px; border-radius: 4px; }
.gallery { width: 420px; flex: 0 0 420px; }
.main-img { width: 100%; aspect-ratio: 1/1; background: #f7f7f7; display: flex; align-items: center; justify-content: center; border-radius: 4px; overflow: hidden; }
.main-img img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumb-btn { width: 62px; height: 62px; padding: 0; border: 1px solid #eee; background: #fff; cursor: pointer; border-radius: 3px; overflow: hidden; }
.thumb-btn:hover { border-color: #ff5000; }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; }

.buybox { flex: 1; min-width: 0; }
.p-title { font-size: 21px; margin: 0 0 8px; line-height: 1.4; }
.pricebox { background: #fff8f5; border-radius: 4px; padding: 14px 16px; margin: 16px 0; display: flex; align-items: baseline; gap: 12px; }
.lbl-price { color: #888; font-size: 13px; }
.big-price { color: #ff5000; font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.field { margin: 18px 0; }
.flabel { display: block; font-size: 13px; color: #666; margin-bottom: 8px; }
.attr-row { display: flex; flex-wrap: wrap; gap: 8px; }
.attr {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px;
  border: 1px solid #ddd; border-radius: 3px; cursor: pointer; font-size: 12.5px; background: #fff;
  min-width: 92px;
}
.attr img { width: 46px; height: 46px; object-fit: cover; }
.attr input { display: none; }
.attr:has(input:checked) { border-color: #ff5000; background: #fff5f0; }
.attr.soldout { opacity: .45; }
.attr-name { font-weight: 600; text-align: center; }
.attr-price { color: #ff5000; }
.qty-field { display: flex; align-items: center; gap: 12px; }
.qty-field .flabel { margin: 0; }
.qty { display: flex; border: 1px solid #ddd; border-radius: 3px; overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: #fafafa; font-size: 16px; cursor: pointer; }
.qty input { width: 56px; height: 34px; border: 0; text-align: center; font-size: 14px; }
.actions { display: flex; gap: 10px; margin: 26px 0 20px; }
.btn {
  display: inline-block; text-align: center; border-radius: 3px; cursor: pointer; border: 0;
  font-size: 15px; font-weight: 700; padding: 13px 26px; transition: .15s;
}
.btn-line { background: #fff; border: 1px solid #ff5000; color: #ff5000; }
.btn-line:hover { background: #fff5f0; }
.btn-main { background: #ff5000; color: #fff; }
.btn-main:hover { background: #e64800; }
.btn.wide { display: block; width: 100%; }
.btn.sm { padding: 7px 14px; font-size: 13px; }

.shop-info { list-style: none; padding: 16px 0 0; margin: 0; border-top: 1px solid #f0f0f0; font-size: 13px; color: #666; }
.shop-info li { padding: 5px 0; }
.detail-imgs { background: #fff; margin-top: 16px; padding: 22px; border-radius: 4px; }
.detail-imgs h2 { font-size: 17px; margin: 0 0 16px; }

/* ---------- page / forms ---------- */
.page-h1 { font-size: 21px; margin: 22px 0 16px; }
.form-card { background: #fff; padding: 24px; border-radius: 4px; }
.form-card h3 { font-size: 15px; margin: 22px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }
.form-card h3:first-child { margin-top: 0; }
.frow { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.frow label { width: 130px; flex: 0 0 130px; color: #666; font-size: 13.5px; }
.frow label em { color: #ff5000; font-style: normal; }
.frow input, .frow select, .frow textarea {
  flex: 1; height: 40px; border: 1px solid #ddd; border-radius: 3px; padding: 0 12px; font-size: 14px;
  font-family: inherit; outline: none; background: #fff;
}
.frow input:focus, .frow select:focus { border-color: #ff5000; }
.login-card { margin-top: 60px; }

/* ---------- table ---------- */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 4px; overflow: hidden; }
.tbl th { background: #fafafa; text-align: left; font-size: 13px; color: #666; font-weight: 600; padding: 12px 14px; border-bottom: 1px solid #eee; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid #f4f4f4; font-size: 13.5px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.simple td { border-bottom: 1px dashed #eee; }
.tbl.simple tr.strong td { font-weight: 800; font-size: 15px; border-bottom: 0; }
.cell-prod a { display: flex; align-items: center; gap: 10px; }
.cell-prod img { width: 46px; height: 46px; object-fit: cover; border-radius: 3px; }
.qty-mini input { width: 60px; height: 32px; border: 1px solid #ddd; text-align: center; border-radius: 3px; }
.link-del { background: none; border: 0; color: #999; cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; }
.link-del:hover { color: #ff5000; }
.inline { display: inline; }
select { height: 32px; border: 1px solid #ddd; border-radius: 3px; padding: 0 8px; }

.sum-box { background: #fff; padding: 22px; margin-top: 16px; border-radius: 4px; }
.sum-line { display: flex; justify-content: space-between; padding: 7px 0; color: #666; font-size: 14px; }
.sum-total { display: flex; justify-content: space-between; padding: 16px 0 20px; font-size: 17px; border-top: 1px solid #f0f0f0; margin-top: 8px; }
.sum-total b { color: #ff5000; font-size: 24px; }

.pay-box { background: #f7fbff; border: 1px solid #d6e9ff; border-radius: 4px; padding: 18px; margin: 22px 0; }
.pay-box h3 { margin: 0 0 10px; font-size: 15px; border: 0; padding: 0; }
.pay-box p { margin: 6px 0; font-size: 14px; }
.pay-amount { font-size: 26px; font-weight: 800; color: #ff5000; margin-top: 10px !important; }

.done-box { background: #fff; padding: 40px 30px; border-radius: 4px; text-align: center; margin: 30px 0; }
.done-ico {
  width: 62px; height: 62px; line-height: 62px; border-radius: 50%; background: #ff5000; color: #fff;
  font-size: 32px; margin: 0 auto 18px;
}
.done-box h1 { margin: 0 0 6px; font-size: 22px; }
.done-box .tbl { margin: 20px 0; text-align: left; }
.center-box { text-align: center; padding: 80px 0; }

/* ---------- admin ---------- */
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.admin-nav { display: flex; gap: 6px; align-items: center; }
.admin-nav a { padding: 8px 14px; border-radius: 3px; font-size: 13.5px; color: #555; background: #fff; }
.admin-nav a.on { background: #ff5000; color: #fff; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.stat { background: #fff; padding: 18px; border-radius: 4px; }
.stat span { display: block; font-size: 12.5px; color: #888; margin-bottom: 6px; }
.stat b { font-size: 26px; }
.stat.warn b { color: #ff5000; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 10px; background: #f0f0f0; color: #777; font-size: 12px; }
.tag.on { background: #fff0e8; color: #ff5000; }
.notice { background: #fff7e6; border: 1px solid #ffd591; color: #8a5300; padding: 14px 16px; border-radius: 4px; margin: 16px 0; font-size: 13.5px; }

/* ---------- footer ---------- */
.foot { background: #2b2b2b; color: #bbb; padding: 26px 0; margin-top: 40px; font-size: 12.5px; }
.foot p { margin: 5px 0; }
.foot b { color: #fff; }

@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .detail { flex-direction: column; }
  .gallery { width: 100%; flex: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .topbar-in { height: auto; padding: 12px 0; flex-wrap: wrap; gap: 10px; }
  .search { order: 3; width: 100%; max-width: none; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; position: static; }
  .side-list { display: flex; flex-wrap: wrap; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .frow { flex-direction: column; align-items: stretch; gap: 6px; }
  .frow label { width: auto; flex: none; }
  .tbl { font-size: 12.5px; }
}
