:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --line: #e2e1dc;
  --line-strong: #c9c7c0;
  --text: #1c1c1a;
  --muted: #6b6a65;
  --accent: #1f5fbf;
  --accent-bg: #e8f0fb;
  --danger: #b3261e;
  --danger-bg: #fbeaea;
  --warn: #8a5a00;
  --warn-bg: #fbf1dc;
  --ok: #1d6b3a;
  --ok-bg: #e6f3ea;
  --radius: 6px;
  --pick: 128px;
  --brand: 200px;
  --toc: 168px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; }
h1 { font-size: 16px; font-weight: 600; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
button, .button, select, input[type="search"], input:not([type]), input[type="password"] {
  font: inherit; color: inherit; border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: var(--radius); height: 34px; padding: 0 12px;
}
button, .button { cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
button:hover, .button:hover { background: #f0efeb; }
button:disabled { color: var(--muted); cursor: not-allowed; background: #f0efeb; }
button.primary { background: var(--text); color: #fff; border-color: var(--text); }
button.primary:hover { background: #33332f; }
button.primary:disabled { background: #a9a8a2; border-color: #a9a8a2; color: #fff; }
button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
button:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible, .pick:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; display: grid; gap: 14px; }
.login-box label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.login-box input { width: 100%; color: var(--text); }
.login-box button { justify-content: center; height: 38px; }
.error { color: var(--danger); margin: 0; min-height: 20px; font-size: 13px; }

.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 20px; flex-wrap: wrap; }
.top-left, .top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status { color: var(--muted); font-size: 13px; }
.me { color: var(--muted); font-size: 13px; margin-left: 6px; }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px 0; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { height: 32px; border-color: var(--line); }
.tabs button[aria-selected="true"] { background: var(--text); color: #fff; border-color: var(--text); }
.tabs small { margin-left: 6px; opacity: 0.75; }
.filters { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.filters label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.filters input[type="search"] { width: 180px; color: var(--text); }
.notice { margin: 12px 20px 0; padding: 10px 14px; background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); }

.layout { display: grid; grid-template-columns: var(--toc) minmax(0, 1fr); gap: 12px; margin: 12px 20px 40px; align-items: start; }
.toc { position: sticky; top: calc(var(--top-height, 55px) + 12px); max-height: calc(100vh - var(--top-height, 55px) - 24px);
  overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.toc-head { display: flex; align-items: center; gap: 6px; margin: 4px 4px 6px 2px; font-size: 12px; color: var(--muted); cursor: pointer; }
.toc-item { display: flex; align-items: center; gap: 4px; }
.toc-item + .toc-item { margin-top: 2px; }
.toc input[type="checkbox"] { flex: none; width: 14px; height: 14px; margin: 0 2px; accent-color: var(--ok); cursor: pointer; }
.toc input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.5; }
.toc-item button { flex: 1; min-width: 0; }
.toc button { display: flex; gap: 6px; align-items: center; width: 100%; height: 26px; padding: 0 6px; border: 0; border-radius: 4px;
  font-size: 12px; background: #efeeea; color: var(--muted); text-align: left; justify-content: flex-start; }
.toc button .no { width: 24px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.toc button .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc button.done { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.toc button:hover { outline: 1px solid var(--line-strong); background: #e6e5e0; }
.toc button.done:hover { background: #d7ecde; }
.list { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.row { display: grid; grid-template-columns: var(--brand) minmax(220px, 1fr) var(--pick) var(--pick) var(--pick) 140px; gap: 14px;
  align-items: start; padding: 14px 16px; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--top-height, 55px) + 44px); }
.row.flash { box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-bg); }
.row:last-child { border-bottom: 0; }
.row.head { position: sticky; top: var(--top-height, 55px); z-index: 4; background: #fafaf8; color: var(--muted); font-size: 12px; padding: 8px 16px;
  border-radius: 10px 10px 0 0; align-items: center; }
.row.decided { background: #fcfcfb; }
.brand .name { font-weight: 600; font-size: 15px; }
.brand .code { color: var(--muted); font-size: 13px; }
.brand .where { color: var(--muted); font-size: 12px; margin-top: 6px; }
.brand .lines { white-space: pre-line; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 4px; background: #efeeea; color: var(--muted); }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }

.caps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; align-items: start; }
.cap { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden;
  display: grid; place-items: center; color: var(--muted); font-size: 12px; padding: 0; height: auto; width: 100%; }
.cap img { width: 100%; height: auto; display: block; }
.cap.none { cursor: default; border-style: dashed; background: #fafaf8; aspect-ratio: 2 / 1; }

.pick-wrap { position: relative; width: var(--pick); }
.pick { width: 100%; padding: 0; height: auto; border: 2px solid var(--line); border-radius: var(--radius);
  background: #fafaf8; overflow: hidden; display: block; text-align: left; }
.pick img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; display: block; }
.pick .cap-text { display: block; font-size: 12px; color: var(--muted); padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick.on { border-color: var(--accent); }
.pick.on .cap-text { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.pick.none { width: var(--pick); display: grid; place-items: center; aspect-ratio: 1; color: var(--muted); font-size: 12px; border-style: dashed; cursor: default; }
.zoom-btn { position: absolute; top: 6px; right: 6px; height: 22px; padding: 0 6px; font-size: 11px; border-color: transparent;
  background: rgba(255, 255, 255, 0.9); border-radius: 4px; }
.zoom-btn:hover { background: #fff; }

.decide { display: grid; gap: 6px; }
.decide .state { font-weight: 600; min-height: 21px; }
.decide .state.todo { color: var(--muted); font-weight: 400; }
.decide .mini { display: flex; gap: 4px; }
.decide .mini button { height: 28px; padding: 0 8px; font-size: 12px; }
.decide .mini button.on { background: var(--text); color: #fff; border-color: var(--text); }
.decide input { width: 100%; height: 28px; font-size: 12px; padding: 0 8px; }
.decide .by { color: var(--muted); font-size: 12px; }
.empty { padding: 40px; text-align: center; color: var(--muted); margin: 0; }

.views { margin-left: 4px; }
.views button { height: 30px; }
.page { margin: 12px 20px 40px; }
.page-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.page-bar .grow { flex: 1; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th, .grid td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.grid th { background: #fafaf8; color: var(--muted); font-weight: 400; font-size: 12px; white-space: pre-line; }
.grid th.title { color: var(--text); font-weight: 600; font-size: 13px; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.todo td { color: var(--muted); }
.grid td.muted { color: var(--muted); }
.grid .apply { white-space: normal; }
.grid .apply.done { color: var(--ok); }
.grid .apply.failed, .grid .apply.partial { color: var(--danger); }
.grid .apply.pending { color: var(--warn); }
.last-run { margin: 0; padding: 8px 12px; background: var(--accent-bg); color: var(--accent); border-radius: var(--radius); font-size: 13px; }
.plan.quiet h3 { color: var(--muted); font-weight: 400; }
.plan.quiet ul { max-height: 120px; color: var(--muted); }
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(20, 20, 18, 0.5); display: grid; place-items: center; padding: 24px; }
.panel { width: min(760px, 100%); max-height: 86vh; background: var(--surface); border-radius: 10px; display: grid; grid-template-rows: auto 1fr auto; }
.panel header, .panel footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; }
.panel header { border-bottom: 1px solid var(--line); }
.panel footer { border-top: 1px solid var(--line); }
#apply-body { overflow: auto; padding: 16px 18px; display: grid; gap: 16px; }
.counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.count { background: #f6f6f4; border-radius: var(--radius); padding: 10px 12px; }
.count b { display: block; font-size: 20px; font-weight: 600; }
.count span { color: var(--muted); font-size: 12px; }
.plan h3 { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.plan ul { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); max-height: 220px; overflow: auto; }
.plan li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.plan li:last-child { border-bottom: 0; }
.plan li span:last-child { color: var(--muted); text-align: right; }
.plan li.failed span:last-child, .plan li.partial span:last-child { color: var(--danger); }
.zoom { cursor: zoom-out; }
.zoom img { max-width: 92vw; max-height: 90vh; border-radius: 8px; background: #fff; }

@media (max-width: 1500px) {
  :root { --pick: 112px; --brand: 176px; --toc: 150px; }
}
@media (max-width: 1280px) {
  :root { --pick: 96px; --brand: 150px; --toc: 128px; }
  .row { gap: 10px; padding: 12px; grid-template-columns: var(--brand) minmax(200px, 1fr) var(--pick) var(--pick) var(--pick) 128px; }
  .layout { margin: 12px 12px 40px; }
}

/* ---- 쇼핑검색 신규 그룹 */
.ssa-on .pl-only { display: none !important; }
.tabs button.apart { margin-left: 14px; }
.ssa { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); gap: 12px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.card h2, h2.section { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
h2.section { margin: 24px 0 8px; }
.card .page-bar h2 { margin: 0; }
.card .page-bar:last-child { margin: 12px 0 0; }
.ssa textarea { width: 100%; font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px; resize: vertical; tab-size: 12; }
.ssa-texts { display: grid; gap: 8px; margin-top: 10px; }
.ssa-texts label { display: grid; grid-template-columns: 52px 1fr; align-items: center; color: var(--muted); font-size: 13px; }
.ssa-texts input { color: var(--text); width: 100%; }
.status.bad { color: var(--danger); }
.skipped { margin: 8px 0 0; padding-left: 18px; color: var(--warn); font-size: 13px; }
.skipped:empty { display: none; }
.grid .apply.skipped { color: var(--muted); }
button.link { height: auto; padding: 0; color: var(--accent); text-decoration: underline; }
@media (max-width: 1100px) { .ssa { grid-template-columns: 1fr; } }
