/* 선생님용 관리 화면 */
:root {
  --primary: #1F4D3A; --primary-dark: #143326; --primary-soft: #EDF3EE; --primary-line: #B9CFC0;
  --gold: #B08A3E; --gold-text: #7F6227; --gold-soft: #F5EEDC; --gold-line: #E6D6B0;
  --wrong: #B42318; --wrong-soft: #FEE4E2; --wrong-line: #F4B4AD; --wrong-ground: #FEF3F2;
  --caution: #B54708; --caution-soft: #FEF0C7;
  --retest: #0B6E99; --retest-soft: #E0F2FE; --retest-line: #7CC4E4;
  --text: #1A2420; --muted: #4F5A55; --faint: #8A928D; --line: #E3DED1; --line-soft: #EFEBE1; --field-line: #CFC8B8;
  --surface: #fff; --ground: #F8F6F0; --backdrop: #E9E4D8; --chip: #F1EEE6;
  --nav-text: rgba(255, 255, 255, 0.75);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans KR", system-ui, sans-serif; color: var(--text); background: var(--ground); font-size: 14px; }
a { color: inherit; }
.app-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; background: var(--primary); border-bottom: 3px solid var(--gold); color: #fff; padding: 9px 28px; min-height: 56px; }
.app-nav a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--nav-text); font-size: 14px; white-space: nowrap; }
.app-nav a:hover, .app-nav a.is-active { color: #fff; }
.app-nav a.is-active { font-weight: 700; }
.app-brand { font-family: "Times New Roman", serif; letter-spacing: 5px; font-size: 18px; color: #fff !important; margin-right: 12px; }
.app-brand img { width: 30px; height: 30px; border-radius: 7px; margin-right: 4px; }
.app-brand small { font-family: "Noto Sans KR", sans-serif; letter-spacing: 0; font-size: 11px; color: var(--gold-soft); margin-left: 6px; }
.app-nav .spacer { flex: 1; }
.app-nav form { margin: 0; }
.app-nav .user { display: inline-flex; align-items: center; gap: 5px; color: var(--nav-text); font-size: 12px; }
.app-nav .btn { background: transparent; border-color: var(--gold); color: var(--gold-soft); }
.app-nav .btn:hover { border-color: var(--gold-soft); }
.page { max-width: 1180px; margin: 0 auto; padding: 26px 28px 60px; }
.page--wide { max-width: none; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.page-head h1 { font-size: 22px; margin: 0; color: var(--primary-dark); }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.flash-notice { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid var(--primary-line); }
.flash-alert { background: var(--wrong-ground); color: var(--wrong); border: 1px solid var(--wrong-line); }
.flash-link { background: var(--gold-soft); border: 1px solid var(--gold-line); word-break: break-all; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 12px; color: var(--primary-dark); }
.card h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--field-line); background: var(--surface); color: var(--text); border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn:hover { border-color: var(--muted); }
.btn svg { flex: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn-danger { color: var(--wrong); border-color: var(--wrong-line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { padding: 3px 8px; font-size: 12px; }
.file-list { list-style: none; margin: 0 0 12px; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.file-list li a { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-list form { margin: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
.card:has(> table.list) { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th { white-space: nowrap; text-align: left; font-size: 12px; color: var(--gold-text); font-weight: 600; padding: 10px 12px; background: var(--gold-soft); border-bottom: 1px solid var(--gold); }
table.list td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
table.list tr:hover td { background: var(--ground); }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.pill-draft { background: var(--caution-soft); color: var(--caution); }
.pill-confirmed { background: var(--primary-soft); color: var(--primary-dark); }
.pill-legacy { background: var(--gold-soft); color: var(--gold-text); }
.pill-conflict, .pill-failed { background: var(--wrong-soft); color: var(--wrong); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--field-line); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .search input:focus-visible, .retest-row input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.field-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.field-inline .field { min-width: 160px; }
.errors { background: var(--wrong-ground); color: var(--wrong); border: 1px solid var(--wrong-line); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.search { display: flex; gap: 8px; }
.search input { border: 1px solid var(--field-line); border-radius: 8px; padding: 7px 10px; font-size: 14px; width: 220px; }
.score-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.score-chip { font-size: 11px; background: var(--chip); border-radius: 6px; padding: 2px 6px; }

/* 측정 화면 */
.editor { display: grid; grid-template-columns: minmax(420px, 520px) minmax(0, 1fr); gap: 22px; align-items: start; }
.preview-frame { background: var(--backdrop); border-radius: 12px; padding: 16px; overflow: hidden; }
.fit-scale { transform-origin: top left; width: 794px; }
.preview-empty { background: var(--surface); border: 1px dashed var(--field-line); border-radius: 12px; padding: 60px 20px; text-align: center; color: var(--muted); }
.domain-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.domain-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.domain-card-head strong { font-size: 15px; }
.domain-score { font-size: 18px; font-weight: 800; }
.domain-score small { color: var(--muted); font-size: 12px; font-weight: 400; }
.qgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.qgrid form { margin: 0; }
.qbtn { width: 100%; height: 34px; border-radius: 7px; border: 1px solid var(--field-line); background: var(--surface); font-weight: 700; font-size: 13px; cursor: pointer; position: relative; font-family: inherit; color: var(--faint); }
.qbtn.is-correct { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }
.qbtn.is-excluded { background: var(--chip); border-style: dashed; color: var(--muted); text-decoration: line-through; }
.qbtn.is-retest_correct { background: var(--retest-soft); border-color: var(--retest-line); color: var(--retest); }
.qbtn.is-retest_wrong { background: var(--wrong-soft); border-color: var(--wrong-line); color: var(--wrong); }
.qbtn .auto-dot { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; }
.auto-correct { background: var(--primary); }
.auto-wrong { background: var(--wrong); }
.auto-ambiguous { background: var(--caution); }
.qbtn:disabled { cursor: not-allowed; }
.qbtn.needs-check { background: var(--caution-soft); border: 2px solid var(--caution); color: var(--caution); }
.retest-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.retest-row input { flex: 1; border: 1px solid var(--field-line); border-radius: 6px; padding: 5px 8px; font-size: 13px; }
.legend-row { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.legend-row > span { display: inline-flex; align-items: center; gap: 5px; }
.legend-row .qbtn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px; font-size: 12px; cursor: default; }
.auto-status { font-size: 13px; margin-top: 8px; }
.notice-box { background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--gold-text); }
.notice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.notice-row form { flex-shrink: 0; }
.report-notice { max-width: 794px; margin: 0 auto 12px; }
.notice-caution { background: var(--caution-soft); border-color: var(--caution); color: var(--text); }
.notice-caution .small { display: block; margin-top: 2px; color: var(--muted); }
.auto-dot-inline { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--caution); margin-right: 6px; vertical-align: middle; }
.dropzone { border: 1.5px dashed var(--field-line); border-radius: 10px; padding: 14px; background: var(--ground); }

/* 로그인 */
.auth { max-width: 380px; margin: 90px auto; }
.auth .card { padding: 28px; border-top: 4px solid var(--gold); }
.auth-logo { display: block; width: 64px; height: 64px; border-radius: 14px; margin: 0 auto 14px; }
.auth h1 { font-family: "Times New Roman", serif; letter-spacing: 8px; text-align: center; margin: 0; color: var(--primary-dark); }
.auth p.sub { text-align: center; color: var(--gold-text); font-size: 12px; margin: 6px 0 24px; }
.auth .field { margin-bottom: 12px; }
.auth .btn { width: 100%; justify-content: center; padding: 10px; }

/* 결과지 단독 화면 */
.report-shell { background: var(--backdrop); min-height: 100vh; padding: 24px 0 60px; }
.report-toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 16px; }
.report-stage { display: flex; justify-content: center; overflow: hidden; padding: 0 24px 24px; }
.report-stage .report { box-shadow: 0 6px 24px rgba(20, 51, 38, .14); }
.public-view .report--mobile { display: none; }
@media (max-width: 1024px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .app-nav { padding: 9px 16px; gap: 6px 16px; }
  .app-nav .user { display: none; }
  .page { padding: 18px 14px 48px; }
  .search input { width: 100%; }
  table.list td { white-space: nowrap; }
  table.list .score-chips { flex-wrap: nowrap; }
}
@media (max-width: 820px) {
  .public-view .report--a4 { display: none; }
  .public-view .report--mobile { display: block; }
  .report-shell { padding: 0; }
  .public-view .report--mobile { box-shadow: none; width: 100%; }
}
@media print {
  .fit-scale { transform: none !important; margin: 0 !important; }
  .report-stage { overflow: visible; padding: 0; }
  .report-shell { padding: 0; background: #fff; }
  .report-stage .report { box-shadow: none; }
}
