:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1c2330;
  --muted: #5d6676;
  --line: #d9dde5;
  --accent: #1f5fd0;
  --accent-text: #ffffff;
  --ok: #17794b;
  --ok-bg: #e3f5ea;
  --warn: #8a5a00;
  --warn-bg: #fff2cf;
  --error: #b3261e;
  --error-bg: #fde8e6;
  --info: #174f9c;
  --info-bg: #e3edfb;
  --mock-bg: #ffd54a;
  --mock-text: #3b2a00;
  --live-bg: #b3261e;
  --live-text: #ffffff;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
    system-ui, sans-serif;
}

.preflight-panel { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); scroll-margin-top: 9rem; }
.preflight-summary, .preflight-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.preflight-records, .source-list { list-style: none; margin: .65rem 0; padding: 0; }
.preflight-record { display: flex; flex-wrap: wrap; gap: .4rem .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.preflight-record label { display: flex; align-items: center; gap: .55rem; }
.preflight-record input[type="checkbox"] { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.preflight-reason { width: 100%; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.preflight-grouping { margin: .7rem 0; }
.preflight-grouping label { display: block; font-weight: 600; }
.preflight-grouping input { width: min(100%, 24rem); margin: .35rem .5rem .35rem 0; }
.source-panel { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .85rem; }
.source-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .45rem 0; }
.source-list .file-name { flex: 1; min-width: 8rem; overflow-wrap: anywhere; }
.learning-note { margin-top: .9rem; }
.reference-easy { margin:1rem 0; padding:1rem; border:1px solid #b9cdef; border-radius:10px; background:#f4f8ff; }
.reference-easy input[type="file"] { max-width:100%; }
.reference-easy button { margin-top:.6rem; }
.studio-context { display:flex; flex-wrap:wrap; justify-content:space-between; gap:1rem; padding:.8rem 0 1rem; }
.studio-context strong { font-size:1.1rem; }
.studio-context p { margin:.35rem 0; }
.studio-context > div { min-width:0; overflow-wrap:anywhere; }
.beginner-nav { display:flex; gap:.35rem; margin:1rem 0; }
.beginner-nav button { flex:1; background:var(--panel); color:var(--text); border:1px solid var(--line); }
.beginner-nav button[aria-current="page"] { background:var(--accent); color:white; border-color:var(--accent); }
.beginner-panel { max-width:720px; margin:1rem auto; padding:2rem; min-height:20rem; }
.beginner-panel h2 { font-size:1.45rem; line-height:1.5; margin-bottom:1.3rem; }
.beginner-panel .beginner-primary { display:block; width:100%; margin:1.5rem 0 .6rem; min-height:52px; }
.beginner-field { display:flex; flex-direction:column; gap:.5rem; margin:1.4rem 0; }
.beginner-field input,.beginner-field select { width:100%; min-width:0; min-height:48px; }
.beginner-progress { color:var(--muted); font-size:.85rem; margin:0 0 .7rem; }
.beginner-preview { margin:1rem 0; max-width:100%; }
.beginner-preview img { max-width:100%; max-height:430px; object-fit:contain; border:1px solid var(--line); display:block; margin:auto; }
.beginner-preview figcaption { font-size:.8rem; color:var(--muted); margin-top:.4rem; text-align:center; }
.beginner-fields { padding-left:1.4rem; }
.beginner-fields li { padding:.25rem 0; }
.beginner-cost-status { font-size:.85rem; color:var(--muted); margin:.4rem 0; }
.beginner-sample-preview { display:block; width:100%; height:260px; object-fit:contain; border:1px solid var(--line); }
.beginner-check-label { display:flex; align-items:start; gap:.6rem; margin:1rem 0; }
.beginner-check-label input { flex-shrink:0; margin-top:.3rem; }
.beginner-check-results li { margin:.6rem 0; }
.manager-settings { max-width:100%; margin-top:2rem; }
.manager-settings > summary { cursor:pointer; color:var(--muted); }
.beginner-grouping button { margin:.3rem; }
body[data-place="prepare"] main,body[data-place="upload"] main { max-width:780px; }
body[data-place="upload"] .intake-grid { grid-template-columns:1fr; }
body[data-place="prepare"] .brand .eyebrow { display:none; }
body .app-header { padding:.65rem 1rem; }
body .app-header h1 { font-size:1.1rem; }
body .app-header .brand-mark { display:none; }
@media(max-width:600px) { .beginner-panel { padding:1.1rem; } .beginner-nav button { font-size:.8rem; padding:.65rem .3rem; min-height:48px; } .beginner-panel h2 { font-size:1.25rem; } .beginner-preview img { max-height:340px; } }
#studio-panel { overflow-wrap:anywhere; }
#studio-panel select { max-width:100%; }
.studio-nav { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.4rem; margin:0 0 1rem; }
.studio-nav button { text-align:left; background:var(--panel); color:var(--text); border:1px solid var(--line); padding:.75rem; }
.studio-nav button[aria-current="step"] { color:var(--accent); border-color:var(--accent); background:var(--info-bg); }
.studio-row { display:flex; flex-wrap:wrap; align-items:end; gap:.6rem; margin:.8rem 0; }
.studio-field { display:flex; flex-direction:column; gap:.25rem; max-width:100%; }
.studio-field input { min-width:8rem; max-width:100%; }
#studio-panel > button, #studio-panel > select { margin:.35rem .5rem .35rem 0; }
#studio-panel fieldset { border:1px solid var(--line); margin:1rem 0; padding:.8rem; min-width:0; }
#studio-panel legend { font-weight:600; padding:0 .3rem; }
.roi-preview { max-width:850px; border:1px solid var(--line); background:var(--bg); margin:1rem 0; }
.roi-preview canvas { display:block; max-width:100%; width:100%; height:auto; touch-action:none; }
.roi-coordinates { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.5rem; }
.roi-coordinates input { width:100%; min-width:0; }
.roi-regions li, .evaluation-cases>li { margin:.6rem 0; overflow-wrap:anywhere; }
.roi-regions button { margin-left:.5rem; }
.evaluation-result { border-top:1px solid var(--line); margin:1rem 0; padding-top:.6rem; }
.api-disclosure { margin-top:1rem; }
.api-disclosure ol { max-height:16rem; overflow:auto; font-size:.8rem; overflow-wrap:anywhere; }
@media(max-width:650px) { .studio-nav { grid-template-columns:1fr 1fr; } .roi-coordinates { grid-template-columns:1fr 1fr; } .studio-row { align-items:stretch; } .studio-field { flex:1; } }
@media (max-width: 600px) { .preflight-panel { scroll-margin-top: 17rem; } .preflight-actions button, .preflight-grouping button { width: 100%; } }


* { box-sizing: border-box; }
html { font-size: 19px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0 0 0.5rem; line-height: 1.3; }
h1 { font-size: 1.35rem; }
h1 small { font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-left: 0.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.95rem; }
p { margin: 0.4rem 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* 모의/실제 AI 표시 */
.mode-banner {
  position: sticky; top: 0; z-index: 10;
  padding: 0.55rem 1rem; font-size: 0.95rem; text-align: center;
}
.mode-mock { background: var(--mock-bg); color: var(--mock-text); border-bottom: 3px solid #b88700; }
.mode-live { background: var(--live-bg); color: var(--live-text); border-bottom: 3px solid #6e120d; }
.mode-unknown { background: var(--line); color: var(--text); }
.banner-tag {
  margin-left: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px;
  background: rgba(0, 0, 0, 0.15); font-size: 0.8rem;
}
.banner-lost { background: #000; color: #fff; }

.app-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.75rem 1rem; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.app-header h1 { margin: 0; }
.tabs { display: flex; gap: 0.25rem; }
.tabs button {
  background: transparent; color: var(--text); border: 1px solid var(--line);
  padding: 0.4rem 1rem;
}
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

main { padding: 1rem; max-width: 1800px; margin: 0 auto; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 1rem; margin-bottom: 1rem;
}

button {
  font: inherit; cursor: pointer; border-radius: 6px; padding: 0.45rem 0.9rem;
  background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--accent); }
button.small { padding: 0.2rem 0.6rem; font-size: 0.85rem; }
button.link {
  background: none; border: none; color: var(--accent); text-decoration: underline;
  padding: 0.1rem 0.3rem; font-size: 0.85rem;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

input[type="text"], input[type="number"], textarea, select {
  font: inherit; width: 100%; padding: 0.35rem 0.5rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
textarea { resize: vertical; }

.hint { color: var(--muted); font-size: 0.88rem; }
.error-text { color: var(--error); }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }
.empty { color: var(--muted); padding: 1rem 0; }
.meta { color: var(--muted); font-size: 0.85rem; }

/* 업로드 */
.dropzone {
  border: 2px dashed var(--line); border-radius: 8px; padding: 1.25rem;
  text-align: center; transition: background 0.1s, border-color 0.1s;
}
.dropzone.drag-over { background: var(--info-bg); border-color: var(--accent); }
.queue-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.queue-list { list-style: none; padding: 0; margin: 0; }
.queue-item { border-top: 1px solid var(--line); padding: 0.4rem 0; }
.queue-main { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.file-name { font-weight: 600; word-break: break-all; }
.file-size, .queue-state { color: var(--muted); font-size: 0.85rem; }
.queue-message { font-size: 0.85rem; color: var(--muted); }
.queue-rejected .queue-message, .queue-error .queue-message { color: var(--error); }
.rejected { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; }
.rejected ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }
progress { width: 8rem; height: 0.7rem; vertical-align: middle; }

/* 현황 */
.counts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.4rem; }
.count-chip { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.8rem; }
.count-chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.badge { display: inline-block; padding: 0.05rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--line); color: var(--muted); }
.badge-mock { background: var(--mock-bg); color: var(--mock-text); }
.badge-live { background: var(--live-bg); color: var(--live-text); }

/* 작업 영역 */
.workspace { display: grid; grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
.doc-list { list-style: none; padding: 0; margin: 0; max-height: 70vh; overflow: auto; }
.doc-item { border-top: 1px solid var(--line); padding: 0.25rem 0; }
.doc-item.selected { background: var(--info-bg); }
.doc-select {
  display: block; width: 100%; text-align: left; background: transparent; color: var(--text);
  border: none; padding: 0.4rem 0.5rem; border-radius: 4px;
}
.doc-name { display: block; font-weight: 600; word-break: break-all; }
.doc-meta { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.15rem; }
.doc-error { display: block; color: var(--error); font-size: 0.85rem; }

.detail-head { margin-bottom: 0.5rem; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.mock-note { background: var(--mock-bg); color: var(--mock-text); padding: 0.4rem 0.7rem; border-radius: 6px; font-size: 0.9rem; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.5fr); gap: 1rem; align-items: start; }
.pane { border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; min-width: 0; }
.pane-head { display: flex; justify-content: space-between; align-items: center; }
.preview-img { max-width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
.page-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
.chip { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.85rem; }
.chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.page-section { margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px dashed var(--line); }
.page-section.focus { outline: 3px solid var(--accent); outline-offset: 3px; }
.precision { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.md-text { white-space: pre-wrap; word-break: break-word; margin: 0.25rem 0; }
.md-heading { font-weight: 700; margin: 0.6rem 0 0.25rem; }
.md-h1 { font-size: 1.1rem; }
.md-h2 { font-size: 1.02rem; }
.md-raw { white-space: pre-wrap; word-break: break-word; background: var(--bg); padding: 0.5rem; border-radius: 6px; font-size: 0.85rem; }
.table-wrap { overflow-x: auto; margin: 0.4rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { border: 1px solid var(--line); padding: 0.25rem 0.4rem; text-align: left; vertical-align: top; }
th { background: var(--bg); }
.field-table td { padding: 0.15rem; }
.field-table input[type="text"] { min-width: 6rem; }
.field-table input[type="number"] { min-width: 3.5rem; }
.row-unknown { background: var(--warn-bg); }

.form-row { display: block; margin-bottom: 0.5rem; }
.form-label { display: block; font-size: 0.85rem; color: var(--muted); }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.warnings { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 0.4rem 0.7rem; margin: 0.5rem 0; }
.warnings ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }
.json-editor { margin-top: 0.75rem; }
.json-editor textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.82rem; }
#validation-box ul { margin: 0.2rem 0 0.5rem; padding-left: 1.2rem; }
.conflict { background: var(--error-bg); color: var(--error); border: 1px solid var(--error); border-radius: 6px; padding: 0.6rem 0.8rem; margin-bottom: 0.75rem; }

/* 검색 */
.search-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0; }
.search-form input[type="text"] { flex: 1 1 20rem; width: auto; }
.inline { display: inline-flex; gap: 0.4rem; align-items: center; }
.inline select { width: auto; }
.answer { border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; border: 2px solid var(--line); }
.answer-mock { border-color: #b88700; background: var(--warn-bg); }
.answer-live { border-color: var(--live-bg); }
.answer-text { white-space: pre-wrap; font-size: 1.05rem; }
.abstain { color: var(--muted); font-style: italic; }
.hits { padding-left: 1.4rem; }
.hit { margin-bottom: 0.75rem; }
.hit-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; }
.hit-text { white-space: pre-wrap; background: var(--bg); padding: 0.4rem 0.6rem; border-radius: 6px; margin: 0.3rem 0; }

#toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 20; max-width: min(32rem, calc(100vw - 2rem)); }
.toast { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; padding: 0.6rem 0.9rem; border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
.toast-info { background: var(--info-bg); color: var(--info); }
.toast-ok { background: var(--ok-bg); color: var(--ok); }
.toast-warn { background: var(--warn-bg); color: var(--warn); }
.toast-error { background: var(--error-bg); color: var(--error); border: 1px solid var(--error); }

@media (max-width: 1250px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .doc-list { max-height: 40vh; }
}

.correction-row td { border-top: none; padding: 0.1rem 0.4rem 0.5rem; }
.correction-row .inline { display: inline-flex; margin-right: 0.5rem; }
.correction-row input[type="text"] { width: min(32rem, 100%); }
.correction-row input[type="checkbox"] { width: auto; }

.progress-block { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.progress-text { font-size: 0.85rem; color: var(--muted); }
.detail-progress { margin: 0.4rem 0 0.75rem; }
.timings { margin: 0.25rem 0; }

.badge { white-space: nowrap; }
.doc-meta { flex-wrap: wrap; }

.coverage-panel { border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.7rem; margin: 0.6rem 0; }
.coverage-panel h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.coverage-summary.unevaluated { color: var(--muted); font-style: italic; }
.coverage-summary.has-missing { color: var(--warn); font-weight: 600; }
.coverage-list { list-style: none; margin: 0.3rem 0; padding: 0; }
.coverage-list li { padding: 0.3rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.coverage-quote { color: var(--muted); font-size: 0.85rem; white-space: pre-wrap; }

/* Review studio: generous type, a clear sequence and two readable comparison panes. */
:root { --bg:#f3f6fa; --panel:#fff; --text:#192c46; --muted:#607087; --line:#dce5ef; --accent:#235be0; --accent-text:#fff; --mock-bg:#fff3d5; --mock-text:#775316; }
html[data-font-size="17"] {font-size:17px}
html[data-font-size="19"] {font-size:19px}
html[data-font-size="21"] {font-size:21px}
body {line-height:1.65; letter-spacing:-.02em}
[hidden] {display:none !important}
a {color:var(--accent);text-underline-offset:4px}
button {min-height:46px;border-radius:10px;font-weight:650;transition:background .15s,box-shadow .15s}
button:not(:disabled):hover {box-shadow:0 3px 10px #234e8820;filter:brightness(.96)}
button.small {min-height:36px;font-size:.86rem}
input[type="password"] {font:inherit;width:100%;padding:.65rem .8rem;border:1px solid var(--line);border-radius:9px;background:var(--bg);color:var(--text)}
input[type="text"],input[type="number"],select,textarea {padding:.55rem .65rem;border-radius:8px;background:#fff}
input:disabled,select:disabled,textarea:disabled {background:#f1f4f8;color:#4b6076;opacity:1}
h1 {font-size:1.24rem;letter-spacing:-.045em} h2 {font-size:1.13rem} h3 {font-size:1.04rem}
h1 small {font-size:.76rem;display:block;margin:.12rem 0 0}
.mode-banner {position:relative;text-align:left;border:0;padding:.65rem max(1.5rem,calc((100vw - 1660px)/2));font-size:.84rem}
.banner-tag {font-size:.73rem;background:#ffffff65;display:inline-block;margin-top:.15rem;margin-left:.4rem}
.app-header {padding:1.1rem max(1.5rem,calc((100vw - 1660px)/2));gap:1.4rem}
.brand {display:flex;gap:.75rem;align-items:center}.brand-mark {width:2.5rem;height:2.5rem;display:grid;place-items:center;border-radius:13px;background:var(--accent);color:white;font-size:1.7rem;font-weight:800}
.eyebrow {font-size:.65rem;font-weight:750;letter-spacing:.11em;color:#57708f}.brand .eyebrow {font-size:.56rem}
.tabs {background:#edf2f9;padding:5px;border-radius:12px;gap:3px}.tabs button {border:0;background:transparent;padding:.45rem 1rem;font-size:.88rem}
.tabs button[aria-selected="true"] {background:#fff;color:var(--accent);box-shadow:0 2px 8px #173e6b12}
.font-control {display:flex;align-items:center;gap:.5rem;font-size:.76rem;color:var(--muted)}.font-control select {width:auto;font-size:.8rem}
main {max-width:1740px;padding:1.5rem 2rem 3rem}
.welcome {display:flex;align-items:center;justify-content:space-between;gap:2rem;margin:.4rem 0 1.5rem;padding:.6rem 0 1rem}
.welcome h2 {font-size:1.85rem;line-height:1.35;letter-spacing:-.06em;margin:.35rem 0 .6rem}.welcome p:not(.eyebrow) {font-size:.86rem;color:var(--muted)}
.welcome-actions {display:flex;flex-direction:column;align-items:flex-end;gap:.5rem;max-width:23rem}.welcome-actions a {font-size:.76rem}.welcome-actions button {background:#fff}
.test-steps {list-style:none;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem;margin:0 0 1.4rem;padding:0}
.test-steps li {display:flex;align-items:center;gap:.7rem;padding:.85rem 1rem;background:#eaf0f7;border-radius:12px;border:1px solid transparent}
.test-steps li>span {font-size:.78rem;font-weight:750;color:#7f92ac}.test-steps strong {display:block;font-size:.89rem}.test-steps small {display:block;font-size:.73rem;color:var(--muted)}
.test-steps li[aria-current="step"] {background:#fff;border-color:#b9cdfb;box-shadow:0 3px 10px #163c6b08}.test-steps li[aria-current="step"]>span {color:var(--accent)}
.panel {border-radius:15px;padding:1.2rem;box-shadow:0 3px 12px #15355904;margin-bottom:1.2rem}
.panel h2 {margin-bottom:1rem} .section-caption {display:block;font-size:.73rem;font-weight:400;color:var(--muted);margin-top:.25rem}
.intake-grid {display:grid;grid-template-columns:1.25fr 1fr;gap:1.2rem}.intake-grid .panel {margin:0 0 1.2rem}
#upload-title {color:#6e83a5;font-size:.8rem}#upload-title span {color:var(--text);font-size:1.12rem;margin-left:.3rem}
.dropzone {border-color:#cad8ec;background:#f8faff;padding:1rem;border-radius:11px}.dropzone p {font-size:.85rem}.dropzone .hint {font-size:.72rem}
.upload-symbol {width:2.2rem;height:2.2rem;margin:0 auto .4rem;background:#e8efff;border-radius:10px;color:var(--accent);font-size:1.6rem;font-weight:600}
#pick-files {margin:.6rem 0 .25rem;font-size:.84rem}.hint {font-size:.82rem}.meta,.form-label,.progress-text {font-size:.82rem}.badge {font-size:.72rem;padding:.2rem .6rem}
.counts {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.5rem}.count-chip {border-radius:10px;text-align:left;padding:.55rem .65rem;font-size:.73rem;min-height:56px;background:#f7f9fc}
.count-chip strong {display:block;font-size:1.35rem;line-height:1.35;font-weight:750}.count-chip.active {background:#edf3ff;color:var(--accent);border-color:#b4c9f8}
#progress-summary {margin-top:.9rem}.workspace {grid-template-columns:240px minmax(0,1fr);gap:1.2rem}
.list-panel {position:sticky;top:1rem;padding:1rem .7rem}.list-panel h2 {padding:0 .3rem;font-size:1rem}.document-count {display:inline-grid;place-items:center;min-width:1.4rem;border-radius:6px;background:#edf2f8;font-size:.7rem;color:var(--muted);margin-left:.35rem}
.doc-item {border:0;margin:.25rem 0;border-radius:10px;padding:.15rem}.doc-select {padding:.65rem .55rem}.doc-name {font-size:.81rem;font-weight:650}.doc-meta {gap:.25rem;margin-top:.4rem}
.doc-item.selected {background:#eff4ff;box-shadow:inset 3px 0 0 var(--accent)}.doc-list {max-height:72vh}
.detail-panel {padding:1.1rem}.detail-head h2 {font-size:1.15rem;overflow-wrap:anywhere}.mock-note {font-size:.78rem;padding:.6rem .8rem;background:#fff7e6}
.columns {grid-template-columns:minmax(0,.95fr) minmax(0,1.15fr);gap:1rem}.pane {padding:1rem;border-radius:11px;background:#fff}.preview-pane {background:#f5f7fa}.preview-img {display:block;margin:.8rem auto;box-shadow:0 3px 14px #142f4512;border-radius:4px}
.markdown-pane {grid-column:1/-1;order:3}.pane-head {gap:.5rem}.pane h3 {margin-bottom:.75rem}.report-pane {container-type:inline-size}.form-row {margin-bottom:.8rem}.form-label {margin-bottom:.25rem;font-weight:600;color:#526984}
.button-row #approve-button {width:100%;min-height:52px;margin-top:.3rem}.button-row {padding-top:.3rem}.empty {padding:2rem .75rem;text-align:center;font-size:.87rem}
.empty-illustration {width:3rem;height:3.5rem;border:2px solid #c5d4e8;border-radius:8px;margin:1.5rem auto .8rem;display:grid;place-items:center;color:#7f9bc0;font-size:1.6rem;background:#f8faff}
.empty-state {text-align:center;padding:2rem .75rem 3rem}.empty-state h2 {font-size:1.1rem}.empty-state p {font-size:.85rem;color:var(--muted)}
.preview-pdf {display:block;width:100%;height:720px;border:1px solid var(--line);border-radius:6px;background:white}
.source-inventory {margin:1rem 0;border:1px solid var(--line);border-radius:10px;padding:.8rem}.source-inventory summary {cursor:pointer;font-weight:700;color:var(--accent)}.source-inventory li {padding:.7rem 0;border-bottom:1px solid var(--line)}.source-item-text {white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:.9rem;margin:.5rem 0}.preview-pane {position:sticky;top:1rem;max-height:calc(100vh - 2rem);overflow:auto}
@media (max-width:1250px) {.preview-pane{position:static;max-height:none}}
.empty-title {font-size:1.1rem;font-weight:700;text-align:center}.empty-description {text-align:center;color:var(--muted);font-size:.85rem;margin:.5rem auto 1.8rem;max-width:28rem}
.connection-panel {display:grid;grid-template-columns:1fr 1.4fr;gap:1.4rem;border-color:#b6c9f2;background:#fbfcff}.connection-panel h2 {margin-bottom:.4rem}.connection-panel form {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.5rem}.connection-panel #pick-key {grid-column:2}.connection-panel #connect-message {grid-column:1/-1;overflow-wrap:anywhere}
.report-pane table {font-size:.87rem}.coverage-panel {background:#f9fbfe;padding:.8rem}.field-table {width:100%}.search-form input {min-height:50px}.answer {padding:1.2rem}
@container (max-width:680px) {
  .field-table,.field-table tbody {display:block}.field-table thead {display:none}.field-table tr:not(.correction-row) {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);padding:.65rem;border:1px solid var(--line);border-radius:10px 10px 0 0;margin-top:.9rem;background:#f8faff;gap:.45rem}
  .field-table tr.row-unknown {background:var(--warn-bg)}.field-table td {display:block;border:0;padding:0}.field-table td::before {content:attr(data-label);display:block;font-size:.73rem;color:var(--muted);margin-bottom:.2rem}.field-table td:nth-child(6) {grid-column:1/-1}.field-table td:last-child {grid-column:2;justify-self:end}
  .field-table input[type="text"],.field-table input[type="number"] {min-width:0;width:100%}.field-table .correction-row {display:block;padding:.7rem;background:#f8faff;border:1px solid var(--line);border-top:0;border-radius:0 0 10px 10px;margin-bottom:.9rem}.field-table .correction-row td::before {display:none}.correction-row .inline {font-size:.78rem}.correction-row input[type="text"] {margin-top:.4rem;font-size:.8rem}
}
@media (max-width:1250px) {.workspace{grid-template-columns:210px minmax(0,1fr)}.columns{grid-template-columns:minmax(0,1fr)}.markdown-pane{grid-column:auto}.preview-img{max-height:680px;width:auto}.welcome h2{font-size:1.6rem}}
@media (max-width:900px) {main{padding:1rem}.app-header{padding:1rem;gap:1rem}.intake-grid,.workspace,.connection-panel{grid-template-columns:minmax(0,1fr)}.list-panel{position:static}.doc-list{max-height:270px}.welcome{align-items:flex-start;gap:1rem}.welcome-actions{max-width:15rem}.test-steps{gap:.5rem}.test-steps li{padding:.6rem;gap:.4rem}.test-steps small{display:none}.brand-mark{display:none}.mode-banner{padding:.7rem 1rem}.font-control{margin-left:auto}}
@media (max-width:600px) {.welcome{display:block}.welcome-actions{align-items:flex-start;max-width:none;margin-top:1rem}.welcome h2{font-size:1.5rem}.test-steps strong{font-size:.72rem}.test-steps li>span{display:none}.tabs{width:100%;order:3}.tabs button{flex:1}.connection-panel form{grid-template-columns:1fr}.connection-panel #pick-key{grid-column:auto}.counts{grid-template-columns:repeat(3,minmax(0,1fr))}.count-chip{font-size:.64rem}.panel{padding:.9rem}.banner-tag{margin-left:0;margin-right:.3rem}}
.decision-review { width: 100%; padding: 1rem 1.2rem; border: 1px solid #b9cfe5; border-radius: 12px; background: #f1f7ff; }
.decision-review h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.decision-review ul { margin: .6rem 0 0; padding-left: 1.4rem; line-height: 1.8; }
:root .login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); }
.login-card form { display: grid; gap: 12px; margin: 24px 0; }
.login-card input { width: 100%; padding: 12px; }
.search-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.search-filters label { display: grid; gap: 4px; }
.search-filters .hint { flex-basis: 100%; }
.pattern-dialog { max-width: 760px; width: calc(100% - 40px); max-height: 85vh; overflow: auto; padding: 28px; border: 1px solid #c5d6df; border-radius: 16px; }
.pattern-dialog::backdrop { background: rgb(15 35 50 / 45%); }
.pdf-template-preview { width: 100%; height: 400px; }
.pdf-mapping-fields fieldset { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.pdf-mapping-fields label { display: grid; gap: 4px; width: 100px; }
.pdf-mapping-fields input { width: 100%; }

/* Provider layout is the primary review surface. */
.review-view-tabs {display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}
.review-view-tabs .active {background:var(--accent);color:white}
.document-type {font-weight:650;color:#31577c}
.review-columns {align-items:start;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr)}
.review-columns>.pane {min-width:0;max-height:80vh;overflow:auto;position:sticky;top:.5rem}
.review-columns>.markdown-pane {grid-column:auto;order:initial}
.provider-text {white-space:pre-wrap;overflow-wrap:anywhere;font-size:1rem;line-height:1.8}
.block-type {display:block;color:var(--muted);font-size:.75rem;margin:.5rem 0}
.recognition-block {margin:.5rem 0 .8rem}
.recognition-block h4 {margin:.3rem 0 .5rem}
.recognition-block>button {margin-top:.5rem}
.provider-table {border-collapse:collapse;table-layout:auto;min-width:100%;font-size:.95rem}
.provider-table td,.provider-table th {white-space:pre-wrap;overflow-wrap:anywhere;min-width:4rem;padding:.7rem;border:1px solid #bdccdb;vertical-align:top}
.provider-table th {background:#eef4fb}
.field-group {margin:1.5rem 0}.field-group h4 {padding:.5rem;background:#edf3fa}
.field-table textarea {min-width:0;width:100%;min-height:5rem;resize:vertical;white-space:pre-wrap;line-height:1.6;font-size:.94rem}
.field-table td:nth-child(6) {max-width:none}.typed-value {white-space:pre-wrap;overflow-wrap:anywhere}
.supplement-fields {padding:1rem;border:1px solid var(--line);margin:1rem 0}.supplement-fields summary {cursor:pointer;font-weight:650}
.original-dialog {width:94vw;max-width:1700px;max-height:94vh;overflow:auto;border:1px solid var(--line);border-radius:12px}
.original-dialog .preview-img {max-width:none;width:100%;max-height:none;object-fit:contain}
.original-dialog::backdrop {background:#152944b3}
.recognized-image {margin:.5rem 0;max-width:100%}.recognized-image img {max-width:100%;width:auto;height:auto;max-height:420px;object-fit:contain}
@media(min-width:1600px){main{max-width:none}.workspace{grid-template-columns:210px minmax(0,1fr)}}
@media(max-width:1050px){.review-columns{grid-template-columns:minmax(0,1fr)}.review-columns>.pane{position:static;max-height:75vh}}

/* CMS 디자인 규칙 적용: DOC 검토 화면에 대응되는 공통 토큰과 컨트롤 */
:root {
  --bg: #f8f9fb;
  --panel: #ffffff;
  --text: #1f232b;
  --muted: #5a6272;
  --line: #e1e3e8;
  --control-border: #e6e7ea;
  --accent: #1d4ed8;
  --accent-hover: #1a44bc;
  --accent-soft: #e8eefd;
  --accent-border: #c5d3f7;
  --hover: #f2f4f6;
  --readonly: #f6f7f9;
  --row-line: #eef0f3;
  --placeholder: #8b95a1;
  --radius-control: 8px;
  --radius-card: 12px;
  --focus-ring: 0 0 0 3px #e8eefd;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --ok: #14532d;
  --ok-bg: #dcfce7;
}

body { color: var(--text); background: var(--bg); }
.mode-banner { position: relative; border-bottom: 1px solid var(--line); }
.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgb(255 255 255 / 96%);
  border-bottom: 1px solid var(--line);
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: none;
}
button, input[type="password"], input[type="text"], input[type="number"],
select, textarea {
  border-radius: var(--radius-control);
}
button {
  min-height: 36px;
  padding: 0 14px;
  border-color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
button:not(:disabled):hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  filter: none;
  box-shadow: none;
}
button.secondary {
  color: var(--accent);
  background: #fff;
  border-color: var(--control-border);
}
button.secondary:not(:disabled):hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
input[type="password"], input[type="text"], input[type="number"], select,
textarea {
  min-height: 36px;
  border-color: var(--control-border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:disabled, select:disabled, textarea:disabled {
  background: var(--readonly);
  color: var(--placeholder);
}
.tabs, .review-view-tabs {
  background: #f1f3f6;
  border-radius: var(--radius-control);
}
.tabs button, .review-view-tabs button {
  min-height: 36px;
  border-radius: var(--radius-control);
}
.tabs button[aria-selected="true"], .review-view-tabs button.active {
  color: var(--accent);
  background: #fff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgb(31 35 43 / 8%);
}
.dropzone {
  border-color: var(--accent-border);
  border-radius: 10px;
  background: #f9fafb;
}
.dropzone.drag-over { background: var(--accent-soft); border-color: var(--accent); }
.count-chip, .chip {
  border-color: var(--control-border);
  border-radius: 999px;
}
.count-chip.active, .chip.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.badge-ok { color: var(--ok); background: var(--ok-bg); border: 1px solid #86efac; }
.badge-error { color: var(--error); background: var(--error-bg); }
.doc-item.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.doc-select:not(:disabled):hover { background: var(--hover); }
.pane, .coverage-panel, .source-inventory, .supplement-fields {
  border-color: var(--line);
  border-radius: var(--radius-card);
}
.preview-pane { background: #f7f8fa; }
.detail-actions {
  border-color: var(--accent-border);
  box-shadow: 0 8px 24px rgb(31 35 43 / 14%), 0 2px 6px rgb(31 35 43 / 8%);
}
.detail-actions #approve-button { min-height: 36px; }
table th { background: #f7f8fa; }
th, td { border-color: var(--row-line); }

@media (max-width: 767px) {
  button, input[type="password"], input[type="text"], input[type="number"],
  select, textarea { min-height: 44px; }
  .tabs button, .review-view-tabs button { min-height: 44px; }
}

/* 진행 상황 카드: 테스트 단계 박스와 같은 직사각형 컴포넌트로 통일 */
.intake-grid { align-items: start; }
.intake-grid > .panel { height: fit-content; }
.counts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.count-chip {
  min-height: 70px;
  padding: 10px 14px;
  border: 1px solid var(--control-border);
  border-radius: 12px;
  background: #f7f8fa;
  color: var(--text);
  text-align: left;
}
.count-chip.active {
  color: var(--accent);
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.count-chip strong {
  display: block;
  margin-top: 2px;
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 700;
}

/* 표 안의 짧은 액션은 셀 폭이 좁아도 글자 단위로 줄바꿈하지 않는다. */
.field-table td:last-child {
  width: 1%;
  min-width: 60px;
  white-space: nowrap;
  text-align: center;
}
.field-table td:last-child button {
  min-width: 56px;
  padding-inline: 10px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 검토 화면 정리: 액션 위치와 반응형 기준을 한 곳에서 고정한다. */
.detail-actions {
  position: sticky;
  bottom: .75rem;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: .75rem 1rem;
  background: rgb(255 255 255 / 96%);
  border: 1px solid #b9cdef;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(23 62 107 / 14%);
}
.detail-actions-copy { display: grid; gap: .15rem; min-width: 0; }
.detail-actions .button-row { margin: 0; padding: 0; flex: 0 0 auto; }
.detail-actions #approve-button { width: auto; min-width: 10rem; min-height: 36px; margin: 0; }
.review-view-tabs { padding: .25rem; background: #edf2f9; border-radius: 10px; }
.review-view-tabs button { min-height: 42px; border: 0; }
.review-view-tabs button.active { box-shadow: 0 2px 8px rgb(23 62 107 / 14%); }
.review-columns { grid-template-columns: minmax(18rem, .9fr) minmax(0, 1.1fr); }
.review-columns > .pane { min-height: 18rem; }
.preview-pane, .report-pane, .recognition-pane, .markdown-pane { scroll-margin-top: 1rem; }
.report-pane #validation-box { margin-top: 1rem; }
[data-testid="upload-panel"], [data-testid="status-panel"] { min-width: 0; }

@media (max-width: 1100px) {
  main { padding-inline: 1.25rem; }
  .app-header { padding-inline: 1.25rem; }
  .review-columns { grid-template-columns: minmax(0, 1fr); }
  .review-columns > .pane { position: static; max-height: none; }
  .preview-pane { order: 0; }
  .recognition-pane, .report-pane, .markdown-pane { order: 1; }
}

@media (max-width: 700px) {
  main { padding: 1rem .75rem 5rem; }
  .app-header { padding: .85rem .75rem; }
  .app-header .brand { flex: 1 1 100%; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1; }
  .welcome h2 { font-size: 1.45rem; }
  .test-steps { grid-template-columns: 1fr; }
  .test-steps li { min-height: 3.2rem; }
  .intake-grid { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .list-panel { position: static; }
  .doc-list { max-height: 18rem; }
  .detail-actions { align-items: stretch; flex-direction: column; bottom: .5rem; }
  .detail-actions .button-row { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .detail-actions #approve-button { min-width: 0; }
  .review-view-tabs { display: grid; grid-template-columns: 1fr; }
  .review-view-tabs button { width: 100%; }
  .search-form, .search-filters { align-items: stretch; flex-direction: column; }
  .search-form input[type="text"], .search-form button, .inline, .inline select { width: 100%; }
}
