:root {
  --bg: #f4f6f8; --paper: #fff; --ink: #12303f; --muted: #5d707b; --line: #dbe2e7;
  --accent: #0f6f9c; --accent-soft: #e3f1f8; --hot: #d9480f; --r: 10px;
  --font: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); word-break: keep-all; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, p { margin: 0; }
code { font: 500 13px/1.4 ui-monospace, "SF Mono", Consolas, monospace; color: var(--accent); letter-spacing: .01em; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
main.wrap { flex: 1; padding-top: 24px; padding-bottom: 64px; outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 상단 */
.top { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top__in { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.logo img { height: 26px; width: auto; display: block; }
.logo span { padding-left: 10px; border-left: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.search { flex: 1; display: flex; min-width: 220px; max-width: 460px; }
.search input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--bg); }
.search button { height: 40px; padding: 0 16px; border: 0; border-radius: 0 8px 8px 0; background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; }
.top__nav { margin-left: auto; display: flex; align-items: center; gap: 18px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.cartlink b { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 11px; background: var(--hot); color: #fff; text-align: center; font-size: 12px; line-height: 22px; font-variant-numeric: tabular-nums; }
.who { padding-left: 18px; border-left: 1px solid var(--line); line-height: 1.2; }
.who small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.foot { border-top: 1px solid var(--line); padding: 16px 0; color: var(--muted); font-size: 13px; }

/* 상품 분류 메뉴 · 용품 진열 */
.catsnav { border-top: 1px solid var(--line); }
.catsnav .wrap { display: flex; gap: 4px; overflow-x: auto; }
.catsnav a { padding: 11px 16px; font-weight: 700; font-size: 15px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.catsnav a:hover { color: var(--ink); }
.catsnav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.shelftiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.shelftile { display: flex; align-items: center; gap: 16px; height: 100%; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s; }
.shelftile:hover { border-color: var(--ink); }
.shelftile .thumb { width: 76px; flex: none; }
.shelftile b { display: block; font-size: 17px; }
.shelftile small { color: var(--muted); font-size: 13px; }
.chip small { font-weight: 500; opacity: .7; margin-left: 2px; font-variant-numeric: tabular-nums; }
.chip.static { cursor: default; display: inline-flex; align-items: center; gap: 6px; padding-right: 6px; }
.chip.static:hover { border-color: var(--line); }
.chip .x { width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.chip .x:hover { background: #fde9d9; color: var(--hot); }
.shelf[hidden] { display: none; }
.shelf .products { margin-top: 0; }
.product { position: relative; }
.tag { position: absolute; top: 20px; left: 20px; padding: 2px 9px; border-radius: 999px; font-style: normal; font-size: 12px; font-weight: 700; background: #fde9d9; color: #a23a0b; }
.tag[data-s="겨울용"] { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 900px) { .shelftiles { grid-template-columns: 1fr; } }

/* 공통 */
.h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.02em; }
.h1 small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.h1 i { font-style: normal; color: var(--accent); }
.block { margin-top: 36px; }
.block h2 { font-size: 17px; margin-bottom: 12px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs i { font-style: normal; opacity: .5; }
.crumbs span { color: var(--ink); font-weight: 600; }
.empty { margin-top: 24px; padding: 40px 24px; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); text-align: center; }
.empty a { color: var(--accent); font-weight: 600; text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.chip { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn { height: 38px; padding: 0 16px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap; transition: transform .1s, background .15s; }
.btn:hover { background: #0b5a80; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--paper); color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.big { width: 100%; height: 50px; font-size: 16px; }
.qty { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); overflow: hidden; }
.qty button { width: 32px; height: 36px; border: 0; background: none; cursor: pointer; font-size: 17px; color: var(--muted); }
.qty button:hover { background: var(--bg); color: var(--ink); }
.qty input { width: 42px; height: 36px; border: 0; border-inline: 1px solid var(--line); text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; background: none; }
.qty input::-webkit-inner-spin-button { display: none; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.en { display: block; font-size: 12px; color: var(--muted); }
.r { text-align: right; }

/* 메인: 브랜드 */
.lead { padding: 20px 0 28px; max-width: 720px; }
.lead h1 { font-size: 32px; line-height: 1.25; letter-spacing: -.025em; }
.lead p { margin-top: 10px; color: var(--muted); font-size: 16px; }
.brands { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.brandtile { display: flex; flex-direction: column; height: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.brandtile:hover { border-color: var(--ink); box-shadow: 0 10px 24px -14px rgba(18, 48, 63, .45); transform: translateY(-2px); }
.brandtile__logo { display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 24px; }
.brandtile__logo img { max-width: 78%; max-height: 64px; object-fit: contain; }
.wordmark { font-size: 26px; font-weight: 800; letter-spacing: .04em; }
.brandtile__meta { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.brandtile__meta small { color: var(--muted); }

/* 차종 */
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.modelcard { position: relative; display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); transition: border-color .15s; }
.modelcard:hover { border-color: var(--ink); }
.modelcard small { color: var(--muted); font-size: 13px; }
.modelcard em { position: absolute; top: 10px; right: 10px; font-style: normal; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 999px; }
.sil { width: 100%; height: 84px; margin-bottom: 10px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.modelhead { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.modelhead .sil { width: 120px; height: 66px; margin: 0; }
.modelhead p { color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--ink); margin-bottom: 4px; }
.tabs a { padding: 12px 22px; border-radius: 10px 10px 0 0; font-weight: 700; background: #e7ecf0; color: var(--muted); }
.tabs a small { display: block; font-weight: 500; font-size: 12px; }
.tabs a.on { background: var(--ink); color: #fff; }
.tabs + .chips { margin-top: 20px; }

/* 카달로그 그룹 */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.groupcard { display: flex; flex-direction: column; height: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: border-color .15s; }
a.groupcard:hover { border-color: var(--ink); }
.groupcard__img { display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 10px; color: var(--muted); }
.groupcard__img svg { width: 100%; height: 100%; }
.groupcard__img .co { display: none; }
.groupcard__t { padding: 10px 14px; border-top: 1px solid var(--line); font-weight: 600; }
.groupcard__t i { font-style: normal; color: var(--accent); margin-right: 8px; font-variant-numeric: tabular-nums; }
.groupcard.off { opacity: .55; }

/* 분해도 */
.cathead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 16px; }
.cathead > :first-child { justify-self: start; }
.cathead > :last-child { justify-self: end; }
td code, .product code { white-space: nowrap; }
.navbtn { font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.navbtn:hover { color: var(--ink); border-color: var(--ink); }
.catalog { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
.diagram { position: sticky; top: 76px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.diagram svg { display: block; width: 100%; height: auto; }
.hint { font-size: 12px; color: var(--muted); text-align: center; padding-top: 6px; }
svg .pt, .thumb { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
svg .nofill { fill: none; }
svg .dash { fill: none; stroke: #9fb0ba; stroke-width: 1; stroke-dasharray: 5 4; }
svg .wire { fill: none; stroke-width: 5; }
svg .tube { fill: none; stroke-width: 26; stroke: var(--ink); stroke-linecap: butt; }
svg .tube-in { fill: none; stroke-width: 22.5; stroke: var(--paper); stroke-linecap: butt; }
svg .pt.on { stroke: var(--hot); stroke-width: 2.4; fill: #fff1ea; }
svg .pt.on .tube { stroke: var(--hot); }
svg .pt.on .tube-in { stroke: #fff1ea; }
svg .pt.on .nofill, svg .pt.on .wire { fill: none; }
.co { cursor: pointer; outline: none; }
.co line { stroke: var(--muted); stroke-width: 1; }
.co rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.2; }
.co text { font: 700 16px var(--font); fill: var(--ink); text-anchor: middle; }
.co:hover rect, .co.on rect, .co:focus-visible rect { fill: var(--hot); stroke: var(--hot); }
.co:hover text, .co.on text, .co:focus-visible text { fill: #fff; }
.co.on line { stroke: var(--hot); }
.thumb { width: 100%; aspect-ratio: 1; background: var(--bg); border-radius: 8px; stroke-width: 1.8; }
.thumb .tube { stroke-width: 18; } .thumb .tube-in { stroke-width: 14.5; }

.partlist { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.partlist__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 9px 10px; background: var(--bg); white-space: nowrap; }
th.r { text-align: right; }
td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
td b { display: block; }
.ref { display: inline-grid; place-items: center; min-width: 30px; height: 28px; padding: 0 6px; border-radius: 6px; background: var(--accent-soft); border: 1px solid var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.need { text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.partlist tr.on td { background: #fff4ee; }
.partlist tr.on .ref { background: var(--hot); border-color: var(--hot); color: #fff; }

/* 스토어 */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 20px; }
.chips + .products { margin-top: 0; }
.product { display: flex; flex-direction: column; gap: 3px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.product[hidden] { display: none; }
.product .thumb { margin-bottom: 8px; }
.product .price { margin-top: auto; padding-top: 8px; font-size: 17px; }
.buy { display: flex; gap: 8px; margin-top: 8px; }
.buy .btn { flex: 1; padding: 0 8px; }
.where { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: underline; }

/* 장바구니 · 주문 */
.cartgrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; margin-top: 18px; }
.carttable { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: table; }
.del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 8px 4px; }
.del:hover { color: var(--hot); }
.summary { position: sticky; top: 76px; display: grid; gap: 14px; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.summary h2 { font-size: 17px; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-variant-numeric: tabular-nums; }
.summary dd { margin: 0; text-align: right; }
.summary .total { font-weight: 800; font-size: 18px; }
.summary .total small { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 4px; }
.summary label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.summary select, .summary textarea { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-weight: 400; resize: vertical; }
.orders { display: grid; gap: 14px; margin-top: 18px; }
.orders > li { padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.orders__head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.orders__head b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.orders__head strong { margin-left: auto; color: var(--ink); font-size: 16px; }
.state { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.orders ul { margin: 10px 0; display: grid; gap: 4px; }
.orders ul span { color: var(--muted); }
.memo { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a { margin-left: 10px; text-decoration: underline; color: #9fd8f3; white-space: nowrap; }

/* 로그인 · 상태 · 관리자 */
.guest .member { display: none; }
.linkbtn { border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: underline; padding: 8px 0; }
.login { max-width: 380px; margin: 48px auto; padding: 28px; display: grid; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.login > p { color: var(--muted); }
.login label, .form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.login input, .form input, .form select, .form textarea, .cell { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-weight: 400; min-width: 0; }
.form textarea { height: auto; padding: 10px 12px; font: 13px/1.5 ui-monospace, Consolas, monospace; resize: vertical; }
.err { color: var(--hot); font-weight: 600; min-height: 1.5em; font-size: 14px; }
.sub { font-size: 13px; text-align: center; }
.notice { margin-top: 14px; padding: 12px 16px; border-radius: var(--r); background: #fff4ee; color: #a23a0b; font-weight: 600; }
.notice.ok { background: #e6f4ea; color: #1b7a3d; margin: 0 0 14px; }
.price.ask { color: var(--muted); font-weight: 600; font-size: 14px; }
.state[data-s="접수"] { background: #e6f4ea; color: #1b7a3d; }
.state[data-s="출고 완료"] { background: var(--ink); color: #fff; }
.state[data-s="취소"] { background: #eceff1; color: var(--muted); }
.panel { margin-top: 18px; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.panel table { min-width: 640px; }
.form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.form label { flex: 1 1 150px; }
.form .wide { flex-basis: 100%; }
.cell { height: 36px; width: 110px; }
.cell.num { text-align: right; font-variant-numeric: tabular-nums; }
.help { color: var(--muted); font-size: 13px; margin-top: 8px; }
.orders__head select { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-weight: 600; }
.orders__head em { font-style: normal; font-weight: 700; color: var(--ink); }
.panel h3 { font-size: 14px; margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.panel tr.cur td { background: var(--accent-soft); }
.more { margin-top: 14px; font-size: 13px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 12px; }
.form input[type=file] { padding: 8px; height: auto; }

/* 올린 도면 이미지 + 번호 표시 */
.dimg { position: relative; line-height: 0; }
.dimg img { width: 100%; height: auto; border-radius: 6px; user-select: none; }
.dimg.edit { max-width: 760px; border: 1px solid var(--line); cursor: crosshair; }
.spot { position: absolute; transform: translate(-50%, -50%); min-width: 28px; height: 26px; padding: 0 5px; border: 1.5px solid var(--accent); border-radius: 6px; background: rgba(227, 241, 248, .9); color: var(--ink); font: 700 14px/1 var(--font); cursor: pointer; font-variant-numeric: tabular-nums; }
.spot:hover, .spot.on { background: var(--hot); border-color: var(--hot); color: #fff; z-index: 1; }
/* 거래처 화면: 도면에 인쇄된 번호 위에 투명한 누름 영역을 얹는다 (도면 크기에 맞춰 같이 커지고 작아진다) */
.dimg:not(.edit) .spot { width: 4.2%; height: 2.7%; min-width: 0; padding: 0; font-size: 0; border-radius: 4px; border: 1px solid rgba(15, 111, 156, .45); background: rgba(15, 111, 156, .1); }
.dimg:not(.edit) .spot:hover, .dimg:not(.edit) .spot.on { background: rgba(217, 72, 15, .28); border: 2px solid var(--hot); }
.dimg.edit .spot { min-width: 22px; height: 20px; padding: 0 3px; font-size: 12px; }
.was { display: block; font-size: 12px; color: var(--hot); font-weight: 600; }
.groupcard__img img { width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 900px) {
  .brands { grid-template-columns: repeat(2, 1fr); }
  .catalog, .cartgrid { grid-template-columns: 1fr; }
  .diagram, .summary { position: static; }
  .cathead { grid-template-columns: 1fr 1fr; }
  .cathead h1 { grid-column: 1 / -1; grid-row: 1; }
  .lead h1 { font-size: 25px; }
  .who { display: none; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .partlist, .carttable { overflow-x: auto; display: block; }
  .tabs a { padding: 10px 14px; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
