:root {
  --bg: #f4f6fa; --panel: #ffffff; --ink: #1b2333; --muted: #6a7486; --line: #e1e6ef;
  --accent: #2b59c3; --accent-ink: #ffffff; --accent-soft: #e9effc;
  --pass: #157347; --pass-bg: #e3f4ea; --warn: #9a6200; --warn-bg: #fff3d6; --fail: #b42318; --fail-bg: #fde7e5;
  --code: #f1f3f7; --shadow: 0 1px 2px rgba(20,30,50,.06), 0 4px 16px rgba(20,30,50,.06);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c; --panel: #1b2029; --ink: #e6e9ef; --muted: #98a2b3; --line: #2c3340;
    --accent: #6d95f0; --accent-ink: #0d1220; --accent-soft: #1f2a44;
    --pass: #5fd394; --pass-bg: #163222; --warn: #f2c063; --warn-bg: #3a2d10; --fail: #ff8a80; --fail-bg: #3b1714;
    --code: #232a35; --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; }
code { background: var(--code); padding: 1px 5px; border-radius: 5px; font-size: .88em; }
.muted { color: var(--muted); }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 13.5px; }
.btn.danger:hover { border-color: var(--fail); color: var(--fail); }
.btn:focus-visible, .drop:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

.brand { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.brand .sub { font-weight: 500; font-size: 13px; color: var(--muted); }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-family: serif; font-style: italic; }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login-card p { margin: 0; }
.login-card label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.login-card input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.err { color: var(--fail); background: var(--fail-bg); padding: 8px 12px; border-radius: 8px; }

/* 레이아웃 */
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.app { display: grid; grid-template-columns: 360px 1fr; gap: 20px; padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; padding: 16px; } .top { padding: 12px 16px; } .brand .sub { display: none; } }
.left { display: grid; gap: 14px; align-content: start; }

.drop { border: 2px dashed var(--line); background: var(--panel); border-radius: var(--radius); padding: 32px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { font-size: 34px; color: var(--accent); line-height: 1; }
.drop-title { font-weight: 700; font-size: 16px; }
.drop .btn { margin-top: 8px; }
.help { font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.queue { display: grid; gap: 8px; }
.q { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.q .bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.q .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.q.err { border-color: var(--fail); color: var(--fail); }

/* 목록 */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.list-head h2 { margin: 0; font-size: 18px; }
.list-actions { display: flex; gap: 12px; align-items: center; }
.chk { font-size: 13.5px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.list { display: grid; gap: 10px; }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.item .name { font-weight: 700; word-break: break-all; }
.item .meta { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.item .issues { font-size: 13px; margin-top: 4px; color: var(--muted); }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .item { grid-template-columns: auto 1fr; } .item .acts { grid-column: 1 / -1; justify-content: flex-start; } }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.pass { color: var(--pass); background: var(--pass-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.fail { color: var(--fail); background: var(--fail-bg); }
.badge.wait { color: var(--muted); background: var(--code); }
.spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 보고서 */
.report { width: min(1100px, calc(100vw - 32px)); height: min(860px, calc(100vh - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); }
.report[open] { display: grid; grid-template-rows: auto auto 1fr; }
.report::backdrop { background: rgba(10,15,25,.55); }
.rep-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.rep-title { font-weight: 800; font-size: 17px; word-break: break-all; margin-bottom: 4px; }
.rep-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.rep-body { overflow: auto; padding: 18px 20px; }
.rep-body h3 { font-size: 15px; margin: 18px 0 8px; }
.rep-body h3:first-child { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat.ok .v { color: var(--pass); } .stat.bad .v { color: var(--fail); } .stat.mid .v { color: var(--warn); }
.issue-list { margin: 0; padding-left: 20px; }
.note { font-size: 13px; color: var(--muted); background: var(--code); border-radius: 8px; padding: 10px 12px; margin-top: 14px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.t th { font-size: 12.5px; color: var(--muted); font-weight: 600; position: sticky; top: -18px; background: var(--panel); }
table.t td.n { color: var(--muted); font-variant-numeric: tabular-nums; width: 40px; }
.mx { overflow-x: auto; max-width: 380px; }
.tex { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-all; margin-top: 4px; }
.filter { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 13.5px; }
.diff { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.diff .row { padding: 8px 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.diff .row + .row { border-top: 1px solid var(--line); }
.diff .lbl { font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 6px; }
del { background: var(--fail-bg); color: var(--fail); text-decoration: line-through; }
ins { background: var(--pass-bg); color: var(--pass); text-decoration: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); color: var(--muted); font: inherit; font-weight: 600; font-size: 13.5px; padding: 7px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.pv-frame { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.docx-view { border: 1px solid var(--line); border-radius: 8px; overflow: auto; background: #e9ecf1; }
.docx-view .docx-wrapper { background: #e9ecf1; padding: 20px; }
.docx-view .docx-wrapper > section.docx { box-shadow: 0 1px 6px rgba(0,0,0,.18); margin-bottom: 20px; color: #000; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); }
