/* 디자인 토큰: Linear 스타일 무채색, 포인트색은 보라(#5E6AD2) 하나 */
:root {
  --bg: #f4f4f5;
  --panel: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #71717a;
  --subtle: #a1a1aa;
  --accent: #5e6ad2;          /* "확인 필요"에만 쓰는 포인트색 */
  --accent-soft: #eef0fb;
  --red: #d2555e;             /* 채점 화면의 "다시 확인"에만 쓰는 색 (2026-12-04 선생 결정) */
  --red-soft: #fbedee;
  --radius: 8px;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-question: 'Noto Serif', 'Times New Roman', Times, serif;
  --font-display: 'Bricolage Grotesque', 'Inter', sans-serif;
  --touch: 44px;              /* iPad 터치 대상 최소 크기 */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
h1, h2, .display, .score { font-family: var(--font-display); letter-spacing: -0.02em; }
h1 { font-size: 28px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
a { color: inherit; }
.muted { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.btn { min-height: var(--touch); padding: 0 16px; border-radius: 6px; border: 1px solid var(--border);
       background: var(--panel); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { background: #fafafa; }
.btn.primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
input, select { min-height: var(--touch); padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
         background: #f4f4f5; color: var(--muted); border: 1px solid var(--border); }
.badge.attention { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.error { color: #b91c1c; font-size: 14px; }

/* 앱 레이아웃: 왼쪽 사이드바 */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.sidebar { border-right: 1px solid var(--border); padding: 20px 12px; background: var(--bg); }
.sidebar .brand { font-family: var(--font-display); font-weight: 700; font-size: 17px; padding: 0 8px 16px; }
.sidebar a { display: block; padding: 8px; border-radius: 6px; text-decoration: none; color: var(--muted); }
.sidebar a.active, .sidebar a:hover { background: #e9e9eb; color: var(--text); }
.main { padding: 32px; max-width: 1100px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.score { font-size: 40px; font-weight: 700; line-height: 1; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 500; }

/* 로그인 */
.center { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 360px; display: grid; gap: 12px; }

/* 시험 화면 스타일은 css/exam.css */
.watermark { position: fixed; inset: 0; pointer-events: none; display: grid; place-items: center;
        font-size: 64px; color: rgba(0,0,0,.035); transform: rotate(-24deg); user-select: none; z-index: 5; }
.figure img { max-width: 100%; }
@media print { body { display: none; } }

/* 문제 텍스트 (richText): 문단·목록 간격, 보기 안의 표와 그림 */
.opt-body p, .opt-body ul { margin: 0; }
.opt-body .figure { margin-top: 6px; }
.pane p { margin: 0 0 12px; }
.part { margin: 16px 0; }
.part > strong { display: block; margin-bottom: 4px; }
.figure { margin: 8px 0 16px; }
.expl { margin: 8px 0; }

/* 선생 포털: 문제은행 검수·가져오기 */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.review { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.review .meta dt { color: var(--muted); font-size: 13px; margin-top: 8px; }
.review .meta dd { margin: 0; }
.choice-row { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.choice-row.correct { border-color: var(--text); box-shadow: inset 3px 0 0 var(--text); }
.choice-row p { display: inline; margin: 0; }
.rubric { background: #fafafa; border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.rubric li p { display: inline; margin: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafafa; }

/* 문제 검수: 그림 다시 그리기 요청 */
.redraw { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 16px; font-size: 13px; }
.redraw .btn { min-height: 32px; padding: 0 12px; font-size: 13px; }

/* 그림 다시 그리기 창: 왼쪽 원본, 오른쪽 AI 후보들 */
.redraw-dialog { width: min(1200px, 96vw); max-height: 92vh; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.redraw-dialog::backdrop { background: rgba(24, 24, 27, .4); }
.redraw-dialog .rd-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.redraw-dialog .rd-head h2 { margin: 0; }
.redraw-dialog .rd-body { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 20px; padding: 20px; }
.redraw-dialog .rd-orig { display: flex; flex-direction: column; gap: 8px; }
.redraw-dialog .rd-orig img { max-width: 100%; border: 1px solid var(--border); border-radius: 6px; }
.redraw-dialog textarea { font: inherit; padding: 8px; border: 1px solid var(--border); border-radius: 6px; resize: vertical; }
.redraw-dialog .rd-cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-content: start; }
.redraw-dialog .rd-cands > p { grid-column: 1 / -1; margin: 0; }
.redraw-dialog .cand { border: 1px solid var(--border); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.redraw-dialog .cand img { width: 100%; background: #fff; }
.redraw-dialog .cand.pending { min-height: 200px; align-items: center; justify-content: center; background: #fafafa; }
.redraw-dialog .cand-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.redraw-dialog #rd-status { padding: 0 20px 16px; margin: 0; }

/* ---------- 채점 (선생) ---------- */
.main.wide { max-width: 1480px; }
.grade-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.grade-scores { display: flex; gap: 32px; }
.grade-scores .score small { font-size: 18px; color: var(--muted); font-weight: 600; }
.gq { margin-bottom: 16px; }
.gq-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.gq-head .badge { margin-top: 6px; }
.gq-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.gq-pages { display: flex; flex-direction: column; gap: 12px; }
.gq-pages details { display: flex; flex-direction: column; gap: 8px; }
.gq-pages details summary { cursor: pointer; padding: 4px 0; }
.pg { display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: zoom-in; position: relative; overflow: hidden; }
.pg img { display: block; width: 100%; }
.pg span { position: absolute; top: 6px; left: 6px; background: rgba(255,255,255,.9); border: 1px solid var(--border); border-radius: 4px; font-size: 12px; padding: 0 6px; }
.gpart { margin-bottom: 16px; }
.gpart-head { padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.gitem { padding: 12px 0; font-size: 14px; }
.gitem + .gitem { border-top: 1px solid var(--border); }
.gitem.flag { background: var(--red-soft); box-shadow: inset 3px 0 0 var(--red); border-radius: 6px; padding: 12px 12px 12px 14px; margin: 6px 0; border-top-color: transparent; }
.gitem p { margin: 0 0 4px; }
.gi-reason { color: var(--red); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.gi-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.gi-cols.one { grid-template-columns: 1fr; }
.gi-lbl { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.gi-rubric { background: #f4f4f5; border-radius: 6px; padding: 8px 10px; color: #3f3f46; }
.gi-student { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; background: #fff; }
.gitem.flag .gi-student { border-color: var(--red); }
.gi-hand { font-family: var(--font-question); font-size: 16px; }
.gi-why { margin-top: 8px; font-size: 13px; }
.gi-why summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.gi-seg { display: flex; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.gi-seg button { flex: 1; height: 44px; border: 0; background: #fff; font: 600 15px var(--font-body); color: #3f3f46; cursor: pointer; }
.gi-seg button + button { border-left: 1px solid var(--border); }
.gi-seg button:hover { background: #fafafa; }
.gi-seg button.on { background: var(--text); color: #fff; }
.gitem textarea { display: block; width: 100%; min-height: 56px; margin-top: 8px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font: 14px var(--font-body); resize: vertical; background: #fff; }
.gq-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.gnote { font-size: 14px; background: #fafafa; border-radius: 6px; padding: 6px 10px; margin: 0 0 12px; }
.qtext { position: relative; }
.qtext summary { list-style: none; display: inline-flex; align-items: center; }
.qtext summary::-webkit-details-marker { display: none; }
.qtext .pane { position: absolute; right: 0; top: 48px; z-index: 5; width: min(640px, 80vw); max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.08); font-family: var(--font-question); }
.page-dialog { width: min(1000px, 96vw); max-height: 94vh; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.page-dialog::backdrop { background: rgba(24, 24, 27, .5); }
.page-dialog .pd-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.page-dialog img { display: block; width: 100%; }
@media (max-width: 1000px) { .gq-body { grid-template-columns: 1fr; } .gi-cols { grid-template-columns: 1fr; } }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 0 0 16px; background: var(--panel); }
.toolbar .seg { margin: 0; }
.seg a { padding: 7px 14px; font-size: 14px; color: var(--muted); text-decoration: none; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.crumbs { margin: 0 0 8px; font-size: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.gblock { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; padding: 12px 0; }
.gblock + .gblock { border-top: 1px solid var(--border); }
.gblock-pages { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 8px; }
.gblock-pages .pg img { width: auto; max-width: 100%; max-height: calc(100vh - 32px); margin: 0 auto; }
@media (max-width: 1000px) { .gblock { grid-template-columns: 1fr; } .gblock-pages { position: static; } }

/* ---------- 결과 (학생) ---------- */
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.res-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.res-head h1 { margin: 0; }
.res-scores { display: grid; grid-template-columns: 1fr 1fr; padding: 0; }
.res-scores > div { padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.res-scores > div + div { border-left: 1px solid var(--border); }
.res-scores .score small, .q-result small { font: 400 16px var(--font-body); color: var(--muted); letter-spacing: 0; }
.res-locks { margin-top: 16px; padding: 0; }
.lock-row { display: flex; align-items: center; gap: 10px; padding: 14px 20px; color: var(--text); }
.lock-row svg { color: var(--muted); flex: none; }
.lock-row > span:nth-child(2) { flex: 1; }
.lock-row .muted { font-size: 14px; }
.lock-row + .lock-row { border-top: 1px solid var(--border); }
.q-side .lock-row { padding: 12px 0 0; }
.res-sec { margin-top: 16px; }
.res-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.res-sec-head h2 { margin: 0; }
.res-sec-head .muted { font-size: 14px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.qtile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 56px; border-radius: 8px;
         border: 1px solid var(--border); background: #fafafa; text-decoration: none; font-variant-numeric: tabular-nums; }
.qtile b { font-weight: 600; font-size: 15px; }
.qtile span { font-size: 12px; color: var(--muted); }
.qtile.wrong { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.qtile.wrong span { color: var(--accent); }
.qtile.blank { background: #fff; border-style: dashed; }
.qtile.blank span { visibility: hidden; }
.qtile:hover { border-color: var(--text); }
.frq-row { display: block; padding: 14px 0; text-decoration: none; border-top: 1px solid var(--border); }
.frq-row:first-of-type { border-top: 0; padding-top: 0; }
.frq-row-head { display: flex; justify-content: space-between; align-items: baseline; }
.frq-pts { font-family: var(--font-display); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.frq-parts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.frq-cmt { margin-top: 8px; font-size: 14px; background: #fafafa; border-radius: 6px; padding: 8px 10px; }
.frq-cmt p { margin: 0; }
.frq-cmt p + p { margin-top: 4px; }
.topic-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 44px; align-items: center; gap: 12px; padding: 8px 0; font-size: 14px; }
.topic-row + .topic-row { border-top: 1px solid var(--border); }
.topic-bar { height: 8px; border-radius: 999px; background: #ececee; overflow: hidden; }
.topic-bar span { display: block; height: 100%; background: var(--text); border-radius: 999px; }
.topic-n { text-align: right; font-variant-numeric: tabular-nums; }
.qnav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.q-review { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.q-text { font-family: var(--font-question); font-size: 16px; line-height: 1.6; }
.q-text h2 { font-family: var(--font-display); }
.q-text p { margin: 0 0 12px; }
.q-stim { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.q-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.q-choice { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.q-choice p { margin: 0; }
.q-letter { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--text); display: grid; place-items: center; font: 600 14px var(--font-body); }
.q-choice.mine .q-letter { background: var(--text); color: #fff; }
.q-choice.right { border-color: var(--text); box-shadow: inset 3px 0 0 var(--text); }
.q-choice.wrong { border-color: var(--accent); background: var(--accent-soft); }
.q-choice.wrong .q-letter { background: var(--accent); border-color: var(--accent); }
.q-tag { grid-column: 2; font: 600 12px var(--font-body); color: var(--muted); }
.q-choice.wrong .q-tag { color: var(--accent); }
.q-side { position: sticky; top: 16px; }
.q-result { font-family: var(--font-display); font-weight: 700; font-size: 24px; margin-bottom: 8px; }
.q-result.wrong { color: var(--accent); }
.q-part { padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.q-part-head { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.q-cmt { margin: 6px 0 0; background: #fafafa; border-radius: 6px; padding: 6px 10px; }
.q-rubric { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.q-rubric li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; color: #3f3f46; }
.q-rubric li p { margin: 0; }
.q-rb-pts { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.q-expl { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 15px; }
.q-expl p { margin: 0 0 8px; }
.figure img { display: block; width: 100%; }
@media (max-width: 900px) { .q-review { grid-template-columns: 1fr; } .q-side { position: static; } }

/* ---------- 결과 공개 (선생) ---------- */
.release { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding: 12px 14px; background: #fafafa; border: 1px solid var(--border); border-radius: 8px; }
.release-label { font-weight: 600; }
.stages { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.stages button { min-height: 40px; padding: 0 14px; border: 0; background: #fff; font: 500 14px var(--font-body); color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.stages button + button { border-left: 1px solid var(--border); }
.stages button:hover { background: #f4f4f5; color: var(--text); }
.stages button.on { background: var(--text); color: #fff; }
.stages button.done { color: var(--text); }
.stages .n { font-size: 12px; opacity: .7; }
.release-note { font-size: 13px; color: var(--muted); flex: 1; min-width: 220px; }
.grade-state { font-size: 13px; }
.grade-state.todo { color: var(--accent); font-weight: 500; }
td select.small { min-height: 34px; font-size: 13px; padding: 0 8px; }
.res-scores { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.res-ap { background: #fafafa; border-radius: 0 var(--radius) var(--radius) 0; }
.heat-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.heat-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 6px; }
.heat-unit { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 10px 0; align-items: start; }
.heat-unit + .heat-unit { border-top: 1px solid var(--border); }
.heat-unit-name { display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; padding-top: 4px; }
.heat-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.heat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 6px; padding: 8px 10px; border-radius: 6px; font-size: 13px; line-height: 1.3; min-height: 56px; }
.heat-code { font-weight: 600; }
.heat-title { grid-column: 1 / -1; grid-row: 2; opacity: .85; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.heat-pct { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.h4 { background: #27272a; color: #fff; }
.h3 { background: #71717a; color: #fff; }
.h2 { background: #e4e4e7; color: var(--text); }
.h1 { background: var(--red-soft); color: #b4434b; box-shadow: inset 0 0 0 1px var(--red); }   /* 50% 미만: 다시 볼 토픽 (2026-12-04 선생 결정, C안) */
@media (max-width: 700px) { .heat-unit { grid-template-columns: 1fr; } }

/* 왼쪽 위 과목 고르기 */
.course-pick { width: 100%; margin: 0 0 12px; min-height: 36px; font-size: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

/* 시험 조립 화면 */
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.nowrap { white-space: nowrap; }
.builder-setup { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.builder-setup > label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.builder-students { width: 100%; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.builder-students > div { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; font-weight: 400; font-size: 14px; cursor: pointer; }
.chip input { min-height: 0; margin: 0; }
.builder-warn { margin-top: 16px; border-color: var(--accent); background: var(--accent-soft); color: #3b4199; font-size: 14px; }
.builder-warn ul { margin: 0; padding-left: 18px; }
.builder-units td, .builder-list td { vertical-align: top; }
.builder-list tr:has(+ tr.grouped) td { border-bottom-style: dashed; }
.builder-q { max-width: 420px; font-size: 13px; color: #3f3f46; }
.builder-save { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; margin-top: 16px; }

/* 문제은행 목록 (2026-12-05): Notion식 필터 칩 + College Board 문제은행식 표 */
.bank-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bank-head h1 { margin: 0; }
.btn.sm .badge { margin-left: 4px; }
.fchips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.fchip-wrap { position: relative; }
.fchip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); font: 500 13px var(--font-body); color: var(--muted); cursor: pointer; }
.fchip:hover { background: #fafafa; color: var(--text); }
.fchip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.fchip .car { font-size: 10px; margin-left: 2px; }
.linkbtn { border: 0; background: none; font: 13px var(--font-body); color: var(--muted); cursor: pointer; padding: 4px 6px; }
.linkbtn:hover { color: var(--text); }
.pop { position: absolute; top: 36px; left: 0; z-index: 20; min-width: 220px; max-height: 420px; overflow: auto; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 4px; }
.pop.wide { width: 380px; }
.pop .opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; background: none; border-radius: 6px;
  font: 13px var(--font-body); color: var(--text); text-align: left; cursor: pointer; }
.pop .opt > span:first-of-type { flex: 1; }
.pop .opt:hover { background: #f4f4f5; }
.pop .opt.on { color: var(--accent); font-weight: 600; }
.pop .opt input { min-height: 0; margin: 0; accent-color: var(--accent); }
.pop-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; font-size: 12px; }
.pop-sec { padding: 8px 8px 2px; font-size: 11px; font-weight: 600; color: var(--subtle); text-transform: uppercase; letter-spacing: .04em; }
.bank-count { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.panel.flush { padding: 0; overflow: hidden; }
.qtable th { background: #fafafa; font-size: 12px; padding: 10px 16px; white-space: nowrap; }
.qtable td { padding: 0 16px; height: 44px; }
.qtable th.sortable { cursor: pointer; user-select: none; }
.qtable th .sort { margin-left: 6px; color: var(--subtle); font-size: 11px; }
.qtable tr.clickable:hover td { background: #fafafa; }
.qtable tr:last-child td { border-bottom: 0; }
.qtable .badge { font-size: 11px; padding: 0 6px; margin-left: 4px; }
.qid { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; color: var(--text); text-underline-offset: 3px; }
.qid-head { font: 400 16px ui-monospace, 'SF Mono', Menlo, monospace; }
.dbars { display: inline-flex; gap: 3px; vertical-align: middle; }
.dbars i { width: 14px; height: 4px; border-radius: 2px; background: var(--border); }
.dbars i.on { background: var(--text); }
.st { font-size: 13px; color: var(--muted); white-space: nowrap; }
.st.todo { color: var(--accent); font-weight: 500; }
.st.todo::before, .st.ok::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: currentColor; }
.st.ok::before { background: var(--subtle); }
.pager { display: flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 13px; }
.pager button { min-width: 30px; height: 30px; border: 1px solid transparent; background: none; border-radius: 6px; font: 13px var(--font-body); color: var(--muted); cursor: pointer; }
.pager button:hover:not(:disabled) { background: #fff; border-color: var(--border); color: var(--text); }
.pager button.on { background: var(--panel); border-color: var(--border); color: var(--text); font-weight: 600; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .gap { color: var(--subtle); padding: 0 4px; }
.fit-toggles .chip { margin: 0 4px 4px 0; }
/* 분석 (선생 전용) */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.active { color: var(--text); border-bottom-color: var(--text); }
.an-pick { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.an-pick label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.an-pick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.an-pick-row input { min-height: 32px; font-size: 13px; }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-sec { margin-bottom: 16px; }
.an-sec .res-sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.an-sec .res-sec-head h2 { margin: 0; }
.an-h3 { font-size: 14px; margin: 20px 0 8px; }
.an-note { font-size: 13px; margin: 12px 0 0; }
.an-table td, .an-table th, .an-heat td, .an-heat th { padding: 7px 8px; font-size: 13px; }
.an-scroll { overflow-x: auto; }
.an-heat th:not(:first-child), .an-heat td:not(:first-child) { text-align: center; width: 88px; }
.an-unit td { background: #fafafa; font-weight: 600; font-size: 12px; color: var(--muted); }
.an-cell { display: inline-block; min-width: 46px; padding: 3px 6px; border-radius: 4px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.an-dist { display: flex; gap: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.an-dist .ok { color: var(--text); font-weight: 700; }
.an-down { color: #b4434b; }
.an-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.an-kpis .panel { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.an-quads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.an-quad { border: 1px solid var(--border); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.an-chart { width: 100%; height: auto; display: block; }
.an-quad-chart { max-width: 420px; }
.an-grid { stroke: var(--border); }
.an-target { stroke: var(--muted); stroke-dasharray: 4 4; }
.an-ax { font-size: 11px; fill: var(--muted); font-family: var(--font-body); }
.an-line { fill: none; stroke-width: 2; }
.an-line.avgline { stroke: var(--text); stroke-width: 2.5; }
.an-line.o0 { stroke: #a1a1aa; stroke-width: 1.5; }
.an-line.o1 { stroke: #a1a1aa; stroke-width: 1.5; stroke-dasharray: 5 4; }
.an-dot { fill: var(--text); }
.an-q.ok { fill: #3f3f46; } .an-q.bad { fill: var(--red-soft); stroke: var(--red); }
.an-qn { font-size: 9px; font-weight: 600; fill: #fff; font-family: var(--font-body); pointer-events: none; }
.an-q.bad + .an-qn { fill: #b4434b; }
.an-bar.ok { fill: #a1a1aa; } .an-bar.bad { fill: var(--red); }
.an-key { width: 14px !important; height: 3px !important; border-radius: 0 !important; }
.an-key.avgline { background: var(--text); } .an-key.o0 { background: #a1a1aa; } .an-key.o1 { background: repeating-linear-gradient(90deg, #a1a1aa 0 5px, transparent 5px 9px); }
.an-key.bar-ok { background: #a1a1aa; height: 10px !important; } .an-key.bar-bad { background: var(--red); height: 10px !important; }
.an-key.target { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 8px); }
@media (max-width: 900px) { .an-two { grid-template-columns: 1fr; } }
.qtable td.pct { white-space: nowrap; font-variant-numeric: tabular-nums; }
.choice-dist { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; font-size: 13px; }
.choice-dist span { padding: 1px 8px; border: 1px solid var(--border); border-radius: 6px; }
.choice-dist span.ok { border-color: var(--text); font-weight: 600; }
/* 표 열 너비: Skill만 남는 폭을 다 쓰고, 나머지 열은 한 줄로 (2026-12-05 선생 요청) */
.qtable th, .qtable td { white-space: nowrap; width: 1%; }
.qtable td.skill, .qtable th[data-sort="skill"] { white-space: normal; width: auto; min-width: 160px; }
