:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1e2a36;
  --muted: #6b7785;
  --line: #dde3ea;
  --accent: #1f5e8c;
  --accent-soft: #e6eff6;
  --saved: #eaf4ec;
  --saved-ink: #2e6b45;
  --warn: #fff4e0;
  --warn-ink: #8a5a00;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px 28px 48px; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }
small { font-weight: 400; color: var(--muted); font-size: .8em; margin-left: 6px; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 20px; padding: 10px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); white-space: nowrap; }
.topsearch { flex: 1; max-width: 420px; }
.topsearch input { width: 100%; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; }
.topbar nav a { padding: 6px 12px; border-radius: 6px; color: var(--ink); }
.topbar nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.home .topsearch { visibility: hidden; }

/* home */
.hero { max-width: 760px; margin: 14vh auto 0; }
.hero h1 { font-size: 40px; letter-spacing: -0.02em; margin: 0 0 28px; }
.bigsearch { display: flex; border: 2px solid var(--ink); border-radius: 10px; background: var(--surface); overflow: hidden; }
.bigsearch input { flex: 1; border: 0; font-size: 18px; padding: 16px 18px; border-radius: 0; }
.bigsearch input:focus-visible { outline: none; }
.bigsearch:focus-within { border-color: var(--accent); }
.hero .opt { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 14px; cursor: pointer; }
.pagehead .seg { margin-top: 10px; }
.toolrow { display: flex; flex-wrap: wrap; gap: 10px; }
.bigsearch button { border-radius: 0; padding: 0 28px; font-size: 16px; }

/* controls */
input, select, textarea {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px;
}
textarea { width: 100%; resize: vertical; line-height: 1.6; }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-block;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  border-radius: 6px; padding: 7px 16px; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button.danger { background: #a23b2c; border-color: #a23b2c; }
.editor .lbl a { margin-left: 8px; font-size: 13px; }
.btn.ghost { background: var(--surface); color: var(--accent); border-color: var(--line); }

/* page parts */
.pagehead { margin-bottom: 18px; }
.pagehead h1 { font-size: 24px; margin: 2px 0 4px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0; }
.back { font-size: 14px; }
.field { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.flash { padding: 10px 14px; border-radius: 6px; background: var(--saved); color: var(--saved-ink); margin: 0 0 16px; }
.flash.warn { background: var(--warn); color: var(--warn-ink); }
.empty-block { background: var(--surface); border: 1px dashed var(--line); padding: 32px; border-radius: 8px; color: var(--muted); }

.actionbar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 8px 0; background: var(--bg); }

.topic-block { margin-bottom: 28px; }
.topic-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 8px; }
.topic-head h2 { font-size: 18px; margin: 0; }
.matched { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 16px; color: var(--ink); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--ink); color: #fff; }
.seg a:hover { text-decoration: none; background: var(--accent-soft); }
.seg a.on:hover { background: var(--ink); }

.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 3px; }
.filters select { min-width: 160px; max-width: 320px; }
.filters .push { margin-left: auto; }
.filters .searchrow { display: flex; gap: 10px 14px; flex-basis: 100%; }
.filters .grow { flex: 1; }
.filters input[type=search] { min-width: 240px; }
.chips-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 12px; }
.chips-label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.fchip { font-size: 13px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.fchip b { font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 2px; }
.fchip:hover { text-decoration: none; border-color: var(--accent); }
.fchip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.grid th.ft, .grid td.ft { min-width: 150px; max-width: 240px; }
.st { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.st-done { background: var(--saved); color: var(--saved-ink); }
.st-pending { background: var(--accent-soft); color: var(--accent); }
.st-download, .st-extract { background: var(--warn); color: var(--warn-ink); }
.st-nopdf { background: var(--line); color: var(--muted); }
.st-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-word; }

/* tables */
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; background: #f9fafb;
  border-bottom: 1px solid var(--line); padding: 8px 10px; white-space: nowrap; }
.grid td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: #fafcfe; }
.grid .wide { min-width: 320px; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .chk { width: 36px; text-align: center; }
.grid .doi { white-space: nowrap; font-size: 13px; }
.grid .empty { text-align: center; color: var(--muted); padding: 28px; }
.grid tr.is-saved td { background: var(--saved); }
.title-link { color: var(--ink); font-weight: 500; }
.tag { display: inline-block; font-size: 12px; padding: 0 7px; border-radius: 10px; background: var(--saved-ink); color: #fff; margin-left: 4px; }
.tag.muted { background: var(--line); color: var(--ink); }
.grid.stats tr.pstart td { border-top: 2px solid var(--line); }

.pager { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }
.pager a, .pager span { min-width: 34px; text-align: center; padding: 5px 8px; border-radius: 6px; }
.pager .cur { background: var(--ink); color: #fff; font-weight: 600; }

/* detail */
.doc-title { max-width: 60em; }
.chips { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--accent-soft); color: var(--accent); border-radius: 12px; padding: 2px 10px; font-size: 13px; }
.chip.kw { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.editor fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px 18px; margin: 0 0 14px; }
.editor legend { font-weight: 700; padding: 0 6px; }
.editor label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.editor input, .editor textarea { color: var(--ink); font-size: 15px; }
.fetch-note { font-size: 13px; color: var(--muted); margin: 6px 0 0; word-break: break-all; }
.fetch-note.warn { color: var(--warn-ink); background: var(--warn); padding: 6px 10px; border-radius: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid2 .span2 { grid-column: span 2; }

.history { margin-top: 28px; }
.history h2 { font-size: 18px; }
.history details { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.history summary { cursor: pointer; padding: 10px 14px; }
.history .hid { font-weight: 600; }
.history dl { display: grid; grid-template-columns: 110px 1fr; margin: 0; padding: 4px 14px 14px; gap: 6px 14px; }
.history dt { color: var(--muted); font-size: 13px; }
.history dd { margin: 0; word-break: break-word; }
.history dd.changed { background: var(--warn); border-radius: 4px; padding: 0 6px; }
.history pre { white-space: pre-wrap; font: inherit; margin: 0; max-height: 280px; overflow: auto; }

/* stats */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 18px; color: var(--muted); font-weight: 600; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.statblock { margin-bottom: 30px; }
.statblock h2 { font-size: 18px; margin: 0 0 2px; }
.statblock > p { margin: 0 0 10px; }
.totals { display: flex; gap: 12px; margin-bottom: 12px; }
.totals div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 18px; }
.totals b { font-size: 22px; display: block; font-variant-numeric: tabular-nums; }
.totals span { color: var(--muted); font-size: 13px; }

@media (max-width: 720px) {
  main { padding: 16px; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; }
  .topsearch { order: 3; max-width: none; flex-basis: 100%; }
  .grid2 { grid-template-columns: 1fr; }
  .grid2 .span2 { grid-column: auto; }
  .hero h1 { font-size: 28px; }
  .filters .push { margin-left: 0; }
  .filters .searchrow { flex-wrap: wrap; }
  .filters .searchrow label { flex-basis: 100%; }
  .filters input[type=search] { min-width: 0; width: 100%; }
}

/* 평가 결과 */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.tile b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; margin: 2px 0; }
.t-label { font-size: 13px; color: var(--muted); }
.t-sub { display: block; font-size: 12.5px; color: var(--muted); }
.evblock { margin-bottom: 24px; }
.evblock h2 { font-size: 18px; margin: 0 0 2px; }
.evblock > p { margin: 0 0 10px; }
.grid.areas tr.dom td { background: #f9fafb; font-weight: 700; font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.grid.areas tr.dom a { color: var(--ink); }
.grid.areas tr.on td { background: var(--accent-soft); }
.grid.areas td a { color: var(--ink); }
.barcol { min-width: 240px; white-space: nowrap; }
.bar { display: inline-block; vertical-align: middle; width: calc(100% - 44px); height: 12px; }
.bar .fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar .fill.nz { min-width: 3px; }
.barval { display: inline-block; width: 36px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.crit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 6px; }
.c-item { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.c-item b { font-size: 22px; font-variant-numeric: tabular-nums; }
.c-meter { display: block; height: 6px; background: var(--line); border-radius: 3px; margin: 4px 0 6px; overflow: hidden; }
.c-meter span { display: block; height: 100%; background: var(--accent); }
.gb { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.g-good { background: var(--saved); color: var(--saved-ink); }
.g-partial { background: var(--warn); color: var(--warn-ink); }
.g-poor, .g-error { background: #fbe9e7; color: #a23b2c; }
.evlist td { vertical-align: top; }
.evlist .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.evlist details { margin-top: 6px; font-size: 13.5px; }
.evlist summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.evlist dl { display: grid; grid-template-columns: 76px 1fr; gap: 4px 12px; margin: 8px 0 2px; }
.evlist dt { color: var(--muted); font-size: 12.5px; }
.evlist dd { margin: 0; }
.evlist dd ol { margin: 0; padding-left: 18px; }
.evlist .err { color: #a23b2c; margin: 6px 0; }
.evlist pre.raw { white-space: pre-wrap; font-size: 12px; background: #f9fafb; padding: 8px; border-radius: 6px; max-height: 220px; overflow: auto; }
.cls { min-width: 170px; }
.cls .dom-l { display: block; font-size: 12px; color: var(--muted); }
.cls .area { display: block; font-weight: 600; }
.conf { font-size: 12.5px; color: var(--muted); }
.conf.low { color: var(--warn-ink); background: var(--warn); padding: 0 6px; border-radius: 4px; }
.cot { min-width: 150px; }
.cot .score { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: 4px; }
.cot .subs { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.rev { min-width: 230px; }
.rev form { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rev select { max-width: 200px; font-size: 13px; padding: 4px 6px; }
.rev input[type=text] { flex: 1; min-width: 90px; font-size: 13px; padding: 4px 6px; }
.small-btn { padding: 4px 10px; font-size: 13px; }
.rv { font-size: 12px; font-weight: 600; }
.rv.ok { color: var(--saved-ink); }
.rv.ng { color: #a23b2c; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
@media (max-width: 900px) {
  .tiles, .crit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 상세 화면: CoT 라벨링 · PDF 파일 */
.side-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 18px 16px; }
.panel h2 { font-size: 15px; margin: 0 0 6px; }
.panel-status { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.panel-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.panel-form label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); width: 100%; }
.panel-form label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
.panel-form input[type=text] { width: 100%; }
.panel-form input[type=file] { font-size: 13.5px; max-width: 100%; }
.panel-form button:disabled { opacity: .6; cursor: progress; }
.lb { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--line); color: var(--muted); white-space: nowrap; }
.lb-on { background: var(--accent-soft); color: var(--accent); }
.pagehead .sub .lb { margin-left: 6px; vertical-align: 1px; }
@media (max-width: 720px) { .side-panels { grid-template-columns: 1fr; } }
