:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #efede8; --line: #e2dfd8;
  --text: #1d1c1a; --muted: #6d6a63; --accent: #3f5bd9; --accent-weak: #e6eafb;
  --ok: #1f8a4c; --ok-weak: #e1f3e8; --warn: #a86400; --warn-weak: #fbefd9;
  --err: #c2372f; --err-weak: #fbe4e2; --info: #5b6270; --info-weak: #eceef2;
  --radius: 12px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic",
          "Hiragino Sans", "Noto Sans KR", "Noto Sans JP", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a; --surface: #1f2024; --surface-2: #28292e; --line: #33353b;
    --text: #ecebe8; --muted: #9a9790; --accent: #8ea2ff; --accent-weak: #2a3052;
    --ok: #5cc98a; --ok-weak: #1d3526; --warn: #f0b458; --warn-weak: #3a2e19;
    --err: #ff8078; --err-weak: #42221f; --info: #a9afbb; --info-weak: #2a2d33;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 17px; } h3 { font-size: 15px; }

/* ── top bar ── */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.01em; }
.top-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; }
.nodes-pill { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.on { background: var(--ok); } .dot.off { background: var(--err); }

/* ── tabs: bottom bar on phones, top strip on wide screens ── */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; border: 0;
  background: none; font-size: 11px; color: var(--muted); cursor: pointer; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--accent); }
@media (min-width: 900px) {
  body { padding-bottom: 24px; }
  .tabs { position: sticky; top: 57px; bottom: auto; display: flex; gap: 4px; padding: 8px 16px; border-top: 0;
    border-bottom: 1px solid var(--line); background: var(--bg); }
  .tabs button { flex-direction: row; gap: 6px; font-size: 14px; padding: 7px 14px; border-radius: 9px; }
  .tabs svg { width: 18px; height: 18px; }
  .tabs button.active { background: var(--accent-weak); }
}

main { max-width: 1400px; margin: 0 auto; padding: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ── buttons & inputs ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 13px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #111; } }
.btn.danger { color: var(--err); }
.btn.sm { min-height: 30px; padding: 3px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
textarea { min-height: 80px; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; gap: 10px; align-items: center; padding: 8px 0; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ── status chips ── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: var(--info-weak); color: var(--info); white-space: nowrap; }
.chip.pass, .chip.ok { background: var(--ok-weak); color: var(--ok); }
.chip.warn { background: var(--warn-weak); color: var(--warn); }
.chip.fail, .chip.error { background: var(--err-weak); color: var(--err); }
.chip.persona { background: var(--surface-2); color: var(--muted); font-weight: 500; }
.sev { width: 18px; text-align: center; font-weight: 700; flex: none; }
.sev.error { color: var(--err); } .sev.warn { color: var(--warn); } .sev.info { color: var(--muted); }

/* ── pipeline board ── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto;
  scroll-snap-type: x mandatory; padding-bottom: 8px; margin: 0 -16px; padding-inline: 16px; }
.col { scroll-snap-align: start; background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 140px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; font-weight: 700; font-size: 14px; }
.col-head .count { color: var(--muted); font-weight: 500; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 8px;
  cursor: pointer; box-shadow: var(--shadow); display: grid; gap: 8px; text-align: left; width: 100%; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card-title { font-weight: 650; }
.checks { display: flex; gap: 5px; flex-wrap: wrap; }
.gatebar { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.bar.bad > i { background: var(--warn); }
.empty { color: var(--muted); font-size: 13px; padding: 10px 4px; }
@media (min-width: 1100px) { .board { grid-auto-flow: row; grid-template-columns: repeat(5, 1fr); overflow: visible; margin: 0; padding-inline: 0; } }

/* ── panels, lists ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 12px; }
.panel-pad { padding: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list > li.click { cursor: pointer; } .list > li.click:hover { background: var(--surface-2); }
.list .meta { font-size: 12px; color: var(--muted); }
.detail { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; color: var(--muted);
  background: var(--surface-2); border-radius: 8px; padding: 7px 9px; margin-top: 6px; max-height: 180px; overflow: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; border-top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.similar td { background: var(--warn-weak); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.filters .btn.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.two-col { display: grid; gap: 12px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 340px 1fr; align-items: start; } }

/* ── bottom sheet / side drawer ── */
.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 40; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; background: var(--bg);
  border-radius: 18px 18px 0 0; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 40px rgb(0 0 0 / .2); }
.sheet .grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 12px; }
@media (min-width: 900px) {
  .sheet { left: auto; top: 0; width: 520px; max-height: none; border-radius: 0; border-left: 1px solid var(--line); padding-top: 20px; }
  .sheet .grip { display: none; }
}
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.sheet h3 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.gate-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.gate-item:first-child { border-top: 0; }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); width: min(420px, 92vw); padding: 20px; }
dialog::backdrop { background: rgb(0 0 0 / .4); }
dialog form { display: grid; gap: 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 14px; max-width: 92vw; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ── review / publishing ── */
.tabs { grid-template-columns: repeat(7, 1fr); }
@media (max-width: 767px) { .tabs button span { font-size: 10.5px; letter-spacing: -0.02em; white-space: nowrap; } }
.tabs button { position: relative; }
.badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--err); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; line-height: 17px; text-align: center; }
@media (min-width: 900px) { .badge { position: static; margin-left: 2px; } }
.banner { border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; background: var(--warn-weak); color: var(--warn); }
.content-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-bottom: 1px solid var(--line); }
.thumb { width: 72px; height: 128px; border-radius: 8px; background: var(--surface-2); object-fit: cover; flex: none; }
.thumb.wide { width: 128px; height: 72px; }
.posts { display: grid; gap: 0; }
@media (min-width: 1100px) { .posts { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
.post { padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; align-content: start; }
@media (min-width: 1100px) { .post { border-left: 1px solid var(--line); } }
.post-head { display: flex; align-items: center; gap: 8px; }
.pf { font-weight: 700; }
.counter { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--err); font-weight: 700; }
.post textarea { min-height: 110px; font-size: 14px; }
.post .findings { font-size: 13px; }
.post .findings .list > li { padding: 6px 0; border: 0; }
.chip.ready { background: var(--accent-weak); color: var(--accent); }
.chip.needs_fix, .chip.failed { background: var(--err-weak); color: var(--err); }
.chip.checking, .chip.approved, .chip.manual, .chip.scheduled { background: var(--warn-weak); color: var(--warn); }
.chip.published { background: var(--ok-weak); color: var(--ok); }
.chip.rejected { background: var(--surface-2); color: var(--muted); }
.plat-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.plat-picks label { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--text); }
.progress { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.copy-row { display: flex; gap: 6px; align-items: flex-start; }
.copy-row pre { flex: 1; margin: 0; white-space: pre-wrap; font: 13px/1.5 var(--font); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; max-height: 160px; overflow: auto; }
