/* ==========================================================================
   표준체계 개발 도우미 — Design System & UI Stylesheet (Senior Edition)
   배치: 머리(.top) → 단계 레일·현재 성취기준(.steps-wrap) → 작성 영역(#stage) | 가이드 코칭(#panel)
   ========================================================================== */
:root {
  --bg: #eceae4;
  --surface: #ffffff;
  --sunk: #f5f4f0;
  --sunk-2: #e6e3da;
  --rail-bg: #1d2b28;
  --rail-surface: #273b37;
  --rail-line: #344e49;
  --rail-ink: #e8efed;
  --rail-muted: #9eb3ad;
  --ink: #18211e;
  --ink-soft: #2c3835;
  --muted: #5a6662;
  --line: #dcd8ce;
  --line-strong: #c4bfb2;
  --accent: #1b5e57;
  --accent-hover: #144a44;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ee;
  --accent-ring: rgba(217, 119, 6, 0.24);
  --focus-border: #d97706;
  --focus-soft: #fef3c7;
  --mark: #f6dd8f;
  --mark-ink: #3a2c00;
  --err: #c02920;
  --err-soft: #fceceb;
  --warn: #8f5400;
  --warn-soft: #fdf2df;
  --ok: #1f7344;
  --ok-soft: #e2f3e8;
  --info: #2d5a8c;
  --info-soft: #e7eff9;
  --display: "Gowun Batang", "Nanum Myeongjo", "AppleMyungjo", serif;
  --body: "Pretendard Variable", "Pretendard", "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r-sm: 7px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 25, 23, 0.05);
  --shadow-sm: 0 2px 8px rgba(15, 25, 23, 0.06), 0 1px 2px rgba(15, 25, 23, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 25, 23, 0.09), 0 2px 6px rgba(15, 25, 23, 0.05);
  --shadow-lg: 0 16px 40px rgba(15, 25, 23, 0.14), 0 4px 12px rgba(15, 25, 23, 0.06);
  --gut: max(20px, env(safe-area-inset-left, 0px));
  --gutr: max(20px, env(safe-area-inset-right, 0px));
  --rail-h: 112px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1413;
    --surface: #151d1c;
    --sunk: #1c2625;
    --sunk-2: #24312f;
    --ink: #e5edeb;
    --ink-soft: #c8d6d3;
    --muted: #9aaca9;
    --line: #283634;
    --line-strong: #394b48;
    --accent: #74c4b9;
    --accent-hover: #89d1c7;
    --accent-ink: #0b1b19;
    --accent-soft: #1c3431;
    --accent-ring: rgba(116, 196, 185, 0.22);
    --mark: #c9a646;
    --mark-ink: #1d1600;
    --err: #ff8f86;
    --err-soft: #3a1d1b;
    --warn: #f0b54f;
    --warn-soft: #34280f;
    --ok: #82d3a0;
    --ok-soft: #16301f;
    --info: #9bbcec;
    --info-soft: #1b2a3d;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32), 0 1px 2px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1413;
  --surface: #151d1c;
  --sunk: #1c2625;
  --sunk-2: #24312f;
  --ink: #e5edeb;
  --ink-soft: #c8d6d3;
  --muted: #9aaca9;
  --line: #283634;
  --line-strong: #394b48;
  --accent: #74c4b9;
  --accent-hover: #89d1c7;
  --accent-ink: #0b1b19;
  --accent-soft: #1c3431;
  --accent-ring: rgba(116, 196, 185, 0.22);
  --mark: #c9a646;
  --mark-ink: #1d1600;
  --err: #ff8f86;
  --err-soft: #3a1d1b;
  --warn: #f0b54f;
  --warn-soft: #34280f;
  --ok: #82d3a0;
  --ok-soft: #16301f;
  --info: #9bbcec;
  --info-soft: #1b2a3d;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32), 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* ---------- 기본 타이포그래피 & 리셋 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 var(--body);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; letter-spacing: -0.015em; text-wrap: balance; }
h2 { font-size: 1.24rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
h3 .muted { font-weight: 400; margin-left: 6px; font-size: .84rem; }
h4 { font-size: .88rem; font-weight: 600; color: var(--muted); }
p { margin: 0; }
code, .code { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: .86rem; }
.lead { font-size: .98rem; font-weight: 500; line-height: 1.55; }

/* ---------- 버튼 & 입력 컨트롤 ---------- */
button, select, input, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-sm);
  padding: 8px 15px;
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.3;
  box-shadow: 0 1px 2px rgba(15, 25, 23, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease), filter .15s var(--ease);
}
button:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow: 0 3px 8px rgba(27, 89, 84, 0.2);
}
button:active:not(:disabled) { transform: translateY(0.5px); }
button:disabled { opacity: .38; cursor: default; box-shadow: none; }

button.ghost {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
button.ghost:hover:not(:disabled) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
  box-shadow: 0 2px 5px rgba(15, 25, 23, 0.07);
  filter: none;
}
button.ghost.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
button.small { padding: 5px 11px; font-size: .8rem; border-radius: 6px; }
button.danger { color: var(--err); border-color: var(--line-strong); background: var(--surface); box-shadow: none; }
button.danger:hover:not(:disabled) {
  background: var(--err-soft);
  border-color: var(--err);
  color: var(--err);
  filter: none;
  box-shadow: none;
}
button.icon {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 5px 9px;
  font-size: .8rem;
  font-weight: 500;
  border-radius: 6px;
  box-shadow: none;
}
button.icon:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--sunk);
  color: var(--ink);
  filter: none;
  box-shadow: none;
}
button.icon.danger:hover:not(:disabled) {
  color: var(--err);
  background: var(--err-soft);
  border-color: color-mix(in srgb, var(--err) 30%, transparent);
}
button.wide { width: 100%; justify-content: center; }

input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  min-width: 0;
  font-size: .92rem;
  box-shadow: inset 0 1px 2px rgba(15, 25, 23, 0.03);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
input:hover, select:hover, textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3.5px var(--accent-soft);
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.flashfield { box-shadow: 0 0 0 4px var(--mark) !important; transition: box-shadow .3s; }
@keyframes needPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--err) 45%, transparent); }
  55% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--err) 18%, transparent); }
  100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 28%, transparent); }
}
.need-input {
  border-color: var(--err) !important;
  background-color: var(--err-soft) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 26%, transparent) !important;
  animation: needPulse .65s ease-out 2;
}
.lv.need-input {
  padding: 6px 8px;
  border: 1.5px solid var(--err);
  border-radius: 9px;
}
.has-need > span:first-child { color: var(--err); font-weight: 700; }
.row.has-need {
  border-color: color-mix(in srgb, var(--err) 45%, var(--line));
  background: color-mix(in srgb, var(--err-soft) 45%, var(--surface));
}
.pager button.is-blocked {
  background: var(--err-soft);
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 42%, var(--line));
  box-shadow: none;
}
.pager button.is-blocked:hover {
  background: color-mix(in srgb, var(--err-soft) 75%, var(--err) 12%);
  border-color: var(--err);
  filter: none;
}

/* ---------- 상단 앱 헤더 (.top) ---------- */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 25, 23, 0.03);
}
.top-in {
  max-width: 1380px;
  margin: 0 auto;
  padding: 11px var(--gutr) 11px var(--gut);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
}
.brandbtn {
  all: unset;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color .15s var(--ease);
}
.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex: none;
  box-shadow: var(--shadow-xs);
}
.brandbtn:hover { color: var(--accent); }
.brandbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.crumb {
  flex: 1;
  min-width: 0;
  font-size: .86rem;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.works { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.works select { width: auto; max-width: 300px; padding-block: 6px; }
.save-state {
  font-size: .78rem;
  color: var(--muted);
  background: var(--sunk);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  min-width: 5.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.save-state.bad {
  color: var(--err);
  background: var(--err-soft);
  border-color: color-mix(in srgb, var(--err) 30%, transparent);
  font-weight: 600;
}
.works .save-state { flex-basis: auto; margin-right: 4px; text-align: left; min-width: 0; }
.works .save-state::before {
  content: '●';
  color: var(--ok, #16a34a);
  font-size: .65em;
  margin-right: 6px;
  vertical-align: middle;
}
.works .save-state.bad::before { color: var(--err); }

/* 드롭다운 메뉴 공통 */
.menu { position: relative; }
.menu summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 7px 13px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--surface);
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { border-color: var(--accent); margin-bottom: 0; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.menu-pop button {
  background: transparent;
  color: var(--ink);
  border: 0;
  box-shadow: none;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  font-weight: 400;
  white-space: normal;
}
.menu-pop button:hover { background: var(--sunk); filter: none; box-shadow: none; }
.menu-pop button.danger { color: var(--err); }
.menu-h { font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .05em; padding: 8px 10px 2px; }
.menu-h:first-child { padding-top: 4px; }

/* ---------- 단계 레일 (.steps-wrap) & 현재 성취기준 바 (.ctx) ---------- */
.steps-wrap {
  position: sticky;
  top: 0;
  z-index: 15;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(15, 25, 23, 0.04);
}
.steps {
  max-width: 1380px;
  margin: 0 auto;
  padding: 10px var(--gutr) 8px var(--gut);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  background: color-mix(in srgb, var(--surface) 60%, var(--sunk));
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease);
}
.step:hover:not(.locked) {
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-0.5px);
  filter: none;
}
.step.on {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgba(27, 89, 84, 0.12);
}
.step .n {
  flex: none;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 600;
  background: var(--sunk);
  color: var(--muted);
  border: 1px solid var(--line-strong);
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.step.st-ok:not(.on) {
  border-color: color-mix(in srgb, var(--ok) 25%, var(--line));
}
.step.st-ok .n {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
}
.step.on .n {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.step .tt {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: .88rem;
  line-height: 1.25;
}
.step .tt small {
  display: block;
  font-weight: 600;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .03em;
  margin-bottom: 2px;
}
.step.on .tt small { color: var(--accent); }
.dot {
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  font-style: normal;
  font-family: var(--mono);
}
.dot.ok { background: var(--ok-soft); color: var(--ok); }
.dot.warn { background: var(--warn-soft); color: var(--warn); }
.dot.err { background: var(--err-soft); color: var(--err); }

.ctx {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 75%, var(--sunk));
}
.ctx-in {
  max-width: 1380px;
  margin: 0 auto;
  padding: 7px var(--gutr) 8px var(--gut);
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: .86rem;
  min-width: 0;
}
.ctx-step {
  flex: none;
  font-size: .73rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
}
.ctx code {
  flex: none;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
}
.ctx-text {
  min-width: 0;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tag {
  flex: none;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--muted);
}
.tag.sample { background: var(--mark); color: var(--mark-ink); }

/* ---------- 본문 레이아웃 & 카드 시스템 ---------- */
.layout {
  max-width: 1380px;
  margin: 0 auto;
  padding: 22px var(--gutr) 48px var(--gut);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 368px;
  gap: 22px;
  align-items: start;
}
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
#stage { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.card.sub { padding: 14px 18px; gap: 10px; display: block; box-shadow: var(--shadow-xs); }
.card.sub > * + * { margin-top: 12px; }
.card.sub > summary { font-weight: 600; }
.empty {
  padding: 24px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--sunk);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  font-size: .9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.pager {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
}
.pager button { padding: 10px 18px; font-size: .92rem; }
.pager [data-act="next"] { margin-left: auto; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.g-name { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row-end { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.row-between { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { max-width: 240px; }
.list-head { padding: 4px 2px 0; }

/* ---------- 단계 머리 (.head) & 알림 배너 ---------- */
.head { padding: 4px 2px 2px; display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: .78rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; }
.eyebrow span { color: var(--muted); font-weight: 400; margin-left: 8px; letter-spacing: 0; }
.head h2 { font-family: var(--display); font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.goal { color: var(--ink-soft); font-size: .96rem; max-width: 68ch; }
.learn {
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 12px 18px;
  box-shadow: var(--shadow-xs);
}
.learn > summary { font-weight: 600; font-size: .92rem; }
.learn-body { padding: 6px 0 8px; }
.welcome {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--r);
  padding: 16px 20px;
}
.welcome h2 { font-family: var(--display); font-size: 1.15rem; margin-bottom: 4px; }
.welcome p { font-size: .9rem; max-width: 60ch; }
.sample-note {
  background: var(--mark);
  color: var(--mark-ink);
  border: 1px solid color-mix(in srgb, var(--mark-ink) 18%, transparent);
  border-radius: 10px;
  padding: 11px 16px;
  font-size: .88rem;
  box-shadow: var(--shadow-xs);
}

/* ---------- 폼 필드 (.fld) ---------- */
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > span {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.fld > span em { font-style: normal; font-weight: 400; margin-left: 4px; }
.req { color: var(--err); font-weight: 700; }
.mini-sel { width: auto; padding: 2px 8px; font-size: .76rem; margin-left: 6px; border-radius: 6px; }
.fld.nolabel > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fld.note input { font-size: .84rem; padding: 6px 10px; background: var(--sunk); border-color: var(--line); }
.fld.note input:focus { background: var(--surface); border-color: var(--accent); }
.fld.note > span { font-weight: 500; font-size: .75rem; }

details > summary { cursor: pointer; color: var(--accent); font-size: .9rem; font-weight: 600; }
details[open] > summary { margin-bottom: 10px; }
.callout {
  font-size: .87rem;
  line-height: 1.6;
  background: var(--info-soft);
  color: var(--ink);
  border-left: 4px solid var(--info);
  padding: 11px 14px;
  border-radius: 0 8px 8px 0;
}
.callout.warn { background: var(--warn-soft); border-left-color: var(--warn); }
.hintline { font-size: .82rem; color: var(--muted); line-height: 1.55; }
.okline {
  font-size: .87rem;
  font-weight: 500;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
  padding: 9px 12px;
  border-radius: 8px;
}
.errline {
  font-size: .85rem;
  font-weight: 500;
  background: var(--err-soft);
  color: var(--err);
  border: 1px solid color-mix(in srgb, var(--err) 25%, transparent);
  padding: 8px 12px;
  border-radius: 8px;
}

/* ---------- 0단계: 성취기준 선택 (.cascade) ---------- */
.cascade { display: grid; grid-template-columns: 1fr 1.1fr 1.3fr; gap: 12px; }
.cascade .fld:last-child { grid-column: 1 / -1; }
.cascade select { font-size: .95rem; font-weight: 500; }
.stepno {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  margin-right: 5px;
}
.metachips { display: flex; flex-wrap: wrap; gap: 6px; }
.metachips span {
  font-size: .8rem;
  font-weight: 500;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
}
.metachips i { font-style: normal; color: var(--muted); margin-right: 6px; font-size: .73rem; }
.stdline {
  font-size: 1.08rem;
  font-weight: 600;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--accent-soft) 40%, var(--sunk));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 9px;
}
.stdline code { color: var(--accent); margin-right: 8px; font-weight: 700; }
.commentary { font-size: .9rem; line-height: 1.65; background: var(--sunk); border-radius: 8px; padding: 12px 14px; }
.refbox > summary { font-size: .88rem; }

/* ---------- 1단계: 핵심요소 추출 (.concept, .item) ---------- */
.concept {
  padding: 0;
  gap: 0;
  overflow: hidden;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.c-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px 11px 10px;
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--sunk) 50%, var(--surface)) 100%);
  border-bottom: 1px solid var(--line);
}
.concept.closed .c-head { border-bottom-color: transparent; }
.fold {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--ink);
  border: 0;
  box-shadow: none;
  text-align: left;
  padding: 5px 8px;
  border-radius: 8px;
  white-space: normal;
}
.fold:hover { filter: none; background: var(--sunk); box-shadow: none; }
.fold::before { content: "▾"; color: var(--muted); font-size: .82rem; width: 1em; }
.concept.closed .fold::before { content: "▸"; }
.letter {
  flex: none;
  font-family: var(--mono);
  font-weight: 700;
  background: var(--mark);
  color: var(--mark-ink);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: .9rem;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}
.c-title { flex: 1; min-width: 0; font-weight: 700; font-size: 1.02rem; }
.c-meta { flex: none; font-size: .8rem; color: var(--muted); }
.tools { display: flex; gap: 4px; flex: none; }
.c-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.items-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
}
.items-head h4 { color: var(--ink); font-size: .95rem; font-weight: 700; }
.items { display: flex; flex-direction: column; gap: 12px; }
.item {
  border: 1px solid var(--line-strong);
  border-left: 3.5px solid var(--accent);
  border-radius: 10px;
  padding: 13px 15px;
  background: color-mix(in srgb, var(--sunk) 55%, var(--surface));
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-xs);
}
.item-top {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.item-top .code {
  flex: none;
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 6px;
}
.item-top .sent { flex: 1; min-width: 0; font-weight: 600; font-size: .95rem; }
.parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.parts .verb input { border-color: var(--accent); font-weight: 500; }
.evid > summary { font-size: .84rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--sunk);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .82rem;
  font-weight: 500;
  box-shadow: none;
}
.chip button { background: none; border: 0; box-shadow: none; color: var(--muted); padding: 0 2px; }
.chip button:hover { color: var(--err); box-shadow: none; filter: none; }
.chip.ins:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  filter: none;
  box-shadow: none;
}
button.add {
  background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface));
  color: var(--accent);
  border: 1.5px dashed var(--accent);
  box-shadow: none;
  font-weight: 600;
}
button.add:hover:not(:disabled) {
  background: var(--accent-soft);
  border-style: solid;
  filter: none;
  box-shadow: var(--shadow-xs);
}
button.add.big { padding: 11px 20px; font-size: .92rem; }
.sents { display: flex; flex-direction: column; gap: 6px; }
.sentbtn {
  text-align: left;
  white-space: normal;
  background: var(--sunk);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  box-shadow: none;
  font-weight: 400;
  font-size: .85rem;
  line-height: 1.55;
  padding: 8px 12px;
}
.sentbtn:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface);
  filter: none;
  box-shadow: var(--shadow-xs);
}
.sentbtn.used {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--muted);
}
.sentbtn.used::before { content: "✓ "; color: var(--accent); font-weight: 700; }

/* ---------- 2·3단계: 수준·유형 행 (.rows, .row) ---------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 10px;
  border-top: 1px solid var(--line);
  border-radius: 6px;
  transition: background-color .15s var(--ease);
}
.row:hover { background: color-mix(in srgb, var(--sunk) 45%, transparent); }
.row:first-child { border-top: 0; padding-top: 6px; }
.row-main { display: flex; gap: 10px; align-items: baseline; }
.row-main .code {
  flex: none;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: .78rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  min-width: 3em;
  text-align: center;
}
.row-main .s { flex: 1; min-width: 0; font-weight: 600; font-size: .96rem; }
.lvtag {
  flex: none;
  font-size: .76rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
}
.row-ctl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-left: calc(3em + 10px);
}
.row-ctl select { width: auto; min-width: 180px; max-width: 100%; font-weight: 500; }
.row .hintline, .row .mx, .row .errline { margin-left: calc(3em + 10px); }
.lv { display: flex; flex-wrap: wrap; gap: 6px; }
.tog input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tog span {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: .84rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.tog span:hover { border-color: var(--accent); background: var(--sunk); }
.tog input:checked + span {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(27, 89, 84, 0.2);
}
.tog input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.suggest {
  background: var(--surface);
  color: var(--info);
  border: 1px dashed var(--info);
  box-shadow: none;
  font-size: .81rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: normal;
  text-align: left;
}
.suggest small { color: var(--muted); font-weight: 400; margin-left: 5px; }
.suggest:hover { background: var(--info-soft); border-style: solid; filter: none; box-shadow: none; }

/* ---------- 표 (.tbl, table) ---------- */
.tbl {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--sunk) 40%, transparent); }
th {
  font-size: .77rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .03em;
  background: var(--sunk);
  border-bottom: 1px solid var(--line-strong);
}

/* ---------- 4단계: 평어 작성 (.rating, .lvl) ---------- */
.rating { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.rating-picker {
  padding: 16px 20px;
  gap: 12px;
  border-left: 4px solid var(--accent);
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--accent-soft) 18%, var(--surface)) 100%);
}
.rating-picker .fld { margin-top: 0; gap: 7px; }
.rating-picker .fld > span { justify-content: space-between; font-size: .85rem; font-weight: 700; color: var(--ink); }
.rating-picker .fld > span em {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
  margin-left: auto;
}
.rating-picker select {
  width: 100%;
  min-width: 0;
  font-size: .95rem;
  font-weight: 600;
  padding: 10px 12px;
  background: var(--surface);
  border-color: var(--line-strong);
  text-overflow: ellipsis;
}
.rating-picker .row-between { gap: 8px 12px; align-items: center; }
.rating-picker .btns { flex-shrink: 1; flex-wrap: wrap; gap: 6px; }
.rating-picker .btns button { padding: 6px 13px; font-size: .84rem; }

.rlist { padding: 8px; gap: 2px; position: sticky; top: calc(var(--rail-h) + 12px); max-height: calc(100vh - var(--rail-h) - 30px); overflow: auto; }
.rlist h4 { padding: 2px 6px 6px; }
.ritem { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; text-align: left; background: transparent; color: var(--ink); border: 1px solid transparent; padding: 7px 8px; white-space: normal; font-weight: 400; font-size: .84rem; }
.ritem:hover { background: var(--sunk); filter: none; }
.ritem.on { border-color: var(--accent); background: var(--accent-soft); }
.ritem code { color: var(--accent); font-size: .8rem; }
.prog { font-style: normal; font-family: var(--mono); font-size: .72rem; padding: 1px 6px; border-radius: 8px; background: var(--sunk); color: var(--muted); }
.prog.ok { background: var(--ok-soft); color: var(--ok); }
.prog.err { background: var(--err-soft); color: var(--err); }

.target {
  background: color-mix(in srgb, var(--sunk) 75%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.target .code { color: var(--accent); font-size: .84rem; font-weight: 700; }
.target .sent { font-weight: 700; font-size: 1.06rem; }
.kv {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-size: .83rem;
  padding-top: 6px;
  border-top: 1px dashed var(--line-strong);
}
.kv div { display: flex; gap: 6px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; }

.lvl {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px 14px 14px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--sunk) 28%, var(--surface));
}
.lvl-A { border-left-color: var(--ok); }
.lvl-B { border-left-color: var(--info); }
.lvl-C { border-left-color: var(--warn); }
.lvl-alt { border-left-color: var(--accent); }
.lvl-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lvl-tag {
  font-family: var(--display);
  font-size: .98rem;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 7px;
  text-align: center;
  background: var(--sunk);
  color: var(--ink);
}
.lvl-tag small { display: block; font-family: var(--body); font-size: .7rem; font-weight: 500; color: var(--muted); margin-top: 1px; }
.lvl-A .lvl-tag { color: var(--ok); background: var(--ok-soft); }
.lvl-B .lvl-tag { color: var(--info); background: var(--info-soft); }
.lvl-C .lvl-tag { color: var(--warn); background: var(--warn-soft); }
.lvl-alt .lvl-tag { color: var(--accent); background: var(--accent-soft); }

.checkbox-list { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.count { font-family: var(--mono); font-size: .8rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.count.ok { background: var(--ok-soft); color: var(--ok); }
.rchecks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.rchecks li { display: flex; gap: 8px; align-items: flex-start; font-size: .86rem; padding: 6px 10px; border-radius: 7px; border: 1px solid transparent; }
.rchecks li > span:nth-child(2), .rchecks li .check { flex: 1; }
.rchecks em { flex: none; font-style: normal; font-size: .72rem; font-weight: 600; color: var(--muted); padding-top: 2px; }
.rchecks .mark { flex: none; width: 18px; text-align: center; font-weight: 700; }
.rchecks .auto.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.rchecks .auto.ok .mark, .rchecks .auto.ok em { color: var(--ok); }
.rchecks .auto.bad { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 22%, transparent); }
.rchecks .auto.bad .mark, .rchecks .auto.bad em { color: var(--err); }

/* ---------- 5단계: 코드·결과 (.score, .result) ---------- */
.score { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sc {
  border-radius: 10px;
  padding: 13px 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
}
.sc b { font-family: var(--mono); font-size: 1.65rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc span { font-weight: 600; font-size: .88rem; }
.sc.err { background: var(--err-soft); color: var(--err); }
.sc.warn { background: var(--warn-soft); color: var(--warn); }
.sc.info { background: var(--info-soft); color: var(--info); }
.sc.chk { background: var(--accent-soft); color: var(--accent); }
.codegrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.codegrid input { font-family: var(--mono); font-weight: 600; text-align: center; text-transform: uppercase; }
.chkgroup { display: flex; flex-direction: column; gap: 8px; }
.chkgroup + .chkgroup { padding-top: 10px; border-top: 1px dashed var(--line); }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; cursor: pointer; }
.check.small { font-size: .8rem; color: var(--muted); }
.check input { flex: none; width: auto; margin-top: 4px; accent-color: var(--accent); box-shadow: none; }
.result .code { white-space: nowrap; color: var(--accent); font-size: .8rem; font-weight: 600; }
.result td.rt { min-width: 270px; }
.result td.rt p {
  display: grid;
  grid-template-columns: 2.7em minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  white-space: pre-line;
  line-height: 1.55;
}
.result td.rt p + p { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.result td.rt b {
  display: inline-block;
  min-width: 2.4em;
  color: var(--muted);
  background: var(--sunk);
  padding: 1px 5px;
  border-radius: 4px;
  text-align: center;
  font-weight: 700;
  font-size: .74rem;
}
.result .stcell select, .result .stcell input { width: 100%; min-width: 7.5em; font-size: .85em; }
.result .stcell input { margin-top: 4px; }
.proposed { text-decoration: underline dotted var(--warn); text-underline-offset: 3px; }

/* ---------- 가이드 코칭 패널 (#panel) ---------- */
.panel {
  position: sticky;
  top: calc(var(--rail-h) + 14px);
  max-height: calc(100vh - var(--rail-h) - 26px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.coach, .allcheck {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: var(--shadow-sm);
}
.coach { border-top: 4px solid var(--accent); }
.p-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.p-head h2 { font-family: var(--display); font-size: 1.12rem; font-weight: 700; }
.p-step { font-size: .74rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }
.coach h3 { font-size: .86rem; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.tally { display: flex; gap: 4px; }
.t { font-family: var(--mono); font-size: .76rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.t.err { background: var(--err-soft); color: var(--err); }
.t.warn { background: var(--warn-soft); color: var(--warn); }
.t.info { background: var(--info-soft); color: var(--info); }
.tip {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  font-size: .86rem;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tip h3 { font-size: .84rem; font-weight: 700; color: var(--accent); }
.tip ul { margin: 0; padding-left: 1.15em; display: flex; flex-direction: column; gap: 5px; line-height: 1.55; }
.tip .ex { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; font-size: .84rem; }
.tip .ex span { font-size: .7rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; margin-right: 6px; }
.mist > summary { font-size: .83rem; }
.mist ul { margin: 0; padding-left: 1.15em; font-size: .84rem; display: flex; flex-direction: column; gap: 4px; }
.grp { border-top: 1px solid var(--line); padding-top: 9px; }
.grp > summary { display: flex; justify-content: space-between; align-items: center; color: var(--ink); font-size: .86rem; font-weight: 600; list-style: none; }
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary::before { content: "▸"; color: var(--muted); margin-right: 6px; font-size: .75rem; }
.grp[open] > summary::before { content: "▾"; }
.grp > summary span:first-child { flex: 1; }
.grp .n { font-family: var(--mono); font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.grp .n.ok { background: var(--ok-soft); color: var(--ok); }
.grp .n.warn { background: var(--warn-soft); color: var(--warn); }
.grp .n.err { background: var(--err-soft); color: var(--err); }
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.iss {
  border-left: 3.5px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: var(--sunk);
  transition: transform .12s var(--ease);
}
.iss:hover { transform: translateX(2px); }
.iss.error { border-left-color: var(--err); background: var(--err-soft); }
.iss.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.iss.info { border-left-color: var(--info); background: var(--info-soft); }
.iss > button:first-child {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  box-shadow: none;
  padding: 8px 10px;
  white-space: normal;
  font-weight: 400;
  font-size: .84rem;
  line-height: 1.48;
}
.iss > button:first-child:hover { filter: none; box-shadow: none; text-decoration: underline; text-decoration-color: var(--line-strong); }
.sev { font-size: .72rem; font-weight: 700; padding-top: 2px; }
.iss.error .sev { color: var(--err); }
.iss.warn .sev { color: var(--warn); }
.iss.info .sev { color: var(--info); }
.mini { margin: 0 10px 8px; padding: 2px 8px; font-size: .74rem; background: var(--surface); color: var(--accent); border-color: var(--accent); box-shadow: none; }
.fab { display: none; }

/* ---------- 연수자료 (.training) ---------- */
.training { max-width: 1380px; margin: 0 auto; padding: 22px var(--gutr) 48px var(--gut); }
.tr-wrap { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 26px; align-items: start; }
.tr-toc {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.tr-toc h2 { font-family: var(--display); font-size: 1.28rem; }
.tr-toc .muted { margin-bottom: 6px; }
.tr-toc > button {
  display: flex;
  gap: 10px;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  box-shadow: none;
  white-space: normal;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 8px;
}
.tr-toc > button span { font-family: var(--mono); color: var(--muted); font-size: .8rem; font-weight: 600; padding-top: 1px; }
.tr-toc > button:hover { background: var(--sunk); filter: none; box-shadow: none; }
.tr-toc > button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.tr-toc > button.on span { color: var(--accent); }
.tr-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.ch {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 30px 34px;
  max-width: 940px;
  box-shadow: var(--shadow-sm);
}
.ch.on { display: block; }
.ch > h2 { font-family: var(--display); font-size: 1.62rem; margin: 2px 0 16px; }
.prose > * + * { margin-top: 13px; }
.prose h4 { color: var(--ink); font-size: 1rem; font-weight: 700; margin-top: 24px; }
.prose ol, .prose ul { margin: 8px 0 0; padding-left: 1.35em; display: flex; flex-direction: column; gap: 6px; }
.prose .tbl { margin-top: 10px; }
.prose li b { margin-right: 4px; }
.flow { counter-reset: f; list-style: none; padding-left: 0 !important; }
.flow li { counter-increment: f; position: relative; padding-left: 2.3em; }
.flow li::before {
  content: counter(f);
  position: absolute;
  left: 0;
  top: 2px;
  width: 1.65em;
  height: 1.65em;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 .78rem/1.65em var(--mono);
  text-align: center;
}
.phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.phase {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.phase b { font-family: var(--mono); color: var(--accent); font-size: .8rem; }
.phase strong { font-size: 1.02rem; }
.phase span { font-size: .84rem; color: var(--muted); }
.phase em { font-style: normal; font-size: .76rem; font-weight: 600; color: var(--accent); margin-top: 2px; }
.checklist li::marker { content: "□  "; }
.codeex { display: flex; flex-wrap: wrap; gap: 5px; }
.codeex span {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 10px 4px;
  border-radius: 7px;
  background: var(--sunk);
  border: 1px solid var(--line);
  min-width: 2.8em;
}
.codeex span.hl { background: var(--mark); color: var(--mark-ink); border-color: color-mix(in srgb, var(--mark-ink) 20%, transparent); }
.codeex b { font-family: var(--mono); font-weight: 700; }
.codeex i { font-style: normal; font-size: .68rem; opacity: .85; }
.practice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 24px !important;
}
.practice b { font-size: .92rem; color: var(--accent); }
.practice span { flex: 1 1 200px; font-size: .87rem; }
.ch-nav { display: flex; justify-content: space-between; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); margin-top: 26px !important; }
.ch-nav button { white-space: normal; text-align: left; }

.foot { max-width: 1380px; margin: 0 auto; padding: 0 var(--gutr) 30px var(--gut); color: var(--muted); font-size: .78rem; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 70;
  max-width: calc(100% - 32px);
}

/* ---------- 홈 · 로그인 · 프로젝트 현황판 ---------- */
button.link {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 2px 4px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  white-space: normal;
  text-align: left;
}
button.link:hover { text-decoration-color: var(--accent); filter: none; box-shadow: none; }
.home-in, .board-in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px var(--gutr) 56px var(--gut);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* 로그인 게이트 화면은 중앙 정렬 카드로 집중도 향상 */
.home-in:has(.card.login) {
  max-width: 560px;
  padding-top: 48px;
}
.hero h2 { font-family: var(--display); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 8px; }
.hero .fld { max-width: 360px; margin-top: 12px; }
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.roles:has(> :only-child) { grid-template-columns: minmax(0, 520px); }
.role, .pcard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  white-space: normal;
  padding: 20px;
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  font-weight: 400;
  box-shadow: var(--shadow-sm);
}
.role b, .pcard b { font-size: 1.06rem; font-weight: 700; color: var(--accent); }
.role span { color: var(--muted); font-size: .88rem; line-height: 1.55; }
.role:hover, .pcard:hover {
  border-color: var(--accent);
  filter: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.role.ghost b { color: var(--ink); }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.pmeter { width: 100%; height: 7px; border-radius: 999px; background: var(--sunk); overflow: hidden; }
.pmeter i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.chipck {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: .86rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
}
.chipck input { width: auto; margin: 0; accent-color: var(--accent); box-shadow: none; }
.chipck:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.wlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.wlist code { color: var(--muted); margin-right: 6px; }
.tally { display: flex; flex-wrap: wrap; gap: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button b { font-family: var(--mono); font-weight: 600; margin-left: 4px; }
.filters button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.bgroup { display: flex; flex-direction: column; gap: 12px; }
.bgroup > h3 { font-family: var(--display); font-size: 1.18rem; padding-top: 6px; }
.bdomain {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.bdomain > h4 { padding: 11px 18px; background: var(--sunk); color: var(--ink); display: flex; gap: 8px; align-items: baseline; border-bottom: 1px solid var(--line); }
.brow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px 210px 128px;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  border-left: 3.5px solid transparent;
  transition: background-color .15s var(--ease);
}
.brow:first-of-type { border-top: 0; }
.brow:hover { background: color-mix(in srgb, var(--sunk) 40%, transparent); }
.brow.st-changes { border-left-color: var(--err); }
.brow.st-requested { border-left-color: var(--info); }
.brow.st-agreed { border-left-color: var(--ok); }
.bmain { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.bmain code { flex: none; font-size: .8rem; font-weight: 600; color: var(--accent); }
.btext { font-size: .9rem; font-weight: 500; }
.bwho { display: flex; gap: 6px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.bwho label { flex: 1 1 0; min-width: 0; }
.bwho select { padding: 5px 8px; font-size: .82rem; }
.bwho b { color: var(--ink); font-weight: 600; }
.bstate { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.bact { display: flex; gap: 6px; justify-content: flex-end; }
.prog { display: flex; gap: 3px; }
.prog i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.prog i.on { background: var(--ok); }
.prog i.now { background: var(--mark); }
.chip.st-todo { color: var(--muted); }
.chip.st-s1, .chip.st-s2, .chip.st-s3, .chip.st-s4, .chip.st-s5 { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.st-ready { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.st-requested { background: var(--info-soft); border-color: transparent; color: var(--info); }
.chip.st-changes { background: var(--err-soft); border-color: transparent; color: var(--err); }
.chip.st-agreed { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.tally .chip b { font-family: var(--mono); font-weight: 600; }
.addlist { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; padding: 4px 2px; }
.check.done { opacity: .6; }
.mlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mlist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mlist li .muted { margin-left: auto; }
.warnbox { border-color: var(--mark); background: color-mix(in srgb, var(--mark) 14%, var(--surface)); }

/* ---------- 단계 잠금 · 하위 절차 (.substeps) · 공동 검토 ---------- */
.step.locked { opacity: .52; cursor: not-allowed; box-shadow: none; }
.step.locked .n { background: var(--sunk); color: var(--muted); }
.lockcard { border-style: dashed; }
.pager button:disabled { opacity: .6; background: var(--sunk); color: var(--muted); border-color: var(--line); white-space: normal; box-shadow: none; }
.substeps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; counter-reset: none; }
.substeps li {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 14px 5px 5px;
  font-size: .84rem;
  line-height: 1.3;
  color: var(--muted);
  box-shadow: var(--shadow-xs);
}
.substeps li b {
  flex: none;
  min-width: 28px;
  height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  background: var(--sunk);
  color: var(--muted);
}
.substeps li.done {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 28%, var(--line));
}
.substeps li.done b { background: var(--ok-soft); color: var(--ok); }
.substeps li.now {
  color: var(--ink);
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-xs);
}
.substeps li.now b { background: var(--accent); color: var(--accent-ink); }
.review { border-color: var(--info); border-left: 4px solid var(--info); }
.review .btns { align-items: center; }
.rlog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .86rem; border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------- 추천 후보 (.sg) ---------- */
.sg.card {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  border-left: 4px solid var(--accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 45%, var(--surface)) 0%, color-mix(in srgb, var(--accent-soft) 22%, var(--surface)) 100%);
  gap: 10px;
}
.sg.muted { padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: 9px; }
.inline-sg {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--sunk);
  border: 1px solid var(--line);
}
.sg-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: .84rem; }
.sg-h b { color: var(--accent); font-weight: 700; }
.sg-h span { color: var(--muted); font-size: .76rem; }
.sg-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sgc {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 13px;
  font-weight: 500;
  white-space: normal;
  text-align: left;
  box-shadow: var(--shadow-xs);
}
.sgc small { color: var(--muted); font-size: .73rem; font-weight: 400; }
.sgc:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  filter: none;
  box-shadow: var(--shadow-sm);
}
.sgc.small { font-size: .82rem; padding: 4px 11px; }
.sgc.nv { border-style: dashed; }
.sg-more summary { font-size: .82rem; color: var(--accent); cursor: pointer; }
.sg-more p { font-size: .84rem; margin-top: 6px; color: var(--muted); }

/* ---------- 반응형 미디어 쿼리 ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding-bottom: 76px; }
  .panel { position: static; max-height: none; }
  .codegrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .step .tt { font-size: .8rem; }
  body[data-view="work"] .fab {
    display: block;
    position: fixed;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    border-radius: 999px;
    padding: 11px 18px;
    box-shadow: var(--shadow-lg);
  }
  .tr-wrap { grid-template-columns: minmax(0, 1fr); }
  .tr-toc { position: static; }
}
@media (max-width: 900px) {
  .brow { grid-template-columns: minmax(0, 1fr) auto; }
  .bmain { grid-column: 1 / -1; }
  .bwho { grid-column: 1 / -1; }
  .roles { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --rail-h: 96px; --gut: max(14px, env(safe-area-inset-left, 0px)); --gutr: max(14px, env(safe-area-inset-right, 0px)); }
  .brand { font-size: 1.14rem; }
  .works { width: 100%; }
  .works select { flex: 1 1 100%; max-width: 100%; }
  .save-state { margin-left: auto; }
  .steps { display: flex; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .steps::-webkit-scrollbar { display: none; }
  .step { flex: none; padding: 6px 10px; }
  .step .tt { font-size: .8rem; }
  .ctx-in { font-size: .8rem; }
  .grid2, .g-name, .checks, .cascade, .phases { grid-template-columns: minmax(0, 1fr); }
  .parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rating { grid-template-columns: minmax(0, 1fr); }
  .rating-picker { padding: 14px; }
  .rlist { position: static; max-height: 220px; }
  .lvl { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .lvl-tag { padding-top: 4px; display: inline-block; width: fit-content; }
  .score { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .codegrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card { padding: 15px; }
  .c-body { padding: 15px; }
  .c-meta { display: none; }
  .row-ctl, .row .hintline, .row .mx, .row .errline { padding-left: 0; margin-left: 0; }
  .head h2 { font-size: 1.34rem; }
  .ch { padding: 20px 16px; }
  .pager button { white-space: normal; }
  .home-in:has(.card.login) { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- 인쇄 스타일 (@media print) ---------- */
@media print {
  .top, .steps-wrap, .panel, .pager, .foot, .toast, .fab, .btns, .sample-note, .welcome, .head, .ai-card, .review, .substeps { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .layout { display: block; padding: 0; }
  .card { border: 0; padding: 0; box-shadow: none; }
  .tbl { overflow: visible; border: 0; }
  table { font-size: 9pt; }
  th { background: #eee !important; }
  .result .stcell select,
  .result .stcell input {
    border: 0;
    background: transparent;
    padding: 0;
    min-width: 0;
    box-shadow: none;
    color: inherit;
    font-size: inherit;
    appearance: none;
    -webkit-appearance: none;
  }
  .result .stcell select::-ms-expand { display: none; }
  .result .stcell input { margin-top: 2px; }
  .result .stcell input::placeholder { color: transparent; }
  body[data-print="result"] #stage > *:not(:has(.result)) { display: none !important; }
  body[data-print="training"] #work { display: none !important; }
  body[data-print="training"] #training { display: block !important; padding: 0; }
  .tr-toc, .practice, .ch-nav { display: none !important; }
  .tr-wrap { display: block; }
  .ch { display: block !important; border: 0; padding: 0; max-width: none; box-shadow: none; break-after: page; }
  .callout, .phase, .codeex span { border: 1px solid #ccc; }
}
.result th, .result td:nth-child(4), .result td:nth-child(5) { white-space: nowrap; }

/* ---------- 검색 · 작성 현황 · 용어 설명 ---------- */
.search-results { max-height: 360px; overflow-y: auto; margin: 10px 0; }
.search-hit { display: flex; flex-direction: column; width: 100%; gap: 5px; white-space: normal; text-align: left; color: var(--ink); background: var(--surface); border-color: var(--line); margin-bottom: 6px; padding: 12px; }
.search-hit:hover { background: var(--accent-soft); }
.search-hit small { color: var(--muted); font-weight: 400; }
.progress-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.progress-stats span {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: .87rem;
  font-weight: 500;
}
.progress-stats b { color: var(--accent); margin-left: 5px; font-family: var(--mono); }
.glossary { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; line-height: 1.7; }
.glossary dt { font-weight: 700; color: var(--accent); }
.glossary dd { margin: 0; }
@media (max-width: 768px) { .glossary { grid-template-columns: 1fr; gap: 5px; } .glossary dd { margin-bottom: 10px; } .toast { bottom: 76px; } }
@media print { .task-overview { display: none !important; } }

.browse-standards { padding-top: 14px; border-top: 1px solid var(--line); margin-top: 14px; }
.browse-standards > summary { cursor: pointer; color: var(--accent); }
.browse-standards[open] .cascade { margin-top: 8px; }

/* ---------- 내 작업 슬라이드오버 패널 (.wdlg) ---------- */
.wdlg {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(540px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: -16px 0 40px rgba(15, 25, 23, 0.18);
  overflow-y: auto;
  padding: 22px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wdlg:focus { outline: none; }
.wdlg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(15, 23, 22, 0.42);
  backdrop-filter: blur(2px);
}
.wd-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.wd-head h2 { font-size: 1.25rem; margin: 0; font-family: var(--display); }
.wd-new { width: 100%; min-height: 44px; font-size: .94rem; }
.wdlg > p.muted { margin: -2px 0 4px; font-size: .85rem; }
.wd-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.wd-filter button { padding: 5px 13px; border-radius: 999px; font-size: .84rem; }
.wd-filter button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.wlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wcard {
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.wcard:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.wcard.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 22%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-xs);
}
.wopen { all: unset; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.wopen:hover .wc-text { color: var(--accent); }
.wopen:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.wc-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.wc-top code { color: var(--accent); font-weight: 700; font-size: .86rem; }
.wc-text { line-height: 1.5; color: var(--ink); font-weight: 500; }
.wc-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .8rem; }
.wcard .btns { justify-content: flex-end; margin: 0; padding-top: 6px; border-top: 1px dashed var(--line); }
.wcard .btns button { padding: 4px 10px; font-size: .8rem; }
.wd-empty { padding: 16px; background: var(--sunk); border: 1px dashed var(--line-strong); border-radius: var(--r); text-align: center; }
.wd-samples { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.wd-samples h3 { font-size: .96rem; margin: 0; }
.wd-samples h3 .muted { font-weight: 400; font-size: .8rem; margin-left: 6px; }
.wd-note { font-size: .82rem; }
@media print { .wdlg, .wdlg-backdrop { display: none !important; } }

/* ---------- 출력하기(한글·엑셀·PDF) 메뉴 ---------- */
.outmenu > summary {
  padding: 8px 15px;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.3;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 25, 23, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: filter .15s var(--ease), box-shadow .15s var(--ease);
}
.outmenu > summary:hover { filter: brightness(1.07); box-shadow: 0 3px 8px rgba(27, 89, 84, 0.2); }
.outmenu[open] > summary { box-shadow: 0 0 0 3px var(--accent-soft); }
.outmenu .out-pop {
  width: 312px;
  max-width: calc(100vw - 32px);
  padding: 15px;
  gap: 12px;
  border-radius: calc(var(--r) + 2px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
}
.out-pop .menu-h { padding: 0 2px; font-size: .78rem; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.out-fmts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.out-pop .out-fmt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 6px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--sunk);
  text-align: center;
  font-size: .84rem;
  font-weight: 500;
  color: var(--muted);
  box-shadow: none;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.out-pop .out-fmt:hover {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
  filter: none;
}
.out-pop .out-fmt.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--accent);
}
.out-pop .out-fmt.on:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); transform: none; }
.out-ic {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 52px;
  border-radius: 5px 13px 5px 5px;
  color: #fff;
  font-family: var(--mono);
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .03em;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .14);
  overflow: hidden;
}
.out-ic::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, .28);
  border-bottom-left-radius: 4px;
}
.out-hwpx { background: #245fc9; }
.out-xlsx { background: #1f7a45; }
.out-pdf { background: #c62d26; }
.out-btns { display: flex; justify-content: flex-end; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.out-pop .out-btns button {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: .84rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
}
.out-pop .out-btns button.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.out-pop .out-btns button.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--sunk); filter: none; }
.out-pop .out-btns button:not(.ghost) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.out-pop .out-btns button:not(.ghost):hover { background: var(--accent); filter: brightness(1.07); }
@media (max-width: 540px) {
  .outmenu .out-pop { left: 0; right: auto; width: min(312px, calc(100vw - 44px)); }
}

/* ---------- 구독 AI 연동 (js/ai-assist.js) ---------- */
.ai-card {
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent);
  background: var(--surface);
  padding: 16px 20px;
}
.ai-card > details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  color: var(--ink);
  padding: 2px 0;
  user-select: none;
}
.ai-card > details > summary::-webkit-details-marker { display: none; }
.ai-card > details > summary::before { content: "▸"; color: var(--accent); font-size: .82rem; width: 1em; flex: none; }
.ai-card > details[open] > summary::before { content: "▾"; }
.ai-card > details[open] > summary { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ai-card > details > summary b { font-size: .96rem; font-weight: 700; color: var(--accent); }
.ai-card > details > summary .muted { font-size: .81rem; font-weight: 400; color: var(--muted); }
.ai-card > details > p.muted { font-size: .86rem; line-height: 1.58; margin-top: 10px; }
.ai-card > details > summary + p.muted { margin-top: 0; }
.ai-card .btns { margin: 8px 0 10px; gap: 8px; }
.ai-auto-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 15px;
  margin: 0 0 14px;
  border-radius: 10px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
  box-shadow: var(--shadow-xs);
}
.ai-auto-info { display: flex; flex-direction: column; gap: 4px; }
.ai-auto-info b { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .92rem; color: var(--ink); }
.ai-auto-info .muted { font-size: .83rem; line-height: 1.52; margin: 0; }
.ai-auto-box .btns { margin: 2px 0 0; }
#ai-paste {
  width: 100%;
  min-height: 112px;
  margin: 8px 0 4px;
  padding: 10px 12px;
  background: var(--sunk);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.55;
  color: var(--ink);
}
#ai-paste:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); }
#ai-paste::placeholder { font-family: var(--body); color: var(--muted); }
.ai-card .hintline { background: var(--err-soft); color: var(--err); border-left: 3px solid var(--err); padding: 8px 12px; border-radius: 0 7px 7px 0; font-size: .84rem; margin: 6px 0; }
.ai-card .muted.small { font-size: .78rem; color: var(--muted); margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); line-height: 1.5; }
.ai-remote {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--info) 45%, var(--line));
  border-left: 4px solid var(--info);
  border-radius: 0 8px 8px 0;
  padding: 12px 14px;
  margin: 4px 0 12px;
  background: var(--info-soft);
  color: var(--ink);
}
.ai-remote b { font-size: .9rem; color: var(--info); }
.ai-remote p { font-size: .86rem; color: var(--ink); line-height: 1.5; }
.ai-remote .btns { margin: 2px 0 0; }
.ai-review { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.ai-review > p { font-size: .88rem; line-height: 1.5; }
.ai-review .okline,
.ai-review .t { display: inline-block; padding: 1px 7px; border-radius: 999px; font-family: var(--mono); font-size: .76rem; font-weight: 700; vertical-align: baseline; }
.ai-diff { max-height: 420px; overflow: auto; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.ai-diff table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.ai-diff th, .ai-diff td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; line-height: 1.5; }
.ai-diff th { position: sticky; top: 0; z-index: 1; background: var(--sunk); color: var(--muted); font-size: .76rem; font-weight: 700; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.ai-diff tbody tr:last-child td { border-bottom: 0; }
.ai-diff tbody tr:nth-child(even) { background: color-mix(in srgb, var(--sunk) 50%, var(--surface)); }
.ai-diff td:nth-child(1), .ai-diff td:nth-child(2) { white-space: nowrap; color: var(--muted); font-size: .8rem; }
.ai-diff td:nth-child(3) { color: var(--muted); }
.ai-diff td:nth-child(4) { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.ai-diff td:nth-child(4) b { font-weight: 700; color: var(--ink); }
.ai-diff > .muted { padding: 8px 10px; border-top: 1px solid var(--line); background: var(--sunk); }
.ai-review details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--sunk); }
.ai-review details > summary { font-size: .84rem; font-weight: 600; }
.ai-review .issues li { font-size: .83rem; line-height: 1.45; padding: 6px 10px; border-radius: 0 6px 6px 0; border-left: 3px solid var(--line); background: var(--surface); }
.ai-review .issues li.error { border-left-color: var(--err); background: var(--err-soft); color: var(--err); }
.ai-review .issues li.warn { border-left-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.ai-review .btns { margin: 2px 0 0; }
@media (max-width: 768px) {
  .ai-card { padding: 14px; }
  .ai-card button, .ai-auto-box button, .rating-picker .btns button, .sg .row-between button { white-space: normal; text-align: left; }
}

/* ---------- 학년군별 내용 체계 위계 표 (.cs-table) ---------- */
.cs-details > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.cs-details > summary .muted { font-weight: 400; font-size: .78rem; color: var(--muted); }
.cs-tbl-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); }
.cs-table { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; font-size: .84rem; }
.cs-table th, .cs-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 10px 12px; vertical-align: top; text-align: left; }
.cs-table th:last-child, .cs-table td:last-child { border-right: 0; }
.cs-table tbody tr:last-child th, .cs-table tbody tr:last-child td { border-bottom: 0; }
.cs-table thead th {
  background: var(--sunk);
  color: var(--ink);
  font-weight: 700;
  font-size: .82rem;
  border-bottom: 1.5px solid var(--line-strong);
  white-space: nowrap;
}
.cs-table .cs-corner { width: 92px; color: var(--muted); font-size: .76rem; }
.cs-table .cs-cat {
  width: 92px;
  background: color-mix(in srgb, var(--sunk) 65%, var(--surface));
  color: var(--accent);
  font-weight: 700;
  font-size: .84rem;
  white-space: nowrap;
}
.cs-table thead th.cs-cur {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 3px 0 var(--accent);
}
.cs-table td.cs-cur {
  background: color-mix(in srgb, var(--accent-soft) 28%, var(--surface));
}
.cs-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .7rem;
  font-weight: 600;
  vertical-align: middle;
}
.cs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cs-list li {
  position: relative;
  padding: 4px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--sunk) 55%, var(--surface));
  border: 1px solid var(--line);
  line-height: 1.42;
  color: var(--ink);
  word-break: keep-all;
}
.cs-list li.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.cs-list li.on::before {
  content: "✓ ";
  font-weight: 700;
}
.cs-empty { color: var(--muted); text-align: center !important; vertical-align: middle !important; }
.cs-hint { font-size: .79rem; margin-top: 6px; }

/* ---------- Google 로그인 ---------- */
.card.login {
  max-width: 560px;
  border-top: 4px solid var(--accent);
  padding: 22px 24px;
}
.home-in:has(.card.login) .roles:has(> :only-child) {
  grid-template-columns: minmax(0, 560px);
}
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 11px 22px;
  border-radius: 9px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: .96rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease);
}
.google-btn:hover:not(:disabled) {
  background: var(--sunk);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-0.5px);
  filter: none;
}
.google-btn:active:not(:disabled) { transform: translateY(0.5px); }
.google-btn svg { flex: none; }

/* ==========================================================================
   Hybrid A+C — 에디토리얼 원고 데스크 (3층 명도 분리 + 작성 도우미 + 집중 모드)
   ========================================================================== */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: none; padding: 9px 18px; }
.top-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.brand { font-size: 1.15rem; font-family: var(--body); font-weight: 800; letter-spacing: -0.025em; }
.crumb-sep { width: 1px; height: 20px; background: var(--line-strong); flex: none; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--sunk);
  border: 1px solid var(--line);
  font-size: .8rem;
  color: var(--muted);
}
.crumb[hidden] { display: none !important; }
.crumb .crumb-arrow { color: var(--line-strong); font-weight: 600; }
.crumb .link { font-size: .8rem; color: var(--muted); font-weight: 500; }
.crumb .link.cur { color: var(--accent); font-weight: 700; }

.jump-missing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--err-soft);
  color: var(--err);
  border: 1px solid color-mix(in srgb, var(--err) 38%, transparent);
  font-size: .8rem;
  font-weight: 700;
  box-shadow: none;
}
.jump-missing:hover { background: color-mix(in srgb, var(--err-soft) 72%, var(--err) 14%); border-color: var(--err); filter: none; }
.jump-missing .jm-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--err); display: inline-block; }

/* 3단 에디토리얼 원고 데스크 */
#work.desk {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: calc(100vh - 54px);
  align-items: stretch;
}
#work.desk[hidden] { display: none; }

/* 1층: 좌측 다크 단계 레일 */
#work.desk .steps-wrap {
  position: sticky;
  top: 54px;
  height: calc(100vh - 54px);
  overflow-y: auto;
  background: var(--rail-bg);
  color: var(--rail-ink);
  border-bottom: 0;
  border-right: 1px solid #13201d;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: none;
  z-index: 15;
}
#work.desk .steps {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#work.desk .step {
  width: 100%;
  background: transparent;
  color: var(--rail-muted);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 10px;
  text-align: left;
  box-shadow: none;
}
#work.desk .step:hover { background: rgba(255, 255, 255, 0.06); color: var(--rail-ink); border-color: rgba(255, 255, 255, 0.08); }
#work.desk .step .n { background: rgba(255, 255, 255, 0.1); color: var(--rail-ink); }
#work.desk .step .tt { color: inherit; font-size: .86rem; }
#work.desk .step .tt small { color: var(--rail-muted); }
#work.desk .step.on {
  background: var(--rail-surface);
  color: #ffffff;
  border-color: var(--rail-line);
  box-shadow: inset 3px 0 0 #f59e0b;
}
#work.desk .step.on .n { background: #d97706; color: #ffffff; }
#work.desk .step.on .tt small { color: #fcd34d; }
#work.desk .step.st-ok:not(.on) .n { background: #1b5e57; color: #ffffff; }
#work.desk .step.locked { opacity: .62; }
#work.desk .step .dot { background: rgba(255, 255, 255, 0.14); color: #fff; }
#work.desk .step .dot.err { background: #dc2626; color: #fff; }
#work.desk .step .dot.warn { background: #d97706; color: #fff; }

.rail-progress {
  padding-top: 14px;
  border-top: 1px solid var(--rail-line);
  font-size: .78rem;
  color: var(--rail-muted);
}
.rp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rp-head b { color: #ffffff; font-family: var(--mono); }
.rp-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.rp-bar i { display: block; height: 100%; background: #34d399; border-radius: 999px; transition: width .25s var(--ease); }
.rp-sub { margin-top: 6px; font-size: .74rem; color: var(--rail-muted); }

/* 가운데 + 우측 작성 도우미 */
#work.desk .layout {
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 364px;
  gap: 0;
  align-items: stretch;
  transition: grid-template-columns .2s var(--ease);
}
body.dock-collapsed #work.desk .layout {
  grid-template-columns: minmax(0, 1fr) 76px;
}
#work.desk .main-col {
  padding: 20px 24px 52px;
  background: var(--bg);
  min-width: 0;
}
.canvas-wrap {
  max-width: 840px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: max-width .2s var(--ease);
}
.canvas-wrap > * { min-width: 0; max-width: 100%; }
body.dock-collapsed .canvas-wrap { max-width: 1140px; }

/* 2단 성취기준 타이틀 바 (#ctx) */
#work.desk .ctx {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 16px;
}
#work.desk .ctx-in {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: stretch;
}
.ctx-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.ctx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); }
.ctx-path { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--muted); }
.ctx-path b { color: var(--ink); font-weight: 700; }
.ctx-gt { color: var(--line-strong); margin: 0 2px; font-weight: 700; }
.ctx-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ctx-switch {
  width: auto;
  max-width: 240px;
  min-width: 0;
  padding: 5px 10px;
  font-size: .8rem;
  font-weight: 600;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.ctx-dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 700;
  background: var(--surface);
  color: var(--ink-soft);
  border: 1.5px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.ctx-dock-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  filter: none;
}
.ctx-dock-btn.is-open-cta {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.ctx-dock-btn.is-open-cta:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
  border-color: var(--accent-hover);
}
.ctx-std { display: flex; align-items: flex-start; gap: 9px; }
.ctx-std code {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .8rem;
  font-weight: 700;
  margin-top: 2px;
}
#work.desk .ctx-text {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: .98rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
  word-break: keep-all;
}

/* 3층: 순백 핵심 작성 캔버스 & 포커스 강조 */
#work.desk #stage .card.concept { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
#work.desk #stage .card.concept:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}
#work.desk input:focus, #work.desk select:focus, #work.desk textarea:focus {
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3.5px var(--focus-soft);
}
/* 참고 카드들은 보조 표면 톤으로 낮춰 작성 카드와 위계 분리 */
#work.desk #stage .task-overview,
#work.desk #stage .refbox,
#work.desk #stage .sg.card,
#work.desk #stage .ai-card {
  background: var(--sunk);
  border-color: var(--line);
}

/* 2층: 우측 작성 도우미 (#panel) */
#work.desk .panel {
  position: sticky;
  top: 54px;
  max-height: calc(100vh - 54px);
  overflow-y: auto;
  background: var(--sunk);
  border-left: 1px solid var(--line);
  padding: 14px;
  gap: 12px;
}
.dock-slim { display: none; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; }
body.dock-collapsed #work.desk .panel { padding: 12px 7px; overflow: visible; }
body.dock-collapsed .dock-full { display: none; }
body.dock-collapsed .dock-slim { display: flex; }
.dock-ic {
  position: relative;
  width: 60px;
  padding: 10px 4px 8px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.1;
  box-shadow: var(--shadow-xs);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.dock-ic:hover, .dock-ic.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); filter: none; }
.dock-ic-open { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.dock-ic-open:hover { background: var(--accent-hover); color: var(--accent-ink); border-color: var(--accent-hover); }
.dock-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.dock-close-btn:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); filter: none; }
.dock-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--err);
  color: #fff;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.dock-full { display: flex; flex-direction: column; gap: 12px; }
.dock-bar {
  margin: -14px -14px 2px;
  padding: 12px 15px;
  background: color-mix(in srgb, var(--sunk-2) 65%, var(--sunk));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dock-brand { display: inline-flex; align-items: center; gap: 8px; }
.dock-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--accent);
  color: #f6d782;
  display: grid;
  place-items: center;
  flex: none;
}
.dock-title { font-size: .92rem; font-weight: 800; color: var(--ink); letter-spacing: -0.015em; }
.dock-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--sunk-2);
}
.dock-tabs button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 7px;
  padding: 6px 4px;
  font-size: .78rem;
  font-weight: 600;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
.dock-ai { display: flex; flex-direction: column; gap: 12px; }
.dock-ai-card {
  padding: 14px;
  border-radius: var(--r);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dock-ai-card h3 { font-size: .86rem; font-weight: 800; color: var(--accent-hover); margin: 0; }
.dock-ai-ext {
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.dock-ai-ext h3 { font-size: .86rem; font-weight: 800; color: var(--ink); margin: 0; }
.dock-ai-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.dock-ai-grid button { padding: 7px 4px; font-size: .78rem; justify-content: center; }
.dock-tabs button:hover { color: var(--ink); filter: none; }
.dock-tabs button.on { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: var(--shadow-xs); }
.dock-pane { display: flex; flex-direction: column; gap: 12px; }
.dock-pane[hidden] { display: none; }
.dock-ref {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dock-ref .commentary { font-size: .86rem; line-height: 1.65; color: var(--ink-soft); white-space: pre-line; }
#work.desk .coach, #work.desk .allcheck { background: var(--surface); box-shadow: none; }

@media (max-width: 1100px) {
  #work.desk { display: block; min-height: auto; }
  #work.desk .steps-wrap {
    position: sticky;
    top: 52px;
    height: auto;
    padding: 8px var(--gutr) 8px var(--gut);
    border-right: 0;
    border-bottom: 1px solid #13201d;
  }
  #work.desk .steps { flex-direction: row; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  #work.desk .steps::-webkit-scrollbar { display: none; }
  #work.desk .step { width: auto; flex: none; padding: 6px 10px; }
  .rail-progress, .ctx-dock-btn, .dock-bar, .dock-slim { display: none !important; }
  body.dock-collapsed .dock-full { display: flex !important; }
  #work.desk .layout, body.dock-collapsed #work.desk .layout { grid-template-columns: minmax(0, 1fr); }
  #work.desk .main-col { padding: 14px var(--gutr) 24px var(--gut); }
  #work.desk .panel { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line); padding: 14px var(--gutr) 84px var(--gut); }
}
@media (max-width: 768px) {
  .top-in { padding: 9px 14px; }
  .crumb-sep { display: none; }
  .ctx-switch { max-width: 100%; width: 100%; }
  .ctx-actions { width: 100%; }
}
@media print {
  #work.desk { display: block !important; }
  #work.desk .steps-wrap, #work.desk .panel, .ctx-actions, .jump-missing, .crumb-sep { display: none !important; }
  #work.desk .layout { display: block !important; }
  #work.desk .main-col { padding: 0 !important; background: #fff !important; }
  .canvas-wrap { max-width: none !important; }
}

.ai-connect { margin: .5rem 0; }
.ai-conn-url { display: flex; gap: .4rem; margin: .4rem 0; }
.ai-conn-url input { flex: 1; min-width: 0; }
.ai-conn-steps li { margin: .35rem 0; }

/* 상단 헤더: 홈(아이콘·연한 강조) | 내 작업·연수자료 | 성명 · 로그아웃(글자 버튼) */
.works .hdr-home {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent);
  box-shadow: none; font-weight: 600;
}
.works .hdr-home:hover:not(:disabled) { background: color-mix(in srgb, var(--accent-soft) 60%, var(--accent) 12%); filter: none; }
.works .hdr-home svg { flex: none; }
.works .hdr-sep { width: 1px; height: 22px; background: var(--line-strong); flex: none; margin: 0 2px; }
.works .hdr-sep[hidden], .works .hdr-who[hidden], .works .hdr-logout[hidden] { display: none; }
.works .hdr-who { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.works .hdr-logout {
  background: transparent; border: 0; box-shadow: none; color: var(--muted);
  padding: 6px 4px; font-size: .82rem; text-decoration: underline; text-underline-offset: 3px;
}
.works .hdr-logout:hover:not(:disabled) { color: var(--ink); background: transparent; filter: none; }
@media (max-width: 760px) {
  .works .hdr-sep { display: none; }
  .works .hdr-who { display: none; }
}