:root {
  --bg: #f4f5f7; --panel: #ffffff; --line: #e3e6ea; --text: #1f2933; --muted: #6b7684;
  --accent: #2f6fed; --accent-2: #1d4fd7; --ok: #1a8f5a; --warn: #c2410c; --run: #b45309;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", Roboto, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
.app { display: grid; grid-template-columns: 460px 1fr; height: 100vh; }
.left { border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.right { display: flex; flex-direction: column; min-width: 0; }
.hdr { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
h1 { font-size: 18px; margin: 0 0 2px; }
h2 { font-size: 14px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.sub { color: var(--muted); font-size: 12px; }
.badge { background: #eef2ff; color: #3730a3; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.req { color: var(--warn); }
input, textarea, select { width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); background: #fff; }
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid #c7d7ff; border-color: var(--accent); }
button, .btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-decoration: none; color: var(--text); display: inline-block; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; width: 100%; }
button.primary:hover { background: var(--accent-2); }
button:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.ghost { background: #fff; }
.row { display: flex; gap: 8px; }
.row .primary { flex: 1; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.site-meta { margin-bottom: 10px; }
code { font-family: var(--mono); font-size: 12px; background: #f1f3f5; padding: 1px 5px; border-radius: 4px; }
.log { margin: 0; background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 10px; height: 200px; overflow: auto; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.log .info { color: #93c5fd; } .log .tool { color: #a7f3d0; } .log .assistant { color: #fde68a; } .log .warn { color: #fca5a5; } .log .t { color: #64748b; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.pill.idle { background: #e5e7eb; color: #374151; } .pill.running { background: #fef3c7; color: var(--run); } .pill.error { background: #fee2e2; color: #991b1b; } .pill.done { background: #d1fae5; color: var(--ok); }
.totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.tot { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.tot .k { font-size: 11px; color: var(--muted); } .tot .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tot.big { grid-column: 1 / -1; background: #eef2ff; border-color: #c7d2fe; } .tot.big .v { font-size: 24px; color: #1e3a8a; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:nth-child(-n+3), td:nth-child(-n+3) { text-align: left; }
td.instr { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
tfoot td { font-weight: 700; background: #f8fafc; }
tr.err td { color: #991b1b; }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.toolbar .url { flex: 1; font-family: var(--mono); font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar select { width: auto; margin: 0; }
.preview { flex: 1; position: relative; background: #fff; display: flex; flex-direction: column; min-height: 0; }
iframe { width: 100%; flex: 1 1 auto; min-height: 80px; border: 0; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.empty-inner { max-width: 460px; text-align: center; }
.empty h3 { color: var(--text); }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; grid-template-rows: auto 70vh; height: auto; } .left { border-right: 0; border-bottom: 1px solid var(--line); } }

input[type=file] { padding: 6px; background: #f8fafc; }
.hint { display: block; margin-top: 4px; }
.attach-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attach-list li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.attach-list .thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: #f1f3f5; flex: none; }
.attach-list .doc { width: 40px; height: 40px; border-radius: 6px; background: #eef2ff; color: #3730a3; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.attach-list .info { flex: 1; min-width: 0; }
.attach-list .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-list .name a { color: var(--text); text-decoration: none; } .attach-list .name a:hover { text-decoration: underline; }
.attach-list .meta { font-size: 11px; color: var(--muted); }
.attach-list .tag { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: #fef3c7; color: #92400e; margin-left: 4px; }
.attach-list .del { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; } .attach-list .del:hover { color: #991b1b; }
.upload-now { margin-top: 6px; }

/* 소스 편집기 (우측 하단) */
.splitter { height: 6px; background: var(--line); cursor: row-resize; flex: none; }
.splitter:hover { background: #c7d2fe; }
.editor { height: 45%; min-height: 120px; flex: none; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: #0f172a; }
.editor-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border-bottom: 1px solid var(--line); }
.editor-bar select { width: auto; margin: 0; max-width: 260px; }
.editor-bar .spacer { flex: 1; }
.editor-bar .inline { display: inline-flex; align-items: center; gap: 4px; margin: 0; color: var(--muted); font-size: 12px; }
.editor-bar .inline input { width: auto; margin: 0; }
.small-btn { padding: 5px 10px; font-size: 12px; }
.small-btn.primary { width: auto; }
.edit-state { font-size: 12px; color: var(--ok); }
.edit-state.dirty { color: var(--warn); font-weight: 600; }
.editor-body { flex: 1; display: flex; min-height: 0; }
.line-nos { margin: 0; padding: 10px 6px 10px 10px; color: #64748b; background: #0b1220; text-align: right; font-family: var(--mono); font-size: 12px; line-height: 1.5; overflow: hidden; user-select: none; flex: none; }
#editor { flex: 1; margin: 0; padding: 10px; border: 0; border-radius: 0; resize: none; background: #0f172a; color: #e2e8f0; font-family: var(--mono); font-size: 12px; line-height: 1.5; tab-size: 2; outline: none; }
.toolbar button.active { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }

/* 드래그앤드롭 첨부 */
.field-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.dropzone { position: relative; border: 2px dashed #c9d1dc; border-radius: 10px; padding: 12px; background: #f8fafc; margin-bottom: 8px; transition: border-color .15s, background .15s; }
.dropzone.dragover { border-color: var(--accent); background: #eef2ff; }
.dz-text { font-size: 12px; color: var(--muted); text-align: center; }
.dz-pick { color: var(--accent); cursor: pointer; text-decoration: underline; display: inline; margin: 0; font-size: 12px; }
.pending { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pending:empty { display: none; }
.pending li { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px; }
.pending li .pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.pending li .ps { color: var(--muted); }
.pending li button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }
.pending li button:hover { color: #991b1b; }
.drop-overlay { position: fixed; inset: 0; background: rgba(47, 111, 237, .12); border: 3px dashed var(--accent); z-index: 1000; display: grid; place-items: center; pointer-events: none; }
.drop-overlay-box { background: #fff; border: 1px solid #c7d2fe; color: #1e3a8a; font-weight: 700; padding: 14px 22px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }

/* 사용자 / git 보관 */
.hdr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hdr-right select { width: auto; margin: 0; max-width: 260px; }
.user { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.git-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow: auto; }
.git-list li { display: flex; align-items: center; gap: 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.git-list .kind { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: #e0e7ff; color: #3730a3; flex: none; }
.git-list .kind.manual-edit { background: #fef3c7; color: #92400e; } .git-list .kind.create { background: #d1fae5; color: #065f46; }
.git-list .bname { font-family: var(--mono); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.git-list .bname a { color: var(--text); text-decoration: none; } .git-list .bname a:hover { text-decoration: underline; }
.git-list .st { flex: none; } .git-list .st.ok { color: var(--ok); } .git-list .st.fail { color: #991b1b; }

/* 기본 사항 수정 */
.basics { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; background: #fafbfc; }
.basics summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); }
.basics[open] summary { margin-bottom: 8px; }
.basics-state { font-size: 11px; font-weight: 600; margin-left: 6px; color: var(--warn); }
.basics-state.pending { color: #92400e; }

/* 모드 선택 / 위저드 */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-opt { text-align: left; padding: 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.mode-opt:hover { border-color: var(--accent); background: #f5f8ff; }
.mode-title { font-weight: 700; font-size: 14px; } .mode-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.refs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.refs .ref { display: grid; grid-template-columns: 1fr auto; gap: 4px 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.refs .ref input, .refs .ref textarea { margin: 0; font-size: 12px; padding: 6px 8px; }
.refs .ref textarea { grid-column: 1 / -1; }
.refs .ref .rm { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; }
.refs .add { align-self: flex-start; }
.steps { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.steps button { padding: 3px 8px; font-size: 11px; border-radius: 999px; }
.steps button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.steps button.done { background: #d1fae5; border-color: #a7f3d0; color: #065f46; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; background: #fff; cursor: pointer; }
.chip.on { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; font-weight: 600; }
.chip.disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.card-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.opt-card { border: 2px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; background: #fff; }
.opt-card.on { border-color: var(--accent); background: #f5f8ff; }
.opt-card .t { font-weight: 700; font-size: 13px; } .opt-card .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.swatches { display: flex; gap: 4px; margin-top: 6px; } .swatches span { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.08); }
.tone-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.origin { font-size: 10px; padding: 1px 5px; border-radius: 999px; margin-left: 4px; vertical-align: middle; }
.origin.user { background: #d1fae5; color: #065f46; } .origin.ai { background: #fef3c7; color: #92400e; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 8px; font-size: 12px; margin-bottom: 8px; align-items: start; }
.kv .k { color: var(--muted); padding-top: 6px; } .kv input, .kv textarea, .kv select { margin: 0; font-size: 12px; padding: 5px 8px; }
.warn-list { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 4px; }
.warn-list li { font-size: 12px; padding: 5px 8px; border-radius: 6px; background: #fef3c7; color: #92400e; }
.warn-list li.error { background: #fee2e2; color: #991b1b; } .warn-list li.info { background: #e0e7ff; color: #3730a3; }
.pages-edit { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.page-row { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; }
.page-row.dragover { border-color: var(--accent); }
.page-row .ph { display: flex; align-items: center; gap: 6px; }
.page-row .ph .handle { cursor: grab; color: var(--muted); }
.page-row .ph input { margin: 0; font-size: 12px; padding: 4px 6px; flex: 1; }
.page-row .ph .rm { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.page-row .secs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.page-row .secs .chip { font-size: 11px; padding: 2px 8px; }
.facts-table { width: 100%; font-size: 12px; border-collapse: collapse; margin-bottom: 8px; }
.facts-table td { padding: 4px 4px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; white-space: normal; }
.facts-table input, .facts-table textarea, .facts-table select { margin: 0; font-size: 12px; padding: 4px 6px; }
.facts-table .src { font-size: 10px; color: var(--muted); }
.report { font-size: 12px; }
.report .sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.report .sum span { border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.report .sum span.bad { background: #fee2e2; border-color: #fecaca; color: #991b1b; } .report .sum span.ok { background: #d1fae5; border-color: #a7f3d0; color: #065f46; }
.report ul { margin: 4px 0 8px; padding-left: 18px; }
.report li.fail { color: #991b1b; } .report li.partial { color: #92400e; } .report li.pass { color: #065f46; }
.publish-box { border: 1px solid #a7f3d0; background: #ecfdf5; border-radius: 8px; padding: 10px; font-size: 12px; }
.publish-box .later { opacity: .6; }
.brief-json { max-height: 220px; overflow: auto; background: #0f172a; color: #e2e8f0; font-family: var(--mono); font-size: 11px; padding: 8px; border-radius: 8px; white-space: pre-wrap; }
.qbox { border: 1px solid #c7d2fe; background: #eef2ff; border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.summary-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 4px; }
.summary-list li { display: grid; grid-template-columns: 90px 1fr auto; gap: 6px; font-size: 12px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.summary-list li .k { color: var(--muted); } .summary-list li button { padding: 1px 6px; font-size: 11px; }
.wf-note { font-size: 11px; color: var(--muted); }

.progress-bar { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 6px; }
.git-list .kind.restore { background: #fce7f3; color: #9d174d; }

/* 진행 표시기 */
.progress { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.progress .pi { width: 34px; height: 34px; display: grid; place-items: center; position: relative; flex: none; }
.progress .pi > * { display: none; }
.progress .spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #c7d2fe; border-top-color: var(--accent); animation: spin .9s linear infinite; }
.progress .check { width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: #fff; font-weight: 700; display: none; place-items: center; }
.progress .bang { width: 28px; height: 28px; border-radius: 50%; background: #dc2626; color: #fff; font-weight: 700; display: none; place-items: center; }
.progress .dot { width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; }
.progress.running .spinner { display: block; } .progress.idle .dot { display: block; } .progress.done .check { display: grid; } .progress.error .bang { display: grid; }
.progress.running { background: #eef2ff; border-color: #c7d2fe; } .progress.done { background: #ecfdf5; border-color: #a7f3d0; } .progress.error { background: #fef2f2; border-color: #fecaca; }
.progress .pt { min-width: 0; } #progressText { font-weight: 600; font-size: 13px; }
.progress-warn { margin-top: 8px; font-size: 12px; color: #991b1b; background: #fee2e2; border-radius: 8px; padding: 6px 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress .ptok { margin-left: auto; text-align: right; flex: none; min-width: 120px; }
.progress .ptok .k { font-size: 11px; color: var(--muted); }
.progress .ptok .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: #1e3a8a; transition: transform .15s; }
.progress .ptok .v.bump { transform: scale(1.08); }
.progress .ptok .d { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress.running .ptok .k::after { content: ' · 집계 중'; color: var(--accent); }

.progress .cancel { border-color: #fecaca; color: #991b1b; background: #fff; flex: none; }
.progress .cancel:hover { background: #fee2e2; }
.progress.cancelled { background: #fff7ed; border-color: #fed7aa; } .progress.cancelled .bang { display: grid; background: #ea580c; }
.pill.cancelled { background: #ffedd5; color: #9a3412; }
tr.cancelled td { color: #9a3412; }

.pmsg { font-size: 12px; color: #1e3a8a; min-height: 16px; margin: 2px 0; transition: opacity .2s; }
.pmsg.flash { opacity: .35; }
.progress .ptok .v.amt { font-size: 16px; color: #065f46; }
.progress.running .ptok .k::after { content: ''; }
.progress.running .ptok .k.live::after { content: ' · 집계 중'; color: var(--accent); }

.git-list .kind.deploy { background: #d1fae5; color: #065f46; }
