/* 시험성적서 현장 (웹용) — PC 프로그램과 같은 차분한 색: 따뜻한 회색 + 남색 하나, 의미색(주황·빨강·초록)만 예외 */
:root {
  color-scheme: light dark;
  --accent: #34557a; --accent-text: light-dark(#34557a, #9fb8d6); --accent-soft: light-dark(#e8eef5, #1f2a36);
  --bg: light-dark(#f7f7f5, #191919); --surface: light-dark(#ffffff, #232323); --line: light-dark(#e9e9e7, #363636);
  --ink: light-dark(#37352f, #e6e5e2); --ink2: light-dark(#787774, #a8a7a3); --cap: light-dark(#858481, #8f8e8a);
  --warn: light-dark(#b45309, #f0a24a); --warn-soft: light-dark(#fdf3e7, #3a2c1b); --ok: light-dark(#3f6f52, #8cc7a1); --ok-soft: light-dark(#eaf3ed, #1e2d24);
  --err: light-dark(#b42318, #ff8a80);
  --r: 8px; --r-sm: 6px; --r-ctl: 4px;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
a { color: var(--accent-text); text-decoration: none; }
h2 { font-size: 18px; margin: 0 0 8px; } h3 { font-size: 15px; margin: 0 0 8px; } h3.mt { margin-top: 14px; }
h3.sec { font-size: 13px; color: var(--ink2); font-weight: 600; margin: 18px 4px 6px; }
p { margin: 6px 0; line-height: 1.55; }
.muted { color: var(--ink2); font-weight: normal; font-size: 13px; }
.center { text-align: center; } .err { color: var(--err); }
.hint { font-size: 12px; color: var(--cap); margin: 4px 0 6px; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line); }
.top-title { flex: 1; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-back { border: 0; background: none; font-size: 26px; line-height: 1; padding: 0 6px; color: var(--accent-text); cursor: pointer; }
.top-net { border: 1px solid var(--line); background: var(--surface); color: var(--ink2); border-radius: 999px; padding: 4px 10px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.top-net.ok { color: var(--ok); } .top-net.warn { color: var(--warn); border-color: var(--warn); } .top-net.off { color: var(--ink2); } .top-net.busy { color: var(--accent-text); }

main { max-width: 900px; margin: 0 auto; padding: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 10px 0; }
.card.warnbox { border-color: var(--warn); background: var(--warn-soft); }
.card.err { color: var(--err); }
.card.work { display: block; color: var(--ink); padding: 12px 14px; }
.card.work.small { padding: 9px 14px; }
.w-title { font-weight: 600; } .w-sub { font-size: 13px; color: var(--ink2); margin-top: 3px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin: 10px 0 0; flex-wrap: wrap; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.two { display: flex; gap: 8px; align-items: center; } .two > * { flex: 1; min-width: 0; } .two > .btn.link { flex: 0 0 auto; }
.field.two { align-items: flex-start; } .field.two > div { position: relative; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; padding: 8px 14px; border-radius: var(--r-ctl); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.big { min-height: 46px; padding: 10px 22px; font-weight: 600; }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.link { border: 0; background: none; color: var(--accent-text); min-height: 32px; padding: 4px 6px; }
.btn.link.danger { color: var(--err); }
.btn.file { position: relative; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.ok { background: var(--ok-soft); color: var(--ok); }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink2); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

input, textarea, select { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid light-dark(#c9c8c4, #4a4a4a); border-radius: var(--r-ctl); padding: 9px 10px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field { margin: 12px 0; } .field > label, .field .two label { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 4px; }

.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 4px; position: sticky; top: calc(53px + env(safe-area-inset-top)); z-index: 10; }
.seg a { flex: 1; text-align: center; padding: 10px 0; color: var(--ink2); font-weight: 600; }
.seg a.on { background: var(--accent); color: #fff; }

table { border-collapse: collapse; }
table.kv { width: 100%; } table.kv th { text-align: left; color: var(--ink2); font-weight: normal; width: 34%; padding: 6px 8px 6px 0; vertical-align: top; font-size: 14px; }
table.kv td { padding: 6px 0; vertical-align: top; }
table.grid { width: 100%; font-size: 13px; } table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
table.grid th { color: var(--ink2); font-weight: 600; }
.eqlist { margin: 4px 0; padding-left: 18px; } .eqlist li { margin: 3px 0; }
ul.plain { padding-left: 18px; margin: 4px 0; } ul.plain li { margin: 4px 0; line-height: 1.5; }
details.ov summary { cursor: pointer; color: var(--accent-text); margin-top: 8px; } details.ov p { white-space: pre-wrap; }
.body { white-space: normal; line-height: 1.7; }

.item-row { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-top: 1px solid var(--line); color: var(--ink); }
.item-row:first-of-type { border-top: 0; }
.item-row .no { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: 0 0 auto; }
.item-row .nm { flex: 1; min-width: 0; } .item-row .sub { display: block; font-size: 12px; color: var(--ink2); margin-top: 2px; }
.item-row .sub i { color: var(--warn); font-style: normal; } .item-row .go { color: var(--cap); font-size: 20px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 8px 0; }
.thumbs figure { margin: 0; position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--line); }
.thumbs figure.noimg img { visibility: hidden; }
.thumbs figcaption { font-size: 12px; padding: 4px 6px; color: var(--ink2); min-height: 1em; }
.thumbs.edit input { border: 0; border-top: 1px solid var(--line); border-radius: 0; font-size: 14px; padding: 6px; }
.thumbs .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; }
.entry { border-top: 1px solid var(--line); padding: 10px 0; font-size: 14px; } .entry:first-of-type { border-top: 0; }
.entry-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; } .entry-head .btn { margin-left: auto; }
.entry .memo { background: var(--bg); border-radius: var(--r-sm); padding: 6px 8px; margin: 4px 0; }
.mini-tbl { margin: 6px 0; overflow-x: auto; } .mini-tbl table { font-size: 13px; } .mini-tbl th, .mini-tbl td { border: 1px solid var(--line); padding: 4px 8px; text-align: center; }
.mini-tbl tr.calc td { background: var(--bg); font-weight: 600; }

.tbl-ed { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; margin: 8px 0; background: var(--bg); }
.tbl-scroll { overflow-x: auto; margin: 8px 0; }
.tbl-ed table { min-width: 100%; } .tbl-ed th, .tbl-ed td { border: 1px solid var(--line); padding: 2px; background: var(--surface); }
.tbl-ed th input { font-size: 14px; padding: 6px; min-width: 90px; } .tbl-ed th input.unit { margin-top: 2px; color: var(--ink2); }
.tbl-ed td input { border: 0; text-align: right; font-size: 16px; padding: 8px; min-width: 90px; }
.tbl-ed td.no { text-align: center; color: var(--ink2); width: 44px; }
.tbl-ed tr.calc td { background: var(--accent-soft); text-align: right; padding: 8px; font-weight: 600; font-size: 14px; }
.tbl-ed .ops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.eq-dd { display: none; position: absolute; left: 0; right: 0; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: 0 6px 18px rgba(0, 0, 0, .12); max-height: 260px; overflow: auto; }
.eq-dd.on { display: block; } .eq-dd button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.eq-wrap { position: relative; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; padding: 7px 0 8px; font-size: 12px; color: var(--ink2); }
.tabs a .ic { display: block; font-size: 18px; line-height: 1.2; }
.tabs a.on { color: var(--accent-text); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #37352f; color: #fff; padding: 10px 16px; border-radius: var(--r);
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; z-index: 50; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; border-radius: 14px 14px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 12px; } }
.login { text-align: center; padding: 24px 18px; } .login .btn { margin-top: 12px; }

/* ---------- 조판 A4 (늘 흰 종이) ---------- */
.paper-bar { display: flex; gap: 6px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.paper-host { overflow: auto; background: light-dark(#e9e9e7, #111); border-radius: var(--r); padding: 4px; touch-action: pan-x pan-y pinch-zoom; }
.trp-pages { display: flex; flex-direction: column; align-items: center; gap: 6mm; padding: 4mm 0; width: max-content; margin: 0 auto; }
.trp-page { position: relative; background: #fff; color: #111; color-scheme: light; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); overflow: hidden; }
.trp-hdr { position: absolute; top: 8mm; display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 0.3mm solid #34557a; font: 9pt "Malgun Gothic", sans-serif; color: #555; padding-bottom: 1.5mm; }
.trp-body, .trp-measure { font-family: "HCR Batang", "함초롬바탕", "Noto Serif KR", "Batang", serif; font-size: 10pt; line-height: 160%; color: #111; }
.trp-body { position: absolute; }
.trp-measure { position: absolute; left: -9999px; top: 0; visibility: hidden; }
.trp-first { margin-bottom: 4mm; }
.trp-title { text-align: center; font-size: 20pt; font-weight: 700; letter-spacing: 3mm; margin: 2mm 0 6mm; }
.trp-info, .trp-sum { width: 100%; border-collapse: collapse; margin-bottom: 4mm; font-size: 9.5pt; }
.trp-info th, .trp-sum th { background: #f2f2f2; font-weight: 700; }
.trp-info th, .trp-info td, .trp-sum th, .trp-sum td { border: 0.12mm solid #444; padding: 1.2mm 2mm; text-align: center; vertical-align: middle; }
.trp-info th { width: 28mm; } .trp-info td { text-align: left; }
.trp-sumcap { font-weight: 700; margin: 2mm 0 1mm; }
.trp-sec-head { display: flex; gap: 0; margin: 0; } .trp-sec-head .trp-no { flex: 0 0 auto; width: 7mm; padding-left: 0; }
.trp-sec-head .trp-st { flex: 1; text-align: justify; }
.trp-sec-head.gap, .trp-p.gap, .trp-sub.gap, .trp-blk.gap, .trp-eq.gap { margin-bottom: 1.6em; }
.trp-p { padding-left: 8.4mm; text-align: justify; white-space: normal; }
.trp-sub { display: flex; padding-left: 8.4mm; } .trp-sub > span { flex: 0 0 auto; width: 7mm; } .trp-sub > div { flex: 1; }
.trp-res { font-weight: 700; padding: 1.6em 0 1.6em 14mm; }
.trp-blank { height: 1.6em; }
.trp-missing { color: #b45309; }
.trp-blk { padding-left: 8.4mm; }
.trp-tblwrap { display: flex; flex-direction: column; align-items: center; }
.trp-tcap { display: flex; justify-content: space-between; align-items: baseline; width: 100%; max-width: 100%; }
.trp-tcap .trp-unit { font-size: 8pt; }
.trp-tbl { border-collapse: collapse; border-top: 0.4mm solid #000; border-bottom: 0.4mm solid #000; margin: 0 auto; min-width: 40%; }
.trp-tbl th, .trp-tbl td { border-left: 0.12mm solid #000; border-top: 0.12mm solid #000; padding: 0 1.8mm; text-align: center; vertical-align: middle; line-height: 1.25; }
.trp-tbl tr > :first-child { border-left: 0; }
.trp-tbl tr.h th { background: #f2f2f2; font-weight: 700; }
.trp-tbl tr.calc td { background: #f2f2f2; font-weight: 700; }
.trp-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.trp-fig { display: flex; flex-direction: column; align-items: center; }
.trp-imgbox { margin: 0 auto; } .trp-imgbox img { display: block; width: 100%; height: auto; border: 0.1mm solid #000; }
.trp-crop { position: relative; overflow: hidden; width: 100%; } .trp-crop img { position: absolute; max-width: none; border: 0; }
.trp-noimg { border: 0.2mm dashed #999; color: #999; text-align: center; padding: 10mm 0; font-size: 9pt; }
.trp-fcap { text-align: center; margin-top: 1mm; }
.trp-gcap { text-align: center; padding-left: 8.4mm; }
.trp-irow { display: flex; justify-content: center; gap: 1.8mm; width: 100%; }
.trp-irow + .trp-irow { margin-top: 1.8mm; }
.trp-icell img { display: block; width: 100%; height: auto; border: 0.1mm solid #000; }
.trp-side { display: flex; gap: 4mm; align-items: flex-start; } .trp-side > div { display: flex; flex-direction: column; align-items: center; }
.trp-side .trp-imgbox { width: 100%; }
.trp-eq { padding-left: 8.4mm; } .trp-eq.al-left math { margin-left: 0; text-align: left; } .trp-eq.al-right { text-align: right; }
.trp-eq math { font-size: 11pt; } .trp-eq-row { display: flex; } .trp-eq-cell { flex: 1; }
math .eq-bar { border-top: 0.25mm solid currentColor; } math .eq-under { border-bottom: 0.25mm solid currentColor; }
math mtd.eq-l { text-align: right; } math mtd.eq-r { text-align: left; } math mtable { math-style: normal; }
