/* =====================================================================
   실험 설계 도우미 · 스타일
   ===================================================================== */
:root {
  --bg: #f4f5f7;
  --paper: #ffffff;
  --ink: #16191f;
  --sub: #5b6270;
  --faint: #8a919c;
  --line: #e3e6eb;
  --line2: #d3d7de;
  --accent: #1f6f5c;
  --accent-ink: #0f4b3d;
  --accent-soft: #e6f2ee;
  --warm: #d97a2b;
  --warm-ink: #8a4a12;
  --warm-soft: #fbefe4;
  --danger: #b5453a;
  --danger-soft: #f9e8e6;
  --note: #3b5bab;
  --note-ink: #26407f;
  --note-soft: #e9eefa;
  --muted-bg: #f6f7f9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .04), 0 6px 24px rgba(20, 30, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111416; --paper: #1a1e22; --ink: #eceef1; --sub: #a9b0ba; --faint: #7d8590;
    --line: #2b3137; --line2: #3a4249; --accent: #3fa58a; --accent-ink: #9fe0cc; --accent-soft: #173229;
    --warm: #e8964f; --warm-ink: #f3c597; --warm-soft: #3a2817; --danger: #e0786d; --danger-soft: #3a1f1c; --note: #7f9cf0; --note-ink: #c3d0fa; --note-soft: #1d2540;
    --muted-bg: #20252a; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #111416; --paper: #1a1e22; --ink: #eceef1; --sub: #a9b0ba; --faint: #7d8590;
  --line: #2b3137; --line2: #3a4249; --accent: #3fa58a; --accent-ink: #9fe0cc; --accent-soft: #173229;
  --warm: #e8964f; --warm-ink: #f3c597; --warm-soft: #3a2817; --danger: #e0786d; --danger-soft: #3a1f1c; --note: #7f9cf0; --note-ink: #c3d0fa; --note-soft: #1d2540;
  --muted-bg: #20252a; --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere;
}
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0 0 .4em; letter-spacing: -.01em; line-height: 1.3; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 17px; } h4 { font-size: 14px; }
p { margin: 0 0 .6em; }
code, kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; background: var(--muted-bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
[hidden] { display: none !important; }

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); text-decoration: none; font-size: 16px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
.topbar .spacer { flex: 1; }
.app-ver { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .app-ver { display: none; } }
#user-chip { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--sub); }
.user-btn { display: flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; color: var(--sub); background: transparent; border: 1px solid transparent; border-radius: 99px; padding: 3px 10px 3px 3px; cursor: pointer; }
.user-btn:hover { border-color: var(--line2); color: var(--ink); }
.user-btn .caret { font-size: 10px; }
.acct { margin: 6px 0 14px; }
.code-sheet { background: var(--muted-bg); border-radius: 12px; padding: 14px; }
.code-sheet .mini-table { margin-bottom: 0; }
.mini-table.codes td, .mini-table.codes th { text-align: left; vertical-align: top; }
.code-cell { font-weight: 800; letter-spacing: .12em; color: var(--accent); white-space: nowrap; }
.confirm-chk { margin-top: 4px; }
.acct-box { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; margin-bottom: 14px; }
.acct-box summary { cursor: pointer; padding: 12px 0; }
.acct-box[open] { padding-bottom: 14px; }
.acct-h { margin-top: 18px; }
.seg.full { display: flex; width: 100%; margin: 8px 0 18px; }
.seg.full button { flex: 1; }
.start-card h2 { margin-bottom: 4px; }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.badge.demo { background: var(--warm-soft); color: var(--warm-ink); }
.badge.on { background: var(--accent-soft); color: var(--accent-ink); }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 80px; }
.loading { padding: 60px 0; text-align: center; color: var(--sub); }

/* ---------- 공통 요소 ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.narrow { max-width: 460px; margin: 40px auto; }
.card.empty { text-align: center; padding: 40px 20px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--accent); text-transform: uppercase; margin-bottom: 4px; }
.notice { background: var(--warm-soft); color: var(--warm-ink); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.notice code { background: transparent; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.tag.warm { background: var(--warm-soft); color: var(--warm-ink); }
.tag.xs { font-size: 11px; padding: 0 6px; vertical-align: 1px; }
.count { display: inline-block; min-width: 20px; text-align: center; font-size: 12px; padding: 0 6px; border-radius: 99px; background: var(--muted-bg); color: var(--sub); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1; padding: 10px 16px; min-height: 40px;
  border-radius: 9px; border: 1px solid var(--line2); background: var(--paper); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 7px 12px; min-height: 34px; font-size: 13px; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.danger-text { color: var(--danger) !important; }
.link { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.icon-btn {
  width: 32px; height: 32px; flex: none; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--sub); cursor: pointer; font-size: 14px; display: inline-grid; place-items: center;
}
.icon-btn:hover:not(:disabled) { background: var(--muted-bg); border-color: var(--line); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }

input, textarea, select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line2); border-radius: 8px;
  padding: 9px 11px; width: 100%; min-height: 40px;
}
textarea { resize: vertical; line-height: 1.5; }
select { width: auto; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; min-height: 0; accent-color: var(--accent); margin: 0; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--sub); margin-bottom: 6px; }
.field > span em { font-style: normal; font-weight: 400; color: var(--faint); margin-left: 6px; }
.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 700; flex: none; position: relative; border: 2px solid var(--paper);
}
.avatar.sm { width: 24px; height: 24px; font-size: 12px; border: none; }
.avatar.xs { width: 18px; height: 18px; font-size: 10px; border: none; font-style: normal; }
.avatar.online::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: #2ecc71; border: 2px solid var(--paper); }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -8px; }

/* ---------- 알림 ---------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); transition: opacity .3s, transform .3s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

dialog.modal { border: none; border-radius: 16px; padding: 22px; width: min(520px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog.modal.small { width: min(400px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15, 20, 25, .45); }
.confirm-msg { font-size: 15px; margin: 4px 0 18px; white-space: pre-line; }

/* ---------- 홈 ---------- */
.home-hero { padding: 12px 0 20px; }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 28px; }
.card.action h3 { margin-bottom: 2px; }
.code-input { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.exp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.exp-card { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s; }
.exp-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.exp-card h3 { margin: 4px 0 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; margin: 0; }
.home-foot { margin-top: 32px; text-align: center; font-size: 13px; }
.code-big { font-size: 40px; font-weight: 800; letter-spacing: .18em; color: var(--accent); text-align: center; margin: 6px 0 14px; }

/* ---------- 실험 화면 틀 ---------- */
.exp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.back { font-size: 14px; text-decoration: none; color: var(--sub); white-space: nowrap; }
.title-input { flex: 1; min-width: 200px; font-size: 20px; font-weight: 800; border-color: transparent; background: transparent; padding: 6px 8px; }
.title-input:hover { border-color: var(--line); }
.exp-tools { display: flex; align-items: center; gap: 12px; }
#save-state { font-size: 12px; color: var(--faint); white-space: nowrap; }
#save-state[data-state="saving"] { color: var(--warm); }
#save-state[data-state="error"] { color: var(--danger); font-weight: 700; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 7px; padding: 10px 14px; text-decoration: none; color: var(--sub); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab-n { width: 20px; height: 20px; border-radius: 50%; background: var(--muted-bg); display: grid; place-items: center; font-size: 11px; }
.tab.on .tab-n { background: var(--accent); color: #fff; }
.view-title { margin-bottom: 2px; }
.lastmod { font-size: 12px; color: var(--faint); }

/* ---------- 1. 계획서 도우미 ---------- */
.wizard { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start; }
.wiz-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 70px; }
.wiz-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: var(--sub); font-weight: 600; font-size: 14px; }
.wiz-item:hover { background: var(--paper); color: var(--ink); }
.wiz-item.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--line); }
.wiz-item .dot { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line2); display: grid; place-items: center; font-size: 12px; flex: none; background: var(--paper); }
.wiz-item.on .dot { border-color: var(--accent); color: var(--accent); }
.wiz-item.done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.wiz-item .who { margin-left: auto; display: flex; gap: 2px; }
.step-card { padding: 26px 28px; }
.step-head h2 { font-size: 24px; margin: 6px 0 2px; }
.lead { color: var(--sub); font-size: 15px; margin: 0; }
.guide { background: var(--accent-soft); border-radius: 10px; padding: 0 14px; margin: 16px 0 20px; color: var(--accent-ink); }
.guide summary { cursor: pointer; font-weight: 700; padding: 10px 0; font-size: 14px; }
.guide[open] { padding-bottom: 12px; }
.guide p { margin-bottom: 6px; }
.guide .muted { color: inherit; opacity: .8; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.compare > div { background: var(--paper); border-radius: 8px; padding: 10px 12px; color: var(--ink); font-size: 14px; }
.compare b { display: block; font-size: 12px; margin-bottom: 4px; }
.compare .good b { color: var(--accent); }
.compare .bad b { color: var(--warm); }
.compare .bad span { display: block; color: var(--sub); font-size: 12px; margin-top: 4px; }
.choice2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; border: 1px solid var(--line2); border-radius: 10px; padding: 12px 14px; cursor: pointer; align-items: center; }
.choice small { grid-column: 2; color: var(--sub); font-size: 13px; line-height: 1.45; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.list-edit { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.list-edit li { display: flex; align-items: center; gap: 8px; }
.list-edit input:not([type=checkbox]) { flex: 1; min-width: 0; }
.list-edit .grow2 { flex: 2; }
.list-edit .chk { font-size: 13px; color: var(--sub); white-space: nowrap; }
.idx { width: 24px; height: 24px; border-radius: 6px; background: var(--muted-bg); color: var(--sub); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.sub-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 2px; margin-bottom: 12px; }
.sub-card > .row { margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 99px; border: 1px dashed var(--line2); background: var(--paper); color: var(--sub); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }
.builder { border: 1px dashed var(--line2); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.builder-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 10px; }
.builder-row select { min-height: 36px; padding: 6px 8px; }
.pill { background: var(--muted-bg); border-radius: 8px; padding: 7px 10px; font-weight: 600; }
.preview { font-weight: 700; color: var(--accent); }
.steps-edit { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.steps-edit li { display: flex; align-items: flex-start; gap: 8px; background: var(--paper); border-radius: 10px; }
.steps-edit li .idx { margin-top: 8px; }
.steps-edit textarea { flex: 1; }
.steps-edit .handle { cursor: grab; color: var(--faint); padding: 9px 2px; user-select: none; letter-spacing: -2px; }
.steps-edit li.dragging { opacity: .5; outline: 2px dashed var(--accent); }
.step-btns { display: flex; flex-direction: column; }
.steps-edit textarea { font-size: 15px; }
.step-field { position: relative; flex: 1; min-width: 0; }
.step-field textarea { width: 100%; padding-right: 40px; display: block; }
.sub-add { position: absolute; right: 7px; bottom: 7px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line2); background: var(--paper); color: var(--accent); font-size: 15px; font-weight: 800; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.split-row { flex-basis: 100%; padding-left: 92px; margin-top: -2px; }
.split-btn { font: inherit; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: none; border-radius: 99px; padding: 4px 10px; cursor: pointer; }
.split-btn:hover { background: var(--accent); color: #fff; }
.steps-edit li { flex-wrap: wrap; }
.unit-box { display: flex; flex-direction: column; gap: 6px; }
.unit-input { font-weight: 700; }
.unit-input.flash { background: var(--accent-soft); border-color: var(--accent); transition: background .3s; }
.unit-q { font-size: 14px; min-height: 36px; padding: 7px 10px; background: var(--muted-bg); border-style: dashed; }
.unit-results:empty { display: none; }
.unit-results { display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.unit-hint { margin-bottom: -2px; }
.unit-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.unit-prop { font-size: 12px; font-weight: 700; color: var(--sub); min-width: 52px; }
.unit-chip { font: inherit; display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line2); background: var(--paper); color: var(--ink); cursor: pointer; }
.unit-chip small { font-size: 11px; color: var(--faint); }
.unit-chip:hover, .unit-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.sub-add:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { width: 64px; text-align: center; font-weight: 700; font-size: 18px; }
.stepper .icon-btn { border: 1px solid var(--line2); width: 40px; height: 40px; font-size: 18px; }
.hints { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.hint { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; padding: 9px 12px; border-radius: 9px; }
.hint .hi { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; color: #fff; margin-top: 1px; }
.hint.ok { background: var(--accent-soft); color: var(--accent-ink); }
.hint.ok .hi { background: var(--accent); }
.hint.warn { background: var(--warm-soft); color: var(--warm-ink); }
.hint.warn .hi { background: var(--warm); }
.hint.info { background: var(--muted-bg); color: var(--sub); }
.hint.info .hi { background: var(--faint); }
.hint.big { font-size: 15px; padding: 12px 14px; margin-top: 14px; }
.tab-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.step-foot { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- 2. 설계 점검 ---------- */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.checklist { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.checklist .ci { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; }
.checklist li.ok .ci { background: var(--accent); }
.checklist li.no .ci { background: var(--warm); }
.checklist li.no { border-color: color-mix(in srgb, var(--warm) 35%, var(--line)); }
.score-card { position: sticky; top: 70px; }
.score { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 6px; }
.score b { font-size: 44px; color: var(--accent); font-weight: 800; line-height: 1; }
.meter { height: 10px; border-radius: 99px; background: var(--muted-bg); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* ---------- 3. 데이터 ---------- */
.seg { display: inline-flex; background: var(--muted-bg); border-radius: 10px; padding: 3px; gap: 2px; margin: 4px 0 14px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 14px; font-weight: 600; border: none; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--sub); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg.small { margin: 0; }
.seg .rec { font-style: normal; font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 1px 6px; margin-left: 4px; }
.data-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; margin-top: 8px; }
.table-card { padding: 16px; min-width: 0; }
.table-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.data-table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 4px; text-align: center; }
.data-table thead th { font-size: 12px; color: var(--sub); font-weight: 700; padding: 8px 4px; background: var(--muted-bg); }
.data-table thead th:first-child { border-top-left-radius: 8px; }
.data-table thead th:last-child { border-top-right-radius: 8px; }
.data-table th.lv { text-align: left; font-weight: 700; padding: 4px 10px; white-space: nowrap; }
.data-table th.lv-h { text-align: left; padding-left: 10px; }
.data-table td.stat { color: var(--accent); font-weight: 700; min-width: 64px; }
.data-table thead th.stat { color: var(--accent); }
.cell { position: relative; min-width: 76px; }
.cell input { text-align: center; border-color: transparent; background: var(--muted-bg); min-height: 38px; padding: 6px; font-variant-numeric: tabular-nums; font-weight: 600; }
.cell input:hover { border-color: var(--line2); }
.cell.focus input { background: var(--paper); }
.cell.range input { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.cell.outlier input { background: var(--warm-soft); color: var(--warm-ink); border-color: color-mix(in srgb, var(--warm) 50%, transparent); }
.cell.excluded input { text-decoration: line-through; color: var(--faint); background: repeating-linear-gradient(-45deg, var(--muted-bg), var(--muted-bg) 5px, var(--paper) 5px, var(--paper) 10px); }
.cell.invalid input { border-color: var(--danger); outline: 2px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.cell.memo .cell-flag { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: #4b5fb0; }
.cell.others input { box-shadow: 0 0 0 2px var(--who); }
.cell.others::before { content: attr(data-who); position: absolute; top: -8px; left: 6px; font-size: 10px; color: #fff; background: var(--who); padding: 0 5px; border-radius: 4px; z-index: 2; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--sub); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.sw.range { background: var(--danger-soft); border: 1px solid var(--danger); }
.sw.outlier { background: var(--warm-soft); border: 1px solid var(--warm); }
.sw.excluded { background: repeating-linear-gradient(-45deg, var(--line2), var(--line2) 3px, var(--paper) 3px, var(--paper) 6px); }
.sw.memo { background: #4b5fb0; border-radius: 50%; width: 9px; height: 9px; }
.side-panel { position: sticky; top: 70px; }
.big-val { font-size: 34px; font-weight: 800; line-height: 1.1; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.big-val small { font-size: 15px; color: var(--sub); margin-left: 4px; font-weight: 600; }
.side-panel .hint { margin-top: 10px; }
.exclude-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 14px 0; }
.exclude-box.on { border-color: var(--warm); background: var(--warm-soft); }
.exclude-box input:not([type=checkbox]) { margin-top: 8px; }
.exclude-box p { margin: 6px 0 0; color: var(--warm-ink); }
.tipbox { background: var(--muted-bg); border-radius: 10px; padding: 12px; margin-top: 12px; }
.tipbox p { margin: 4px 0 0; }
.photo { width: 100%; border-radius: 8px; display: block; margin-bottom: 6px; }
.file-btn { cursor: pointer; margin-top: 6px; }
.actual-card { margin-top: 16px; }
.actual-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; }
.actual-list li { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.planned { display: flex; gap: 10px; background: var(--muted-bg); border-radius: 8px; padding: 9px 12px; font-size: 14px; min-height: 40px; }

/* ---------- 4. 그래프 ---------- */
.graph-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.graph-tools { margin-bottom: 10px; }
.chart-box { position: relative; height: 420px; margin-bottom: 12px; }
.fit { background: var(--muted-bg); border-radius: 10px; padding: 12px; margin: 12px 0; }
.fit .eq { font-weight: 800; font-size: 17px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 12px 0 8px; font-variant-numeric: tabular-nums; }
.mini-table th, .mini-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: right; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table th { color: var(--sub); font-weight: 700; }

/* ---------- 5. 결론·고찰 ---------- */
.concl-layout { display: grid; grid-template-columns: 1fr 330px; gap: 16px; align-items: start; margin-top: 8px; }
.auto-sum { background: var(--accent-soft); color: var(--accent-ink); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.auto-sum ul { margin: 0 0 8px; padding-left: 18px; }
.hyp { margin: 0 0 14px; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--muted-bg); border-radius: 0 8px 8px 0; }
.verdict { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.verdict button { font: inherit; border: 1px solid var(--line2); background: var(--paper); border-radius: 10px; padding: 12px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.verdict button small { color: var(--sub); font-size: 12px; }
.verdict button.on { border-color: var(--accent); background: var(--accent-soft); }
.verdict button.on b { color: var(--accent-ink); }
.cause-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.cause-list li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.cause-list li.on { border-color: var(--accent); }
.cause-list .chk { flex-wrap: wrap; }
.cause-body { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.cause-body select { flex: 1; max-width: 100%; }
.linked-note { font-size: 13px; background: var(--muted-bg); border-radius: 8px; padding: 8px 10px; }
.ref-panel { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; }
.ref-panel h4 { margin: 16px 0 6px; display: flex; align-items: center; gap: 6px; }
.ref-panel ul { margin: 0; padding-left: 16px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- 6. 보고서 ---------- */
.report-toolbar { margin-bottom: 16px; }
.report-doc { background: #fff; color: #16191f; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 48px; max-width: 860px; margin: 0 auto; box-shadow: var(--shadow); }
.rsec { padding: 18px 0; border-bottom: 1px solid #eceef1; }
.rsec:last-child { border-bottom: none; }
.rsec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.rsec-head h3 { margin: 0; font-size: 17px; }
.rsec-head .btn { color: #16191f; background: #fff; border-color: #d3d7de; }
.rsec-body { font-size: 15px; }
.rsec-body ul, .rsec-body ol { margin: 4px 0; padding-left: 22px; }
.rsec-body li { margin-bottom: 3px; }
.rtitle { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.rtable { border-collapse: collapse; width: 100%; font-size: 14px; margin: 6px 0; font-variant-numeric: tabular-nums; }
.rtable th, .rtable td { border: 1px solid #c9ced5; padding: 6px 8px; text-align: center; }
.rtable th { background: #f3f5f7; }
.rsec[data-key="vars"] .rtable td:first-child { white-space: nowrap; }
.rsec[data-key="vars"] .rtable td:last-child, .rsec[data-key="vars"] .rtable td:nth-child(3) { text-align: left; }
.sub { font-size: 13px; color: #5b6270; margin-top: 6px; }
.cap { font-weight: 700; margin: 10px 0 2px; }
.changed { display: block; font-size: 12px; color: #8a4a12; }
.rgraph { margin: 8px 0 12px; }
.rgraph-canvas { height: 400px; }
.rgraph img { width: 100%; max-width: 760px; display: block; margin: 0 auto; }
.photo-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.photo-row figure { margin: 0; width: 160px; }
.photo-row img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; }
.photo-row figcaption { font-size: 12px; color: #5b6270; }

/* ---------- 홈 탭 · 아이디어 보관함 · 참고 문헌 ---------- */
.home-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 20px; overflow-x: auto; scrollbar-width: none; }
.home-tabs a { display: flex; align-items: center; gap: 7px; padding: 10px 14px; text-decoration: none; color: var(--sub); font-weight: 700; font-size: 15px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.home-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.home-tabs a:hover { color: var(--ink); }
.tag.blue { background: color-mix(in srgb, #4b5fb0 14%, transparent); color: #3a4a94; }
.idea-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; margin-top: 12px; }
.idea-main { padding: 24px; }
.idea-side { position: sticky; top: 70px; }
.idea-side .danger-text { align-self: flex-end; }
.save-chip { font-size: 12px; color: var(--faint); }
.save-chip[data-state="saving"] { color: var(--warm); }
.save-chip[data-state="error"] { color: var(--danger); font-weight: 700; }
.made-list { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.guide.static { padding: 12px 14px; margin: 4px 0 14px; }
.guide-list { margin: 4px 0 8px; padding-left: 20px; }
.guide-list li { margin-bottom: 3px; }
.compare.one { grid-template-columns: 1fr; }
.field.span2 { grid-column: 1 / -1; }
.wiz-item .opt { font-size: 10px; font-weight: 700; color: var(--faint); border: 1px solid var(--line2); border-radius: 99px; padding: 0 5px; margin-left: 2px; vertical-align: 1px; }
.skip-note { margin-top: 10px; }
.invite-box.tight { margin: 4px 0 0; padding: 12px; }
.ref-card .grid2 { gap: 0 12px; }
.ref-list { padding-left: 22px; }
.ref-list li { margin-bottom: 8px; }
.ref-list .sub { margin-top: 2px; }

/* ---------- 숨긴 단계 · 하위 단계 · 목차 편집 ---------- */
.wiz-item.off { opacity: .55; }
.wiz-item.off .dot { border-style: dashed; }
.hidden-note { background: var(--muted-bg); border: 1px dashed var(--line2); border-radius: 10px; padding: 14px 16px; margin: 16px 0; color: var(--sub); }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--sub); margin-bottom: 6px; }
.steps-edit li.sub { margin-left: 34px; }
.steps-edit li.sub .idx { background: var(--accent-soft); color: var(--accent-ink); width: auto; min-width: 24px; padding: 0 5px; }
.steps-edit .idx { width: auto; min-width: 24px; padding: 0 4px; }
.actual-list li.sub .planned { margin-left: 24px; }
.actual-list .idx { width: auto; min-width: 24px; padding: 0 4px; }
.steps-list { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.steps-list .sl { display: flex; gap: 8px; }
.steps-list .sl b { flex: none; min-width: 22px; }
.steps-list .sl.d1 { padding-left: 22px; }
.report-doc.editing .rsec { border: 1px dashed #d3d7de; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.report-doc.editing .rsec-body { max-height: 90px; overflow: hidden; opacity: .7; -webkit-mask-image: linear-gradient(#000 50%, transparent); mask-image: linear-gradient(#000 50%, transparent); }
.rsec-off { opacity: .5; }
.rsec-off .rsec-body { display: none; }

/* ---------- 실험 삭제 ---------- */
.del-warn { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 12px 14px; margin: 8px 0 16px; }
.del-warn ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink); font-size: 14px; }
.del-name { color: var(--ink); background: var(--muted-bg); border-radius: 4px; padding: 0 4px; }
.trash-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--faint); display: inline-grid; place-items: center; cursor: pointer; }
.trash-btn:hover { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.danger-zone .trash-btn { color: var(--danger); }
.del-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin: -6px 0 8px; }
.btn.pressing { animation: press .18s ease; }
.btn.denied { animation: press .18s ease; }
@keyframes press { 0% { transform: scale(1); } 45% { transform: scale(.93); filter: brightness(.85); } 100% { transform: scale(1); } }
input.shake { animation: shake .35s ease; border-color: var(--danger); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- 관리자 ---------- */
.admin-wrap { max-width: 720px; margin: 12px auto 0; }
.admin-wrap .hint { margin: 12px 0 16px; }
.admin-search { margin-bottom: 16px; }
.admin-search input { flex: 1; }
.admin-table td, .admin-table th { text-align: left; vertical-align: middle; }
.admin-table td:last-child { text-align: right; }
.temp-id { font-size: 20px; font-weight: 800; }
.temp-pw { letter-spacing: .12em; margin: 4px 0 12px; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- 팀 창 ---------- */
.invite-box { background: var(--muted-bg); border-radius: 12px; padding: 16px; text-align: center; margin: 12px 0 18px; }
.invite-box .code-big { margin: 2px 0 6px; }
.link-txt { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--sub); margin-bottom: 12px; word-break: break-all; }
.member-list { list-style: none; padding: 0; margin: 8px 0 16px; display: flex; flex-direction: column; gap: 10px; }
.member-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.danger-zone { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; text-align: right; }

/* ---------- 좁은 화면 (휴대폰) ---------- */
@media (max-width: 860px) {
  .wizard, .two-col, .data-layout, .graph-layout, .concl-layout, .idea-layout { grid-template-columns: 1fr; }
  .idea-side { position: static; }
  .wiz-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .wiz-nav::-webkit-scrollbar { display: none; }
  .wiz-item { flex-direction: column; gap: 4px; padding: 6px 8px; font-size: 11px; min-width: 64px; text-align: center; }
  .wiz-item .who { display: none; }
  .score-card, .side-panel, .ref-panel { position: static; max-height: none; }
  .step-card { padding: 20px 16px; }
  .home-actions, .compare, .choice2 { grid-template-columns: 1fr; }
  .actual-list li { grid-template-columns: 1fr; gap: 6px; }
  .report-doc { padding: 24px 18px; }
  .exp-tools #save-state { display: none; }
  .title-input { font-size: 18px; order: 3; flex-basis: 100%; }
  .chart-box { height: 320px; }
  .cell { min-width: 64px; }
  .cell input { min-height: 44px; font-size: 16px; }
}
@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  .list-edit li { flex-wrap: wrap; }
  .list-edit .grow2 { flex-basis: calc(100% - 72px); }
  .verdict { grid-template-columns: 1fr; }
  h1 { font-size: 23px; }
}

/* ---------- 인쇄: 보고서만 ---------- */
/* ---------- 선생님 코멘트 ---------- */
.tag.note { background: var(--note-soft); color: var(--note-ink); }
.ro-hide { display: none !important; }
.cmt-btn { position: relative; gap: 6px; }
.cmt-btn.on { background: var(--note-soft); border-color: var(--note); color: var(--note-ink); }
.cmt-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--note); color: #fff; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
.cmt-new { font-size: 11px; font-weight: 800; color: #fff; background: var(--danger); border-radius: 99px; padding: 1px 6px; }
.req-dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; margin-left: 4px; }
.cbadge { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--note-ink); background: var(--note-soft); border-radius: 99px; padding: 1px 7px; white-space: nowrap; }
.tab .cbadge { margin-left: 4px; }

.cpanel {
  position: fixed; z-index: 30; right: 0; top: 57px; bottom: 0; width: 360px;
  background: var(--paper); border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(20, 30, 40, .08);
  display: flex; flex-direction: column; padding: 14px 14px 0;
}
.cp-head { display: flex; align-items: center; gap: 8px; }
.cp-head b { font-size: 16px; }
.cp-head .spacer { flex: 1; }
.cp-tabs { margin: 10px 0 8px; }
.cp-tabs button { font-size: 13px; padding: 6px 8px; }
.cp-where { font-size: 13px; font-weight: 700; color: var(--note-ink); background: var(--note-soft); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; }
.cp-body { flex: 1; overflow-y: auto; margin: 0 -14px; padding: 0 14px 12px; }
.cp-form { border-top: 1px solid var(--line); margin: 0 -14px; padding: 10px 14px 14px; display: grid; gap: 6px; background: var(--paper); }
.cp-form textarea { min-height: 72px; }
.cmt-empty { padding: 18px 4px; }
.cmt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cmt { border: 1px solid var(--line); border-left: 3px solid var(--note); border-radius: 10px; padding: 10px 12px; background: var(--paper); }
.cmt.fresh { box-shadow: 0 0 0 2px color-mix(in srgb, var(--note) 25%, transparent); }
.cmt.done { border-left-color: var(--accent); background: var(--muted-bg); }
.cmt.done .cmt-body { color: var(--sub); }
.cmt-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmt-top .spacer { flex: 1; }
.cmt-top .icon-btn.sm, .cmt-top .trash-btn.sm { width: 28px; height: 28px; }
.cmt-body { margin: 6px 0 8px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.cmt-where { display: inline-block; font-size: 12px; font-weight: 700; margin-top: 4px; }
.cmt-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--ink); padding: 4px 8px 4px 6px; border-radius: 8px; background: var(--muted-bg); }
.cmt.done .cmt-check { background: var(--accent-soft); color: var(--accent-ink); }
.cmt-check.ro { cursor: default; }
.cmt-editf { display: grid; gap: 6px; margin: 6px 0 8px; }
.cmt-progress { margin: 2px 0 12px; }
.cmt-progress .bar { height: 6px; border-radius: 99px; background: var(--muted-bg); overflow: hidden; margin-top: 6px; }
.cmt-progress .bar span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.cmt-group { margin-bottom: 14px; }
.cmt-ghead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 14px; color: var(--ink); text-decoration: none; margin: 4px 2px 8px; }
.cmt-ghead:hover { color: var(--note); }

.teacher-box { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px 12px; margin: 14px 0; }
.teacher-box h3 { margin-bottom: 4px; }
.code-big.sm { font-size: 28px; margin: 4px 0 6px; color: var(--note); }
.tcode { text-align: center; }
.req-list { margin-top: 10px; }
.wait-list { display: grid; gap: 10px; margin-bottom: 16px; }
.wait-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-color: var(--note-soft); }
.wait-card .grow { flex: 1; min-width: 220px; }

/* 넓은 화면: 코멘트 창 옆으로 본문을 비켜 줌 */
@media (min-width: 1200px) {
  body.cpanel-open main { margin-left: max(0px, calc((100vw - 372px - 1180px) / 2)); margin-right: 372px; }
}
/* 휴대폰: 아래에서 올라오는 창 */
@media (max-width: 700px) {
  .cpanel { top: auto; left: 0; width: auto; height: 72vh; border-left: none; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .18); }
  body.cpanel-open main { padding-bottom: 74vh; }
}

/* ---------- 파일에서 가져오기 ---------- */
dialog.modal.wide { width: min(860px, calc(100vw - 32px)); }
.import-modal { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }
.import-modal > * { min-width: 0; }
.import-modal[open] { display: grid; }
.import-modal h2 { margin: 0; }
.drop { display: grid; gap: 4px; place-items: center; text-align: center; padding: 18px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; background: var(--muted-bg); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.field.inline { display: flex; align-items: center; gap: 10px; margin: 0; }
.field.inline > span { white-space: nowrap; margin: 0; }
.field.inline select { flex: 1; }
.imp-mode button { font-size: 14px; min-width: 0; white-space: normal; }
@media (max-width: 600px) { .imp-map select { min-width: 130px; } .import-modal .grid2 { grid-template-columns: 1fr; } }
.imp-orient { width: fit-content; }
.imp-table-wrap { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: 10px; }
.imp-map, .imp-raw-t { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 14px; }
.imp-map td:first-child, .imp-map th:first-child { min-width: 140px; max-width: 260px; }
.import-modal select { max-width: 100%; }
.imp-map th, .imp-map td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.imp-map thead th { position: sticky; top: 0; background: var(--muted-bg); font-size: 13px; z-index: 1; }
.imp-map td.num, .imp-map th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.imp-map td.extra { color: var(--sub); background: var(--muted-bg); }
.imp-map select { min-width: 170px; padding: 6px 8px; }
.imp-raw-t td { padding: 4px 8px; border: 1px solid var(--line); font-size: 12px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.imp-raw summary { cursor: pointer; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.imp-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.imp-foot .grow { flex: 1; min-width: 200px; }
#import-btn { white-space: nowrap; }
.imp-undo { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 12px; margin: 10px 0; font-size: 14px; }
.imp-how { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; background: var(--muted-bg); color: var(--sub); }
.imp-how.name { background: var(--accent-soft); color: var(--accent-ink); }
.imp-auto { color: var(--accent-ink); margin-top: 4px; }
.imp-unit { font-size: 14px; }

/* ---------- 버전 ---------- */
.ver-modal { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.ver-modal > * { min-width: 0; }
.ver-modal h2 { margin: 0; }
.ver-form { display: flex; gap: 8px; flex-wrap: wrap; }
.ver-form input { flex: 1; min-width: 200px; }
.ver-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ver-list li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ver-list .grow { flex: 1; min-width: 0; }
.ver-empty { padding: 12px 2px; }
.ver-head { display: grid; gap: 4px; }
.ver-sum { background: var(--muted-bg); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.ver-doc.report-doc { display: grid; gap: 12px; padding: 0; border: none; box-shadow: none; max-width: none; background: transparent; }
.ver-sec { background: #fff; color: #16191f; width: 100%; max-width: none; margin: 0; box-sizing: border-box; }
.ver-doc.report-doc { justify-items: stretch; }
.ver-sec { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.ver-sec.changed, .ver-sec.gone, .ver-sec.new { border-color: var(--warm); }
.ver-sec h3 { margin: 0 0 8px; font-size: 16px; }
.vbadge { font-size: 12px; font-weight: 700; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.vbadge.same { background: var(--muted-bg); color: var(--sub); }
.vbadge.chg { background: var(--warm-soft); color: var(--warm-ink); }
.vcmp { margin-top: 10px; }
.vcmp summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--accent-ink); }
.vdiff { border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 320px; font-size: 13px; margin-top: 6px; }
.vd { display: grid; grid-template-columns: 22px minmax(0, 1fr); padding: 2px 8px; white-space: pre-wrap; word-break: break-word; }
.vd.del { background: var(--danger-soft); }
.vd.ins { background: var(--accent-soft); }
.vd.same { color: var(--sub); }
.vk { font-weight: 800; }
.vk.del, .vd.del .vk { color: var(--danger); }
.vk.ins, .vd.ins .vk { color: var(--accent-ink); }

@media print {
  @page { size: A4; margin: 16mm; }
  body { background: #fff; }
  .topbar, .exp-head, .tabs, .no-print, #toasts, .cpanel { display: none !important; }
  body.cpanel-open main { margin: 0 auto !important; padding-bottom: 0 !important; }
  main { padding: 0; max-width: none; }
  .report-doc { border: none; box-shadow: none; padding: 0; max-width: none; }
  .rsec { break-inside: avoid; }
  .rsec[data-key="result"], .rsec[data-key="obs"] { break-inside: auto; }
}
.idea-side #del-idea, aside #del-idea { align-self: flex-end; margin-left: auto; display: grid; }
.rnote { margin: 8px 0 0; font-size: 14px; }

/* 반 전체 만들기 */
.batch-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: -12px 0 28px; border-color: var(--note-soft); }
.batch-cta .grow { flex: 1; min-width: 240px; }
.batch-cta p { margin: 4px 0 0; }
.batch-box { border: 1px solid var(--note-soft); border-radius: 16px; padding: 14px; margin-bottom: 18px; background: color-mix(in srgb, var(--note-soft) 22%, transparent); }
.batch-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.batch-head .grow { flex: 1; min-width: 220px; }
.batch-more { margin: 4px 0 12px; }
.batch-more summary { cursor: pointer; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.batch-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 15px; }
.batch-table th, .batch-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.batch-table th { font-size: 13px; color: var(--sub); font-weight: 700; }
.code-mid { font-size: 20px; font-weight: 800; letter-spacing: .14em; color: var(--accent); font-variant-numeric: tabular-nums; }
.print-only { display: none; }
@media print {
  body.printing-batch > *:not(dialog) { display: none !important; }
  body.printing-batch dialog.modal { position: static; box-shadow: none; width: auto; padding: 0; margin: 0; max-height: none; }
  body.printing-batch dialog::backdrop { background: none; }
  body.printing-batch .print-only { display: block; }
  .batch-table td { padding: 10px; }
  .code-mid { font-size: 24px; color: #000; }
}

/* 폴더 */
.folder-box { border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px 14px; margin-bottom: 14px; background: var(--paper); transition: border-color .15s, background .15s; }
.folder-box.batch { border-color: var(--note-soft); background: color-mix(in srgb, var(--note-soft) 22%, var(--paper)); }
.folder-box.shut { padding-bottom: 10px; }
.folder-box.shut > .exp-list, .folder-box.shut > .folder-empty { display: none; }
.folder-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 36px; }
.folder-head .grow { flex: 1; }
.folder-box:not(.shut) .folder-head { margin-bottom: 10px; }
.fold-toggle { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; padding: 4px 6px; margin-left: -6px; border-radius: 8px; cursor: pointer; color: var(--ink); font: inherit; }
.fold-toggle:hover { background: var(--muted-bg); }
.fold-toggle .caret { width: 12px; color: var(--sub); font-size: 12px; }
.fold-toggle svg { color: var(--accent); }
.fold-toggle .fname { font-size: 16px; }
.folder-empty { margin: 0; padding: 14px; border: 1.5px dashed var(--line2); border-radius: 12px; text-align: center; }
.folder-root { border-radius: 16px; padding: 6px 0 0; min-height: 60px; transition: background .15s, outline-color .15s; outline: 2px dashed transparent; outline-offset: 4px; }
.folder-root-head { margin: 4px 0 10px; }
.drag-on .folder-box, .drag-on .folder-root { outline: 2px dashed var(--line2); outline-offset: 2px; }
.folder-box.drop-on, .folder-root.drop-on { outline: 2px dashed var(--accent) !important; background: var(--accent-soft); }
.exp-card.dragging { opacity: .45; }
.card-tools { display: inline-flex; align-items: center; gap: 2px; }
.move-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--sub); cursor: pointer; }
.move-btn:hover { background: var(--muted-bg); border-color: var(--line); color: var(--accent); }
.no-folders .move-btn { display: none; }
.fpick-list { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 12px; max-height: 50vh; overflow: auto; }
.fpick-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.fpick-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.fpick-opt span { display: inline-flex; align-items: center; gap: 6px; }
.fpick-opt svg { color: var(--accent); }
.fpick-new, .fname-form input { width: 100%; margin-bottom: 12px; }
.fname-form input { margin-top: 10px; }
.root-hint { visibility: hidden; }
.drag-on .root-hint { visibility: visible; }
