/* sb.placeofsil.com — 분할 보기 (pa.placeofsil.com 쇼핑몰 페이지와 같은 계열, 색 #5AC8BD) */
:root {
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --paper: #F2F6F5;
  --surface: #FFFFFF;
  --ink: #15292A;
  --muted: #5F7472;
  --line: #D3E2DF;
  --line-soft: #E6EFED;
  --accent: #5AC8BD;
  --accent-ink: #1A8A7E;
  --accent-soft: #E1F5F2;
  --hover: #EDF8F6;
  --chip: #E3ECEA;
  --bad: #B42318;
  --bad-soft: #FDECEA;
  --warn: #9A6700;
  --warn-soft: #FFF4D6;
  --grey-soft: #ECEFEF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1A19; --surface: #162220; --ink: #E4F0EE; --muted: #93ABA7; --line: #27403C; --line-soft: #1D302D;
    --accent: #5AC8BD; --accent-ink: #7FDDD2; --accent-soft: #1C3C38; --hover: #1A302C; --chip: #203431;
    --bad: #FF8A80; --bad-soft: #3A1E1C; --warn: #F2C14E; --warn-soft: #3A3018; --grey-soft: #22302E;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1A19; --surface: #162220; --ink: #E4F0EE; --muted: #93ABA7; --line: #27403C; --line-soft: #1D302D;
  --accent: #5AC8BD; --accent-ink: #7FDDD2; --accent-soft: #1C3C38; --hover: #1A302C; --chip: #203431;
  --bad: #FF8A80; --bad-soft: #3A1E1C; --warn: #F2C14E; --warn-soft: #3A3018; --grey-soft: #22302E;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--accent-ink); }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- 머리 ---------- */
.board { background: var(--surface); border-bottom: 1px solid var(--line); }
.board-inner { max-width: 1480px; margin: 0 auto; padding: 18px 16px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; }
.board-back { flex-basis: 100%; color: var(--muted); font-size: 13px; text-decoration: none; }
.board-back::before { content: "← "; }
.board-back:hover { text-decoration: underline; }
.board-title { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.board-range { margin: 0; color: var(--muted); font-size: 14px; }
.board-stats { margin-left: auto; display: flex; gap: 8px; }
.stat { display: flex; align-items: baseline; gap: 6px; background: var(--paper); border-radius: 8px; padding: 6px 12px; }
.stat-num { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-num.accent { color: var(--accent-ink); }
.stat-label { font-size: 12px; color: var(--muted); }

/* ---------- 본문 배치 ---------- */
.wrap { max-width: 1480px; margin: 0 auto; padding: 16px 16px 40px; }
@media (min-width: 1100px) {
  .wrap { display: grid; grid-template-columns: minmax(0, 1fr) 420px; column-gap: 24px; align-items: start; }
  .wrap > :not(.sheet):not(.sheet-placeholder) { grid-column: 1; }
  .sheet, .sheet-placeholder {
    grid-column: 2; grid-row: 1 / span 12; position: sticky; top: 16px;
    height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  }
  .sheet-placeholder { display: grid; place-content: center; text-align: center; line-height: 1.8; }
  .sheet-placeholder[hidden] { display: none; }
  .sheet-close { display: none; }
}

/* ---------- 검색 ---------- */
.controls { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.search-row { display: flex; gap: 8px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 10px 0; color: var(--ink); font-size: 16px; }
.btn-primary { white-space: nowrap; border: 0; border-radius: 10px; background: var(--accent); color: #0E2A27; font-weight: 700; padding: 0 20px; cursor: pointer; }
.btn-primary:hover { filter: brightness(.95); }
.btn-ghost { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 6px 12px; cursor: pointer; text-decoration: none; font-weight: 600; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-sm { font-size: 13px; padding: 5px 10px; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; min-width: 0; }
.field select { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 7px 8px; font-size: 14px; color: var(--ink); font-weight: 400; }
.field select:disabled { opacity: .5; }
.pair { display: flex; align-items: center; gap: 4px; }
.pair select { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; align-self: end; padding-bottom: 8px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* 적용된 조건 */
.applied { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.applied:empty { display: none; }
.ap { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 600; }
.ap i { font-style: normal; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 14px; line-height: 1; }
.ap:hover i { background: var(--bad); color: #fff; }
.ap-clear { border-style: dashed; color: var(--muted); font-weight: 500; padding-right: 12px; }
.ap-clear:hover { color: var(--bad); border-color: var(--bad); }

/* ---------- 한눈에 보기 ---------- */
.glance { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-top: 14px; }
.glance.is-loading { opacity: .5; }
.g-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.g-card h2 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 96px; }
.bars button { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; border: 0; padding: 0; background: none; cursor: pointer; position: relative; }
.bars button span { display: block; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 1px; }
.bars button:hover span, .bars button.on span { background: var(--accent-ink); }
.bars button:hover::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  background: var(--ink); color: var(--surface); font-size: 12px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; z-index: 2; pointer-events: none;
}
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.hbars li button { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; border: 0; background: none; padding: 2px 0; cursor: pointer; text-align: left; font-size: 13px; }
.hbars li button:hover .hb-name { color: var(--accent-ink); text-decoration: underline; }
.hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.hb-bar { grid-column: 1 / -1; height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.hb-bar span { display: block; height: 100%; background: var(--accent); }

/* ---------- 목록 ---------- */
.result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 0 8px; }
.result-line { margin: 0; font-size: 14px; color: var(--muted); }
.result-line b { color: var(--ink); }
.result-tools { display: flex; gap: 8px; align-items: center; }
.sortsel select { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 5px 8px; font-size: 13px; }
.table-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-wrap.is-loading::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 2;
  background: linear-gradient(90deg, transparent 0, #A9E6DF 20%, var(--accent) 35%, transparent 55%) 0 0 / 200% 100%;
  animation: load 1s linear infinite;
}
@keyframes load { to { background-position: -200% 0; } }
.table-wrap.is-loading tbody { opacity: .45; }
.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.list td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: top; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover td { background: var(--hover); }
.list tbody tr.is-selected td { background: var(--hover); }
.list tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.c-name b { display: block; font-weight: 700; word-break: keep-all; overflow-wrap: anywhere; }
.c-name small { color: var(--muted); font-size: 12px; }
.c-region { white-space: nowrap; color: var(--muted); font-size: 13px; }
.c-date { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 13px; }
.empty { margin: 0; padding: 40px 16px; text-align: center; color: var(--muted); }

.tag { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 7px; white-space: nowrap; background: var(--chip); color: var(--muted); }
.tag.st-ok { background: var(--accent-soft); color: var(--accent-ink); }
.tag.st-pause { background: var(--warn-soft); color: var(--warn); }
.tag.st-closed { background: var(--grey-soft); color: var(--muted); }
.tag.st-cancel { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.chips-inline { display: flex; flex-wrap: wrap; gap: 3px; }
.chips-inline .tag { font-weight: 600; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 14px 0 0; }
.pager button { min-width: 36px; height: 34px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; }
.pager button:hover:not(:disabled) { border-color: var(--accent); }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #0E2A27; font-weight: 700; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .gap { align-self: center; color: var(--muted); padding: 0 4px; }

/* ---------- 상세 ---------- */
.sheet { overflow: auto; }
.sheet-head { position: relative; padding: 16px 18px 14px; border-bottom: 1px solid var(--line); }
.sheet-tags { display: flex; flex-wrap: wrap; gap: 4px; padding-right: 32px; }
.sheet-title { margin: 8px 0 12px; font-size: 18px; letter-spacing: -.01em; word-break: keep-all; overflow-wrap: anywhere; }
.sheet-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--paper); font-size: 20px; cursor: pointer; }
.keyfacts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.keyfacts div { min-width: 0; }
.keyfacts dt { font-size: 12px; color: var(--muted); }
.keyfacts dd { margin: 0; font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.copy { border: 0; background: none; color: var(--accent-ink); font-size: 12px; cursor: pointer; padding: 0 0 0 4px; }
.sheet-body { padding: 4px 18px 20px; }
.sheet-body section { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.sheet-body section:last-child { border-bottom: 0; }
.sheet-body h3 { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 5px 10px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.raw { margin: 6px 0 0; padding: 10px; background: var(--paper); border-radius: 8px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, Consolas, monospace; }
.note { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }

/* ---------- 바닥 ---------- */
.foot { max-width: 1480px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: 12px; line-height: 1.7; }

/* ---------- 첫 화면(허브) ---------- */
.hub { max-width: 1480px; margin: 0 auto; padding: 24px 16px 48px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 340px)); gap: 14px; }
.hub-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; }
a.hub-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hub-kicker { font-size: 12px; color: var(--accent-ink); font-weight: 700; }
.hub-title { font-size: 20px; }
.hub-desc { color: var(--muted); font-size: 14px; }
.hub-num { margin-top: auto; padding-top: 8px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hub-card.is-soon { border-style: dashed; background: transparent; }
.hub-card.is-soon .hub-kicker { color: var(--muted); }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 1099px) {
  .sheet-placeholder { display: none; }
  .sheet { position: fixed; inset: auto 0 0 0; max-height: 86vh; z-index: 20; background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); }
  .sheet[hidden] { display: none; }
}
@media (max-width: 900px) {
  .glance { grid-template-columns: 1fr 1fr; }
  .g-years { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .board-stats { margin-left: 0; }
  .filters { grid-template-columns: 1fr 1fr; }
  .glance { grid-template-columns: 1fr; }
  .glance .g-card:not(.g-years) { display: none; }
  .list thead { display: none; }
  .list, .list tbody, .list tr, .list td { display: block; }
  .list tr { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
  .list td { padding: 0; border: 0; }
  .list td.c-name { grid-column: 1; }
  .list td.c-status { grid-column: 2; grid-row: 1; text-align: right; }
  .list td.c-region, .list td.c-date { display: inline; font-size: 12px; }
  .list td.c-ch { grid-column: 1 / -1; }
  .list tbody tr.is-selected td:first-child { box-shadow: none; }
  .result-tools { width: 100%; justify-content: space-between; }
}

.board-title a { color: inherit; text-decoration: none; }

/* 데이터 선택 (통신판매 | 전화권유) */
.ds-nav { display: inline-flex; gap: 2px; background: var(--paper); border-radius: 10px; padding: 3px; }
.ds-nav a { padding: 5px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.ds-nav a:hover { color: var(--ink); }
.ds-nav a[aria-current="page"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.c-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 13px; }
th.c-num { text-align: right; }
@media (max-width: 640px) { .list td.c-num { grid-column: 1 / -1; text-align: left; } }
/* 좁은 화면에서 필터 칸이 화면 밖으로 넘치지 않게 */
.filters > * { min-width: 0; }
.search-row { min-width: 0; }
.search { min-width: 0; }
@media (max-width: 640px) {
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .check { padding-bottom: 0; align-self: center; }
  .btn-primary { padding: 0 14px; }
}

/* ---------- 통합 검색 (구분 전환·꼬리표) ---------- */
.ds-nav button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.ds-nav button:hover { color: var(--ink); }
.ds-nav button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.ds-nav[hidden] { display: none; }
.tag.ds-s { background: #E3EEFB; color: #2457A6; }
.tag.ds-p { background: #F6E8FA; color: #7A2D91; }
.tag.both { background: var(--warn-soft); color: var(--warn); margin-left: 3px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.ds-s { background: #1D2E45; color: #9CC3F5; }
  :root:not([data-theme="light"]) .tag.ds-p { background: #352040; color: #E0A9F0; }
}
:root[data-theme="dark"] .tag.ds-s { background: #1D2E45; color: #9CC3F5; }
:root[data-theme="dark"] .tag.ds-p { background: #352040; color: #E0A9F0; }
.c-ds { white-space: nowrap; }
.cap { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
em.only { white-space: nowrap; font-style: normal; font-weight: 600; font-size: 11px; color: var(--muted); background: var(--chip); border-radius: 4px; padding: 0 4px; margin-left: 2px; }
.field[hidden], .check[hidden] { display: none; }
.others { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.others button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; }
.others button:hover { border-color: var(--accent); }
.others .o-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.others .o-sub { grid-column: 2; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .list td.c-ds { grid-column: 1 / -1; }
}

/* 검색창 아래의 구분 버튼 */
.ds-nav-form { display: flex; width: fit-content; max-width: 100%; margin-top: 10px; }
