/* ===== 물결 (Mulgyeol) base — JIA design tokens + Console. Preserved from styles.css ===== */
/* 물결 (Mulgyeol) — jia web UI. Jeju-inspired OKLCH tokens from docs/Design Guide.html. */
/* Self-hosted woff2 with Latin + full Korean Hangul subset (~5MB total).
   See fonts/convert.py for the subsetting recipe and source attribution. */
@font-face {
  font-family: "Noto Sans KR";
  src: url("./fonts/noto-sans-kr-vf.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("./fonts/georgia-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./fonts/cascadia-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./fonts/cascadia-code-600.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gothic A1";
  src: url("./fonts/nanum-barun-gothic-400.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gothic A1";
  src: url("./fonts/nanum-barun-gothic-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans KR";
  src: url("./fonts/nanum-barun-gothic-400.woff2") format("woff2");
  font-weight: 400 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif KR";
  src: url("./fonts/noto-serif-kr-vf.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nanum Myeongjo";
  src: url("./fonts/nanum-myeongjo-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nanum Myeongjo";
  src: url("./fonts/nanum-myeongjo-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gowun Dodum";
  src: url("./fonts/nanum-barun-gothic-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jua";
  src: url("./fonts/jua-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Do Hyeon";
  src: url("./fonts/do-hyeon-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  --font-sans: "Noto Sans KR", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  /* serif/mono stacks include "Noto Sans KR" so Korean text inside serif or mono
     surfaces stays in our self-hosted face instead of an OS-generic fallback. */
  --font-serif: "Instrument Serif", "Noto Serif KR", "Noto Sans KR", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Noto Sans KR", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: var(--font-sans);
  --serif: var(--font-serif);
  --mono: var(--font-mono);

  --bg:        #FAFAF8;
  --bg-2:      oklch(0.965 0.006 96);
  --surface:   oklch(1 0 0);
  --surface-2: oklch(0.976 0.005 96);
  --line:      oklch(0.92 0.008 96);
  --line-2:    oklch(0.865 0.012 96);
  --surface-3: oklch(0.955 0.006 100);
  --ink:       oklch(0.20 0.010 82);
  --ink-2:     oklch(0.38 0.009 84);
  --ink-3:     oklch(0.55 0.008 88);
  --ink-4:     oklch(0.70 0.007 92);
  --primary:   oklch(0.50 0.10 225);
  --primary-2: oklch(0.42 0.11 230);
  --primary-ink: oklch(0.99 0 0);
  --primary-soft: oklch(0.957 0.026 220);
  --primary-line: oklch(0.81 0.072 220);
  --accent:    oklch(0.78 0.08 215);
  --sand:      oklch(0.78 0.13 70);
  --moss:      oklch(0.58 0.06 165);
  --warn:      oklch(0.68 0.13 60);
  --warn-2:    oklch(0.52 0.14 48);
  --warn-soft: oklch(0.962 0.046 72);
  --warn-line: oklch(0.83 0.10 64);
  --ok:        oklch(0.60 0.13 150);
  --ok-soft:   oklch(0.955 0.046 150);
  --error:     oklch(0.55 0.16 25);
  --shadow: 0 20px 60px oklch(0.20 0.04 235 / 0.08), 0 2px 8px oklch(0.20 0.02 235 / 0.05);
  --shadow-sm: 0 1px 2px oklch(0.3 0.03 235 / .07), 0 2px 5px oklch(0.3 0.03 235 / .05);
  --shadow-md: 0 2px 6px oklch(0.3 0.03 235 / .07), 0 8px 24px oklch(0.3 0.03 235 / .09);
  --shadow-lg: 0 8px 24px oklch(0.3 0.03 235 / .12), 0 24px 60px oklch(0.3 0.03 235 / .16);
  --r: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --radius: 8px;
  --max: 1280px;
}

:root[data-theme="dark"] {
  --bg:        oklch(0.16 0.012 240);
  --bg-2:      oklch(0.19 0.014 240);
  --surface:   oklch(0.22 0.015 238);
  --surface-2: oklch(0.25 0.016 238);
  --line:      oklch(0.32 0.018 235);
  --line-2:    oklch(0.40 0.020 235);
  --surface-3: oklch(0.295 0.015 258);
  --ink:       oklch(0.97 0.005 220);
  --ink-2:     oklch(0.82 0.010 220);
  --ink-3:     oklch(0.66 0.012 225);
  --ink-4:     oklch(0.50 0.014 230);
  --primary:   oklch(0.78 0.10 220);
  --primary-2: oklch(0.85 0.08 215);
  --primary-ink: oklch(0.16 0.02 258);
  --primary-soft: oklch(0.31 0.05 222);
  --primary-line: oklch(0.43 0.07 220);
  --accent:    oklch(0.70 0.10 210);
  --sand:      oklch(0.80 0.13 80);
  --moss:      oklch(0.66 0.08 165);
  --warn:      oklch(0.80 0.13 80);
  --warn-2:    oklch(0.85 0.10 72);
  --warn-soft: oklch(0.31 0.058 58);
  --warn-line: oklch(0.46 0.085 62);
  --ok:        oklch(0.74 0.12 150);
  --ok-soft:   oklch(0.31 0.055 150);
  --error:     oklch(0.66 0.17 25);
  --shadow: 0 22px 70px oklch(0.08 0.02 240 / 0.36), 0 2px 12px oklch(0.08 0.02 240 / 0.28);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / .3);
  --shadow-md: 0 4px 14px oklch(0 0 0 / .35);
  --shadow-lg: 0 16px 50px oklch(0 0 0 / .5);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, oklch(from var(--accent) l c h / 0.12), transparent 320px),
    radial-gradient(900px 320px at 78% -8%, oklch(from var(--primary) l c h / 0.20), transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
::selection { background: oklch(from var(--accent) l c h / 0.35); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: oklch(from var(--bg) l c h / 0.84);
  backdrop-filter: blur(14px) saturate(1.35);
}
.topbar-inner {
  max-width: var(--max);
  height: 62px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, oklch(0.95 0.04 215), oklch(0.54 0.12 225) 62%, oklch(0.30 0.09 235));
  box-shadow: inset 0 1px 1px oklch(1 0 0 / .48), 0 0 0 4px oklch(from var(--primary) l c h / .12);
}
.brand-title { font-weight: 680; line-height: 1.05; }
.brand-sub { color: var(--ink-3); font-family: var(--font-mono); font-size: 11px; }
.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(from var(--surface) l c h / .72);
}
.view-tab {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 620;
}
.view-tab:hover { color: var(--ink); background: var(--surface-2); }
.view-tab.active {
  background: var(--ink);
  color: var(--bg);
}
.top-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ws {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
}
.ws-input {
  width: min(330px, 34vw);
  min-width: 170px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
}
.ws-input:focus, #instruction:focus {
  outline: 2px solid oklch(from var(--primary) l c h / .25);
  border-color: var(--primary);
}

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 22px;
}
.side {
  position: sticky;
  top: 86px;
  align-self: start;
  display: grid;
  gap: 14px;
  max-height: calc(100dvh - 110px);
}
.usage-panel, .history-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(from var(--surface) l c h / .86);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  min-height: 42px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.usage-grid {
  display: grid;
  grid-template-columns: 1fr;
}
.usage-grid div {
  padding: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
}
.usage-grid div:first-child { border-top: 0; }
.usage-grid b {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.usage-grid span { color: var(--ink-3); font-size: 12px; }

.history-panel { min-height: 240px; }
.history-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: calc(100dvh - 390px);
  overflow: auto;
}
.history-list:empty::before {
  content: "No runs yet";
  display: block;
  padding: 28px 10px;
  text-align: center;
  color: var(--ink-4);
  font-size: 13px;
}
.history-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
}
.history-item:hover, .history-item.active {
  background: var(--surface-2);
  border-color: var(--line);
}
.history-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 560;
  color: var(--ink);
}
.history-item span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.workspace { min-width: 0; padding-bottom: 126px; }
.admin-workspace {
  grid-column: 1 / -1;
  min-width: 0;
  padding-bottom: 48px;
}
.hero {
  position: relative;
  min-height: 176px;
  padding: 28px 30px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), oklch(from var(--surface-2) l c h / .72));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero::after {
  content: "물결";
  position: absolute;
  right: -12px;
  bottom: -54px;
  font-family: var(--font-serif);
  font-size: 148px;
  color: oklch(from var(--primary) l c h / .07);
  pointer-events: none;
}
.wave-line {
  position: absolute;
  inset: 0 0 auto;
  height: 76px;
  opacity: .42;
  background:
    radial-gradient(34px 14px at 24px 38px, transparent 14px, oklch(from var(--accent) l c h / .24) 15px, transparent 17px) 0 0 / 64px 42px repeat-x;
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(52px, 7vw, 92px);
  line-height: .92;
  color: var(--ink);
}
.lede { max-width: 56ch; margin: 14px 0 0; color: var(--ink-2); font-size: 16px; }

.stream { display: grid; gap: 14px; margin-top: 16px; }
.empty {
  padding: 52px 18px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  color: var(--ink-3);
  text-align: center;
  background: oklch(from var(--surface) l c h / .48);
}

.run {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.run-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.run-title { min-width: 0; display: grid; gap: 5px; }
.instr {
  display: block;
  color: var(--ink);
  font-weight: 620;
  overflow-wrap: anywhere;
}
.run-id {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.run-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.elapsed {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}
.pill, .tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}
.pill[data-s="succeeded"], .chip[data-s="succeeded"] { color: var(--moss); border-color: oklch(from var(--moss) l c h / .38); }
.pill[data-s="failed"], .chip[data-s="failed"] { color: var(--error); border-color: oklch(from var(--error) l c h / .38); }
.pill[data-s="awaiting_confirmation"] { color: var(--warn); border-color: oklch(from var(--warn) l c h / .46); }
.pill[data-s="running"], .pill[data-s="pending"] { color: var(--primary); border-color: oklch(from var(--primary) l c h / .38); }
.pill[data-s="cancelled"] { color: var(--ink-4); }

/* 헤더 상태: 박스 없이 글자만, 상태는 색으로 구분. */
.run-line .status.pill {
  padding: 0;
  border: 0;
  border-radius: 0;
  min-height: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
}
.run-line .status.pill[data-s="succeeded"] { color: var(--moss); }
.run-line .status.pill[data-s="failed"] { color: var(--error); }
.run-line .status.pill[data-s="awaiting_confirmation"] { color: var(--warn); }
.run-line .status.pill[data-s="running"], .run-line .status.pill[data-s="pending"] { color: var(--primary); }
.run-line .status.pill[data-s="cancelled"] { color: var(--ink-4); }

/* dots: 실행 중(running/pending/awaiting)일 때만. data-status 한 값에 연동. */
.run-line:not([data-status="running"]):not([data-status="pending"]):not([data-status="awaiting_confirmation"]) .dots {
  display: none;
}

/* 헤더 한 줄: 텍스트 단계 + `|` 구분자. 박스/동그라미 없음, 상태는 색으로만. */
.steps {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 8px;
  padding: 0;
  border: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
/* 타이머와 첫 단계 사이 구분선 */
.steps:not([hidden])::before {
  content: "";
  width: 1px;
  height: 13px;
  background: var(--line);
  margin-right: 8px;
}
/* 단계는 텍스트만 — flex:none + nowrap 으로 자기 너비만큼 차지(겹침 방지) */
.step {
  display: inline-block;
  flex: none;
  white-space: nowrap;
  padding: 0;
  border: 0;
  color: var(--ink-3);
  font-size: 12.5px;
}
.step[data-s="succeeded"] { color: var(--ink-2); }
.step[data-s="running"],
.step[data-s="pending"] { color: var(--primary); }
.step[data-s="failed"] { color: var(--error); }
.step-sep { flex: none; color: var(--ink-4); user-select: none; }
.chip {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.confirm {
  margin: 16px;
  padding: 15px;
  border: 1px solid oklch(from var(--warn) l c h / .48);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, oklch(from var(--warn) l c h / .13), transparent 68%),
    var(--surface);
}
.confirm h3 {
  margin: 0;
  color: var(--warn);
  font-size: 14px;
  font-weight: 680;
}
.confirm .summary { margin: 7px 0 13px; color: var(--ink-2); }
.confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.kv {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: oklch(from var(--surface-2) l c h / .70);
}
.kv span {
  display: block;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.kv b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 570;
  overflow-wrap: anywhere;
}
.confirm .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.admin-head {
  min-height: 112px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), oklch(from var(--surface-2) l c h / .72));
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-head h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 54px;
  line-height: .95;
}
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 14px;
  margin-top: 16px;
}
.admin-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.policy-panel { grid-row: span 2; }
.panel-note {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
}
.admin-body {
  min-height: 118px;
  padding: 14px;
  overflow-x: auto;
}
.admin-empty {
  padding: 24px 10px;
  color: var(--ink-3);
  text-align: center;
}
.admin-error {
  padding: 13px 14px;
  border: 1px solid oklch(from var(--warn) l c h / .48);
  border-radius: var(--radius);
  background: oklch(from var(--warn) l c h / .11);
  color: var(--warn);
}
.admin-error.danger {
  border-color: oklch(from var(--error) l c h / .48);
  background: oklch(from var(--error) l c h / .10);
  color: var(--error);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.admin-table th {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.admin-table td { color: var(--ink-2); overflow-wrap: anywhere; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .nowrap { white-space: nowrap; }
.admin-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.admin-kv .kv { background: var(--surface-2); }
.policy-form {
  display: grid;
  gap: 14px;
}
.policy-form fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.policy-form legend {
  padding: 0 5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.policy-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.field {
  display: grid;
  gap: 5px;
  color: var(--ink-3);
  font-size: 12px;
}
.field input[type="number"] {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
}
.switch-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-2);
}
.switch-field input { width: 18px; height: 18px; accent-color: var(--primary); }
.policy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.caps {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
}

.answer-wrap { border-top: 1px solid var(--line); }
.answer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.answer {
  padding: 16px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.answer.error { color: var(--error); }

.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  margin: 1.1em 0 .45em;
  color: var(--ink);
  line-height: 1.18;
}
.markdown h1 { font-size: 24px; font-weight: 650; }
.markdown h2 { font-size: 20px; font-weight: 650; }
.markdown h3 { font-size: 17px; font-weight: 650; }
.markdown h4 { font-size: 15px; font-weight: 650; }
.markdown p { margin: .72em 0; }
.markdown ul, .markdown ol { margin: .7em 0 .9em; padding-left: 1.4em; }
.markdown li { margin: .25em 0; }
.markdown code {
  padding: .1em .32em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: .9em;
}
.markdown pre {
  margin: .9em 0;
  padding: 13px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.markdown pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
}
.markdown blockquote {
  margin: .9em 0;
  padding: .2em 0 .2em 12px;
  border-left: 3px solid var(--accent);
  color: var(--ink-3);
}
.markdown table {
  width: 100%;
  margin: .95em 0;
  border-collapse: collapse;
  font-size: 13px;
}
.markdown th, .markdown td {
  padding: 8px 9px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.markdown th { color: var(--ink); background: var(--surface-2); }
.markdown a { color: var(--primary-2); text-decoration: underline; text-underline-offset: 3px; }

.composer {
  position: fixed;
  left: max(24px, calc((100vw - var(--max)) / 2 + 332px));
  right: max(24px, calc((100vw - var(--max)) / 2 + 24px));
  bottom: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px 0 20px;
}
.composer::before {
  content: "";
  position: absolute;
  inset: -38px -16px 0;
  z-index: -1;
  background: linear-gradient(to top, var(--bg) 72%, transparent);
  pointer-events: none;
}
#instruction {
  min-height: 52px;
  max-height: 190px;
  resize: none;
  padding: 14px 15px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
#instruction::placeholder { color: var(--ink-4); }

.btn, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 560;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover, .icon-btn:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn:active, .icon-btn:active { transform: translateY(1px); }
.btn.primary {
  min-height: 52px;
  padding: 0 22px;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.sm { min-height: 28px; padding: 0 9px; font-size: 12px; }
.btn.gold { border-color: oklch(from var(--sand) l c h / .62); color: var(--sand); }
.btn.danger { border-color: oklch(from var(--error) l c h / .60); color: var(--error); }
.btn.moss { border-color: oklch(from var(--moss) l c h / .60); color: var(--moss); }
.icon-btn { width: 34px; padding: 0; font-size: 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 40;
  max-width: min(560px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(16px);
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: oklch(from var(--error) l c h / .55); color: var(--error); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; padding: 16px; }
  .side { position: static; max-height: none; grid-template-columns: 1fr 1fr; }
  .history-list { max-height: 260px; }
  .composer { left: 16px; right: 16px; }
  .admin-grid { grid-template-columns: 1fr; }
  .policy-panel { grid-row: auto; }
}

@media (max-width: 700px) {
  .topbar-inner { height: auto; min-height: 62px; padding: 12px 16px; align-items: flex-start; flex-direction: column; }
  .view-tabs { width: 100%; }
  .view-tab { flex: 1; }
  .top-actions { width: 100%; }
  .ws { flex: 1; }
  .ws-input { width: 100%; max-width: none; }
  .side { grid-template-columns: 1fr; }
  .hero { padding: 24px 20px 28px; }
  .admin-head { align-items: flex-start; flex-direction: column; padding: 22px 20px; }
  .admin-head h1 { font-size: 44px; }
  .admin-kv, .policy-fields { grid-template-columns: 1fr; }
  .confirm-grid { grid-template-columns: 1fr; }
  .run-head { flex-direction: column; }
  .run-meta { width: 100%; justify-content: space-between; }
  .composer { grid-template-columns: 1fr; }
  .btn.primary { width: 100%; }
}

/* MCP server registration (D-49) */
.mcp-register {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.mcp-register .mcp-input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  background: var(--field, rgba(255, 255, 255, 0.04));
  color: inherit;
  font: inherit;
}
.mcp-register select.mcp-input { flex: 0 1 170px; }
.mcp-register .btn { flex: 0 0 auto; align-self: stretch; }
.admin-body td.url { word-break: break-all; max-width: 280px; }
.btn.ghost.sm.danger { color: var(--danger, #ff6b6b); }

/* Skill recipe editor + per-row actions */
.mcp-register textarea.mcp-input.recipe {
  flex: 1 1 100%;
  resize: vertical;
  min-height: 84px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
}
.mcp-register .mcp-input:disabled { opacity: 0.55; cursor: not-allowed; }
.admin-table td.actions { display: flex; gap: 6px; white-space: nowrap; }

/* 권한관리 (RBAC permission matrix) */
.perm-subjects { margin: 12px 0; }
.perm-matrix th { text-align: center; font-size: 12px; color: var(--ink-3); }
.perm-matrix th:first-child { text-align: left; }
.perm-matrix td { vertical-align: middle; text-align: center; }
.perm-matrix td:first-child { text-align: left; }
.tri-set { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tri { padding: 4px 11px; border: 0; border-right: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.tri:last-child { border-right: 0; }
.tri:hover { background: var(--surface-2); }
.tri.on.allow { background: var(--ok); color: #fff; }
.tri.on.deny { background: var(--error); color: #fff; }
.tri.on.unset { background: var(--surface-3); color: var(--ink-2); }
.perm-bar { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.perm-picker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.perm-picker select, .perm-picker input[type="text"] { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 13px; }
.perm-picker input[type="text"] { min-width: 240px; }
.perm-picker .muted, .perm-matrix + .perm-picker.muted, .perm-picker.muted { color: var(--ink-3); font-size: 12px; }
.ws-opt .kc-claim { margin-left: 6px; font-size: 10px; opacity: 0.7; text-transform: uppercase; }

/* Execution-face selector (channel-execface orthogonality) */
.exec-target {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.85rem;
}
.exec-target .exec-label { color: var(--ink-2); }
.exec-target .exec-input {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  background: var(--field, rgba(255, 255, 255, 0.04));
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
}
.exec-target .exec-note { color: var(--ink-3, rgba(255,255,255,0.5)); font-size: 0.78rem; }

/* Scenario quick-start chips */
.quickstarts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.quickstarts .chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  background: var(--field, rgba(255, 255, 255, 0.04));
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.quickstarts .chip:hover {
  border-color: var(--accent, #5fd0c8);
  background: var(--field-hover, rgba(95, 208, 200, 0.12));
}

/* Console B artifact shell. Scoped to the flag-selected body so legacy remains unchanged. */
body[data-ui="b"] {
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  letter-spacing: 0;
}
body[data-ui="b"] .app-b {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
body[data-ui="b"] .b-topbar {
  position: static;
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: oklch(from var(--surface) l c h / .60);
  backdrop-filter: blur(10px);
}
body[data-ui="b"] .brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
body[data-ui="b"] .drop {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(45deg);
  background: radial-gradient(circle at 62% 38%, oklch(0.96 0.03 200), var(--primary) 72%);
  box-shadow: inset -1px -1px 2px oklch(0.3 0.05 220 / .35);
}
body[data-ui="b"] .wm {
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1;
  padding-bottom: 3px;
}
body[data-ui="b"] .wm em { color: var(--primary-2); font-style: italic; }
body[data-ui="b"] .topspace { flex: 1; }
body[data-ui="b"] .b-ws {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}
body[data-ui="b"] .b-ws .k {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}
body[data-ui="b"] .b-ws .ws-input {
  width: 210px;
  min-width: 120px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}
body[data-ui="b"] .seg {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
body[data-ui="b"] .seg .view-tab {
  min-height: 27px;
  padding: 4px 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
}
body[data-ui="b"] .seg .view-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
body[data-ui="b"] .seg .view-tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
body[data-ui="b"] .seg .view-tab svg { width: 16px; height: 16px; display: block; }

/* console (작업창) — fill width responsively, keep text readable */
body[data-ui="b"] .thread {
  max-width: none;
  padding: 34px clamp(28px, 6vw, 120px) 12px;
}
body[data-ui="b"] .composer-wrap {
  padding-left: clamp(28px, 6vw, 120px);
  padding-right: clamp(28px, 6vw, 120px);
}
body[data-ui="b"] .b-quick,
body[data-ui="b"] .b-composer { max-width: none; }
body[data-ui="b"] .answer.markdown { max-width: 78ch; }
body[data-ui="b"] .msg-user { max-width: min(680px, 84%); }
body[data-ui="b"] .iconbtn,
body[data-ui="b"] .icon-btn {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  display: inline-grid;
  place-items: center;
}
body[data-ui="b"] .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--primary-ink);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
body[data-ui="b"] .b-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
body[data-ui="b"] .rail {
  width: 64px;
  flex: none;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 0;
}
body[data-ui="b"] .rail .new,
body[data-ui="b"] .rail .ritem {
  width: 40px;
  height: 40px;
  border: 0;
  display: grid;
  place-items: center;
}
body[data-ui="b"] .rail .new {
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 25px;
  box-shadow: var(--shadow-sm);
}
body[data-ui="b"] .rail .ritem {
  border-radius: 10px;
  background: transparent;
  color: var(--ink-3);
}
body[data-ui="b"] .rail .ritem:hover,
body[data-ui="b"] .rail .ritem.on {
  color: var(--primary);
  background: var(--primary-soft);
}
body[data-ui="b"] .rail .sp { flex: 1; }
body[data-ui="b"] .rail .tip {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .06em;
  color: var(--ink-3);
}
body[data-ui="b"] .center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
body[data-ui="b"] .scroll {
  flex: 1;
  overflow-y: auto;
}
body[data-ui="b"] .thread {
  max-width: 740px;
  margin: 0 auto;
  padding: 34px 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
body[data-ui="b"] .empty {
  min-height: 62vh;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  font-size: 16px;
}
body[data-ui="b"] .b-run {
  display: flex;
  flex-direction: column;
  gap: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
body[data-ui="b"] .msg-user {
  align-self: flex-end;
  max-width: 84%;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 5px 16px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere;
}
body[data-ui="b"] .agent {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
/* One-line run header: avatar · name · plan/steps · status (replaces .who/.run-head 3-block). */
body[data-ui="b"] .run-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  row-gap: 7px;
}
body[data-ui="b"] .run-line .ava {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--primary-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
body[data-ui="b"] .run-line .ava svg { width: 13px; height: 13px; }
/* Unified app icon (desktop build mark) for the assistant avatar + brand. */
body[data-ui="b"] .run-line .ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
body[data-ui="b"] .brand-logo { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; display: block; }
body[data-ui="b"] .th-badge { overflow: hidden; }
body[data-ui="b"] .th-badge img { width: 100%; height: 100%; object-fit: cover; display: block; }
body[data-ui="b"] .run-line .nm { font-size: 13.5px; font-weight: 600; flex-shrink: 0; }
body[data-ui="b"] .run-line .nm em { color: var(--primary-2); font-family: var(--serif); font-style: italic; }
body[data-ui="b"] .rl-div { width: 1px; height: 13px; background: var(--line); flex-shrink: 0; }
body[data-ui="b"] .run-line .sp { flex: 1 1 12px; min-width: 12px; }
body[data-ui="b"] .run-line .run-meta { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
body[data-ui="b"] .plan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
body[data-ui="b"] .dots { display: inline-flex; gap: 4px; }
body[data-ui="b"] .dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: b-bounce 1.1s infinite;
}
body[data-ui="b"] .dots i:nth-child(2) { animation-delay: .15s; }
body[data-ui="b"] .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes b-bounce {
  0%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
body[data-ui="b"] .answer-wrap {
  border: 0;
  display: grid;
  gap: 12px;
}
body[data-ui="b"] .answer {
  padding: 0;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.72;
}
body[data-ui="b"] .answer-toolbar {
  min-height: 0;
  padding: 0;
  border: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
/* Inline steps: 텍스트 + `|` 구분자 (동그라미/박스 없음, 상태는 색으로). 베이스 .steps 규칙 사용. */
body[data-ui="b"] .steps {
  gap: 0 8px;
}
body[data-ui="b"] .steps:not([hidden])::before {
  margin-right: 8px;
}
body[data-ui="b"] .step {
  display: inline-block;
  flex: none;
  white-space: nowrap;
  gap: 0;
}
body[data-ui="b"] .hitl,
body[data-ui="b"] .confirm {
  margin: 0;
  padding: 16px;
  border: 1.5px solid var(--warn-line);
  border-radius: 15px;
  background: var(--warn-soft);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
body[data-ui="b"] .hitl::before,
body[data-ui="b"] .confirm::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--warn);
}
body[data-ui="b"] .confirm h3 {
  margin: 0 0 7px;
  color: var(--warn-2);
  font-size: 16px;
}
body[data-ui="b"] .confirm .summary {
  margin: 0 0 13px;
  color: var(--ink);
}
body[data-ui="b"] .confirm-grid {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 7px 14px;
  margin-bottom: 13px;
}
body[data-ui="b"] .confirm-grid .kv {
  display: contents;
  padding: 0;
  border: 0;
  background: transparent;
}
body[data-ui="b"] .confirm-grid .kv span {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
}
body[data-ui="b"] .confirm-grid .kv b {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}
body[data-ui="b"] .confirm .actions {
  display: flex;
  gap: 9px;
  align-items: center;
}
body[data-ui="b"] .btn {
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 10px;
}
body[data-ui="b"] .btn.primary,
body[data-ui="b"] .btn.gold {
  border-color: var(--warn);
  background: var(--warn);
  color: #fff;
}
body[data-ui="b"] .btn.send {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
}
body[data-ui="b"] .btn.danger { color: var(--error); }
body[data-ui="b"] .openart {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
}
body[data-ui="b"] .openart .pv {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-2);
}
body[data-ui="b"] .openart .t b { display: block; font-size: 14.5px; }
body[data-ui="b"] .openart .t span {
  display: block;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
}
body[data-ui="b"] .openart .go { margin-left: auto; }
body[data-ui="b"] .composer-wrap {
  flex: none;
  padding: 10px 28px 22px;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
body[data-ui="b"] .b-quick {
  max-width: 740px;
  margin: 0 auto 10px;
  justify-content: center;
}
body[data-ui="b"] .qchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
body[data-ui="b"] .qchip .d {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
body[data-ui="b"] .qchip .d.s2 { background: var(--sand); }
body[data-ui="b"] .qchip .d.s3 { background: var(--ok); }
body[data-ui="b"] .qchip .d.s4 { background: var(--warn); }
body[data-ui="b"] .qchip .d.s5 { background: var(--primary-2); }
body[data-ui="b"] .b-composer {
  position: static;
  max-width: 740px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px 14px 10px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
body[data-ui="b"] .b-composer::before { display: none; }
body[data-ui="b"] #instruction {
  min-height: 28px;
  max-height: 190px;
  padding: 2px 2px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  resize: none;
}
body[data-ui="b"] .composer-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
body[data-ui="b"] .composer-row .sp { flex: 1; }
body[data-ui="b"] .face {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
}
body[data-ui="b"] .face select {
  max-width: 210px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}
body[data-ui="b"] .hint {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11.5px;
}
body[data-ui="b"] .artifact {
  width: 444px;
  flex: none;
  border-left: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body[data-ui="b"] .artifact[hidden] { display: none; }
body[data-ui="b"] .art-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}
body[data-ui="b"] .art-head .ti {
  min-width: 0;
  flex: 1;
}
body[data-ui="b"] .art-head .ti b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15.5px;
}
body[data-ui="b"] .art-head .ti span {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
}
body[data-ui="b"] .tabs {
  display: flex;
  gap: 3px;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--line);
}
body[data-ui="b"] .tabs button {
  padding: 8px 12px 11px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  position: relative;
}
body[data-ui="b"] .tabs button.on {
  color: var(--ink);
  font-weight: 600;
}
body[data-ui="b"] .tabs button.on::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--primary);
}
body[data-ui="b"] .art-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 30px;
}
body[data-ui="b"] .apanel[hidden] { display: none; }
body[data-ui="b"] .doc h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
}
body[data-ui="b"] .dtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
body[data-ui="b"] .dtable th {
  padding: 9px 11px;
  border-bottom: 2px solid var(--line-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  text-align: left;
}
body[data-ui="b"] .dtable td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
}
body[data-ui="b"] .dtable td.num { text-align: right; font-family: var(--mono); }
body[data-ui="b"] .codeblock {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: oklch(0.20 0.015 235);
}
body[data-ui="b"] .codeblock .cbar {
  padding: 8px 12px;
  border-bottom: 1px solid oklch(0.32 0.015 235);
  color: oklch(0.7 0.01 235);
  font-family: var(--mono);
  font-size: 11px;
}
body[data-ui="b"] .codeblock pre {
  margin: 0;
  padding: 13px 15px;
  color: oklch(0.86 0.015 200);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
body[data-ui="b"] .b-admin-usage,
body[data-ui="b"] .b-admin-history {
  margin-top: 16px;
}
body[data-ui="b"] .admin-workspace {
  flex: 1;
  min-width: 0;
  padding: 24px;
  overflow-y: auto;
}
@media (max-width: 1080px) {
  body[data-ui="b"] .artifact { width: 380px; }
}
@media (max-width: 880px) {
  body[data-ui="b"] .artifact {
    position: absolute;
    right: 0;
    top: 56px;
    bottom: 0;
    z-index: 40;
    box-shadow: var(--shadow-lg);
  }
  body[data-ui="b"] .b-ws .ws-input { width: 140px; }
  body[data-ui="b"] .hint { display: none; }
}

/* Console B (?ui=b) empty-state welcome hero — centered droplet + heading. */
body[data-ui="b"] .thread-hero {
  position: relative;
  min-height: 58vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
}
body[data-ui="b"] .thread-hero .th-glow {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  top: -10px;
  background: radial-gradient(circle, var(--primary-soft), transparent 68%);
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
}
body[data-ui="b"] .thread-hero .th-mark {
  width: 60px;
  height: 60px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(45deg);
  z-index: 1;
  background: radial-gradient(circle at 62% 38%, oklch(0.97 0.025 200), var(--primary) 74%);
  box-shadow: 0 10px 30px oklch(0.55 0.1 210 / .32), inset -2px -2px 4px oklch(0.3 0.05 220 / .3);
}
body[data-ui="b"] .thread-hero h1 {
  margin: 0;
  z-index: 1;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 33px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
body[data-ui="b"] .thread-hero p {
  margin: 0;
  z-index: 1;
  max-width: 46ch;
  color: var(--ink-2);
  font-size: 16px;
}

/* Console B brand + hero icon (물결 ripple SVG, replaces the CSS droplet). */
body[data-ui="b"] .brand-wave {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--primary);
}
body[data-ui="b"] .brand-wave svg { width: 24px; height: 24px; }
body[data-ui="b"] .thread-hero .th-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  z-index: 1;
  color: var(--primary);
  /* No tile: show the robot mascot alone (no box bg/border/shadow). */
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}
body[data-ui="b"] .thread-hero .th-badge img { object-fit: contain; }
body[data-ui="b"] .thread-hero .th-badge svg { width: 36px; height: 36px; }

/* ── SysAdmin cross-workspace console ───────────────────────────── */
.sa-tag {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-2);
  background: color-mix(in oklch, var(--primary) 12%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.sa-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}
.sa-toolbar .sa-flabel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}
.sa-toolbar .sa-flabel select {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}
.sa-toolbar .search { flex: 1; min-width: 220px; }
.sa-count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-4);
}
.sa-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 2px;
}
.sa-cell-empty {
  text-align: center;
  color: var(--ink-4);
  padding: 24px;
}
.sa-detail {
  display: inline-block;
  max-width: 38ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  vertical-align: bottom;
}
.sa-detail-path {
  color: var(--ink-3);
  font-size: 13px;
}
/* sub-tab nav inside a workspace drill-in — horizontal segmented row */
.sa-subnav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  margin: 6px 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.sa-subnav .sa-subtab {
  width: auto;
  flex: 0 0 auto;
  border-radius: 8px;
}
.sa-subnav .sa-subtab.on {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.sa-subbody { margin-top: 4px; }

/* --- capability portability actions + export selection modal (P3) --- */
.reg-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.cap-act { font-size: 13px; padding: 6px 10px; }
.cap-export-ov {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(8, 14, 22, 0.5);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.cap-export-modal {
  width: min(520px, 100%); max-height: 80vh; display: flex; flex-direction: column;
  background: var(--surface, #fff); color: var(--ink, #11202e);
  border: 1px solid var(--line, rgba(0,0,0,0.1)); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28); padding: 20px;
}
.cap-export-modal h3 { margin: 0 0 4px; font-size: 18px; }
.cap-export-sub { margin: 0 0 12px; font-size: 13px; color: var(--ink-2, #5a6b78); }
.cap-export-all { display: flex; gap: 8px; align-items: center; font-weight: 600; padding: 6px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,0.08)); }
.cap-export-list { overflow-y: auto; padding: 8px 0; display: flex; flex-direction: column; gap: 2px; }
.cap-export-row { display: flex; gap: 8px; align-items: center; padding: 6px 4px; border-radius: 8px; }
.cap-export-row:hover { background: var(--surface-2, rgba(0,0,0,0.04)); }
.cap-export-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
