/* Bonhyang staff workspace. Shared styling for chat, manual, and management. */
:root {
  color-scheme: light;
  /* White surfaces with quiet neutral states and a restrained warm accent. */
  --bg: #fff;
  --card: #fff;
  --panel: #fafafa;
  --chrome: #fff;
  --hover: #f4f4f4;
  --ink: #303030;
  --sub: #686868;
  --muted: #707070;
  --line: #ececec;
  --line-strong: #d6d6d6;
  --accent: #6e665e;
  --accent-soft: #f4f4f4;
  --selected: #ebebeb;
  --action: #3e3d3a;
  --action-hover: #292826;
  --chip: var(--panel);
  --danger: #a14b42;
  --danger-soft: #fbf1ee;
  --danger-line: #e9cfc9;
  --ok: #54715d;
  --ok-soft: #eef3ee;
  --ok-line: #d4e0d5;
  --pending: #80603e;
  --pending-soft: #f6f1e8;
  --pending-line: #ddcfb9;
  --focus: var(--accent);
  --focus-ring: rgb(110 102 94 / 10%);
  --overlay: rgb(40 39 35 / 32%);
  --shadow-soft: rgb(40 39 35 / 4%);
  --shadow-raised: rgb(40 39 35 / 12%);
  --sidebar-width: 220px;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 280px; height: 100%; }
body { margin: 0; min-width: 280px; min-height: 100%; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .55; }
button, a { transition: background-color .15s, border-color .15s, color .15s; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
input, textarea, select { color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: 8px; }
input, select { min-height: 44px; padding: 10px 12px; }
textarea { padding: 12px 14px; line-height: 1.65; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
a { color: var(--accent); }
img, svg { vertical-align: middle; }
svg { flex-shrink: 0; }
button > svg, .nav-item svg, .header-actions svg, .chat-tools svg { width: 20px; height: 20px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

/* Main navigation and page frame */
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 28px 16px 18px; background: var(--chrome); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; margin: 0 8px 30px; color: var(--ink); text-decoration: none; }
.brand img { width: 38px; height: 38px; object-fit: contain; flex: none; }
.brand strong, .brand b { display: block; font-size: 17px; letter-spacing: -.5px; font-weight: 700; }
.brand > span { display: block; color: var(--ink); font-size: 17px; font-weight: 600; line-height: 1.4; letter-spacing: -.4px; }
.brand small { display: block; margin-top: 3px; font-size: 10px; font-weight: 400; line-height: 1.6; color: var(--sub); letter-spacing: .4px; }
.nav-main { display: flex; flex-direction: column; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 46px; padding: 12px 13px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; color: var(--sub); font-size: 14px; font-weight: 600; line-height: 1.4; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--ink); }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 500; opacity: .75; }
.sidebar-section { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.sidebar-section > p, .sidebar-section > small, .sidebar-section > h2, .sidebar-label { display: block; margin: 0 12px 10px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .6px; }
.sidebar-section .nav-item { font-weight: 500; }
.sidebar > .sidebar-section { margin: 24px 12px 10px; padding: 0; border: 0; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .8px; }
.sidebar > .brand + .sidebar-section { margin-top: 0; }
.sidebar-bottom { display: flex; align-items: center; gap: 8px; margin-top: 0; padding: 17px 8px 0; border-top: 1px solid var(--line); }
.sidebar-note { margin: auto 12px 26px; padding-top: 30px; color: var(--sub); font-size: 11px; line-height: 1.7; }
.sidebar-note .status-dot { display: inline-block; margin-right: 7px; vertical-align: 1px; }
.sidebar-note p { margin: 9px 0 0; font-size: 10px; line-height: 1.8; color: var(--muted); }
.user-profile { display: flex; flex: 1; min-width: 0; gap: 10px; align-items: center; padding: 0; }
.user-avatar, .profile-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; }
.user-profile > div:not(.user-avatar):not(.profile-avatar) { min-width: 0; }
#userName { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
#userRole { display: block; color: var(--sub); font-size: 11px; margin-top: 1px; }
#logoutBtn { display: flex; gap: 9px; align-items: center; justify-content: center; flex: none; width: 30px; min-height: 32px; padding: 6px; border: 0; background: transparent; border-radius: 6px; color: var(--sub); font-size: 12px; }
#logoutBtn:hover { color: var(--ink); background: var(--hover); }
#logoutBtn svg { width: 16px; height: 16px; }
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 20px; padding: 28px 32px 24px; }
.page-heading { min-width: 0; }
.page-heading small { display: block; margin-bottom: 5px; color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: 1.2px; }
.page-heading h1 { margin: 0; font-size: 25px; font-weight: 650; line-height: 1.35; letter-spacing: -.8px; }
.page-heading p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--sub); }
.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.header-actions button { display: inline-flex; gap: 7px; align-items: center; justify-content: center; min-height: 40px; }
.header-actions kbd { padding: 1px 4px; margin-left: 4px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font: inherit; font-size: 10px; }
.toolbtn { padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); color: var(--ink); font-size: 13px; font-weight: 500; line-height: 1.45; }
.toolbtn:hover { background: var(--panel); border-color: var(--line-strong); }
.toolbtn.on, .toolbtn.primary { background: var(--action); color: var(--card); border-color: var(--action); }
.toolbtn.map { color: var(--accent); }
.view { flex: 1; min-height: 0; min-width: 0; }

/* Chat is a workspace, with the composer anchored below its scrolling log. */
.chat-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; padding: 0 32px 28px; }
#bot { display: flex; flex-direction: column; min-width: 0; min-height: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#botbtn, #botClose { display: none !important; }
.bh { display: flex; align-items: center; justify-content: space-between; flex: none; min-height: 58px; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.chat-context { display: flex; gap: 8px; align-items: center; font-size: 12px; line-height: 1.5; color: var(--sub); }
.chat-context strong { color: var(--ink); font-weight: 600; }
.status-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--ok); }
.status-dot.offline { background: var(--sub); }
.chat-tools { display: flex; align-items: center; gap: 6px; }
.chat-tools > span { color: var(--muted); font-size: 11px; }
.chat-tools button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 32px; min-height: 32px; padding: 5px 7px; border: 0; border-radius: 5px; background: transparent; color: var(--sub); font-size: 12px; }
.chat-tools button:hover, .icon-button:hover { background: var(--panel); color: var(--ink); }
.blog { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; gap: 22px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; padding: 28px clamp(22px, 3.2vw, 52px); }
.chat-welcome { width: 100%; max-width: 660px; margin: auto; padding: 24px 0; }
.welcome-symbol { display: flex; align-items: center; margin-bottom: 24px; }
.welcome-symbol img { width: 44px; height: 44px; object-fit: contain; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: 1.2px; }
.chat-welcome h2 { margin: 0; color: var(--ink); font-size: clamp(24px, 2.1vw, 30px); line-height: 1.45; font-weight: 600; letter-spacing: -1px; word-break: keep-all; }
.chat-welcome > p:not(.eyebrow):not(.welcome-foot) { max-width: 520px; margin: 14px 0 0; color: var(--sub); font-size: 14px; line-height: 1.8; word-break: keep-all; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 32px; }
.suggestion { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 112px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); text-align: left; }
.suggestion:hover { border-color: var(--line-strong); background: var(--panel); }
.suggestion > svg { position: absolute; right: 13px; top: 18px; width: 14px; height: 14px; color: var(--muted); }
.suggestion-icon { display: flex; align-items: center; width: 22px; height: 22px; margin-bottom: 4px; color: var(--accent); }
.suggestion-icon svg { width: 20px; height: 20px; }
.suggestion-title { display: block; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.45; }
.suggestion-desc { display: block; font-size: 12px; color: var(--sub); line-height: 1.55; word-break: keep-all; }
.welcome-foot { display: flex; align-items: center; gap: 6px; margin: 22px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.welcome-foot svg { width: 14px; height: 14px; }
.composer { flex: none; padding: 14px 24px 17px; border-top: 1px solid var(--line); background: var(--card); }
.channel-tabs { display: flex; gap: 18px; align-items: center; margin: 0 0 11px; }
.channel-tab { display: flex; align-items: center; gap: 5px; padding: 4px 1px 7px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--sub); font-size: 12px; font-weight: 500; }
.channel-tab svg { width: 15px; height: 15px; }
.channel-tab:hover { color: var(--ink); }
.channel-tab.active { border-color: var(--accent); color: var(--accent); font-weight: 650; }
.bin { display: flex; align-items: flex-end; gap: 12px; padding: 11px 12px 11px 15px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 9px; }
.bin:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
#bq { display: block; flex: 1; width: 100%; min-width: 0; min-height: 56px; max-height: 160px; padding: 0; border: 0; border-radius: 0; background: transparent; outline: none; resize: none; font-size: 15px; line-height: 1.75; box-shadow: none; }
#bsend { display: flex; align-items: center; justify-content: center; gap: 6px; flex: none; min-width: 40px; min-height: 40px; padding: 10px 12px; border: 0; border-radius: 7px; background: var(--action); color: var(--card); font-size: 13px; font-weight: 600; }
#bsend:hover:not(:disabled) { background: var(--action-hover); }
#bsend svg { width: 18px; height: 18px; }
.composer-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 9px 1px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.composer-hint kbd { font: inherit; padding: 1px 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }

/* Situation reference navigation. */
.reference-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding-top: 7px; }
.panel-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 0 0 18px; }
.panel-heading .eyebrow { margin: 0 0 2px; font-size: 9px; }
.panel-heading h2, .panel-heading h3 { margin: 0; font-size: 14px; font-weight: 650; }
.panel-heading p { margin: 0; color: var(--sub); font-size: 11px; line-height: 1.7; }
.panel-heading small, .panel-heading span { font-size: 11px; color: var(--sub); }
.panel-heading > svg { width: 18px; height: 18px; color: var(--accent); }
.reference-search { position: relative; margin-bottom: 20px; }
.reference-search svg { position: absolute; left: 11px; top: 13px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.reference-search input { width: 100%; min-height: 42px; padding: 10px 12px; border-color: var(--line); background: var(--card); font-size: 12px; }
.reference-search:has(svg) input { padding-left: 34px; }
.reference-list { display: flex; flex-direction: column; min-height: 0; gap: 10px; overflow: auto; scrollbar-width: thin; }
.reference-card { position: relative; display: block; width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); text-align: left; }
.reference-card > span:first-child { display: block; margin: 0 20px 7px 0; color: var(--accent); font-size: 10px; font-weight: 600; }
.reference-arrow { position: absolute; top: 13px; right: 14px; color: var(--muted); font-size: 15px; }
button.reference-card:hover, .reference-card:has(button:hover) { border-color: var(--line-strong); background: var(--panel); }
.reference-card > small, .reference-card .reference-category, .reference-card .category { display: block; margin: 0 0 7px; color: var(--accent); font-size: 10px; font-weight: 600; }
.reference-card h3, .reference-card strong, .reference-card .reference-title { display: block; margin: 0 0 7px; color: var(--ink); font-size: 13px; line-height: 1.5; font-weight: 600; }
.reference-card p, .reference-card .reference-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: 0; font-size: 12px; line-height: 1.7; color: var(--sub); }
.reference-card button { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.reference-card .reference-meta { margin-top: 12px; font-size: 10px; color: var(--muted); }
.reference-footer { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 17px 1px 0; color: var(--sub); font-size: 11px; line-height: 1.7; }
.reference-footer p { margin: 0 0 9px; }
.reference-footer button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; }
.reference-footer button svg { width: 14px; height: 14px; }
.reference-tip { flex: none; margin-top: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--accent-soft); }
.reference-tip > span { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: 1px; }
.reference-tip h3 { margin: 10px 0; color: var(--accent); font-size: 16px; font-weight: 500; line-height: 1.6; letter-spacing: -.3px; }
.reference-tip p { margin: 0; color: var(--sub); font-size: 12px; line-height: 1.7; }

/* Situation index: a compact table of contents, not a stack of excerpts. */
.reference-list[aria-label="상황별 매뉴얼 목차"] { flex: 1; gap: 0; border-top: 1px solid var(--line); overscroll-behavior: contain; scrollbar-color: var(--line-strong) transparent; }
.reference-panel:has(.situation-link) .panel-heading { gap: 4px; margin-bottom: 12px; }
.reference-panel:has(.situation-link) .reference-footer { flex: none; padding-top: 12px; gap: 5px; }
.situation-link { display: flex; align-items: center; gap: 8px; flex: none; width: 100%; min-height: 49px; padding: 6px 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); text-align: left; }
.situation-link:hover { background: var(--hover); }
.situation-link[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); }
.situation-copy { display: block; flex: 1; min-width: 0; }
.situation-copy strong { display: block; color: var(--ink); font-size: 13px; font-weight: 550; line-height: 19px; }
.situation-copy small { display: block; margin-top: 2px; color: var(--sub); font-size: 11px; line-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.situation-link[aria-current="true"] .situation-copy strong { color: var(--accent); font-weight: 650; }
.situation-count { flex: none; min-width: 20px; color: var(--muted); font-size: 11px; line-height: 1.4; font-variant-numeric: tabular-nums; text-align: right; }
.situation-link > svg { width: 13px; height: 13px; color: var(--muted); }
.situation-link[aria-current="true"] > svg { color: var(--accent); }

/* The selected situation remains visible while browsing its matching cards. */
.manual-scope { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; flex: none; gap: 10px 16px; margin: -6px 0 18px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--accent-soft); }
.manual-scope > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; min-width: 0; }
.manual-scope > div > span { color: var(--sub); font-size: 11px; }
.manual-scope strong { color: var(--accent); font-size: 13px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.manual-scope button { flex: none; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--card); color: var(--accent); font-size: 11px; line-height: 1.5; }
.manual-scope button:hover { border-color: var(--accent); background: var(--panel); }
.situation-select { flex: 0 1 190px; width: 190px; max-width: 100%; min-height: 44px; padding: 10px 28px 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background-color: var(--card); color: var(--ink); font-size: 13px; }
@media (max-width: 639px) {
  .manual-toolbar .situation-select { flex: 1 1 180px; width: 190px; min-width: 0; min-height: 40px; padding: 8px 24px 8px 10px; font-size: 16px; }
  .manual-scope { margin-top: -3px; margin-bottom: 14px; padding: 10px 12px; gap: 8px; }
  .manual-scope > div { flex: 1 1 180px; gap: 3px 9px; }
  .manual-scope button { min-height: 34px; padding: 7px 10px; }
}

/* Conversation output and editable response steps. */
.msg { max-width: 88%; font-size: 16px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.u { align-self: flex-end; padding: 12px 17px; border-radius: 10px 10px 2px 10px; background: var(--accent-soft); color: var(--ink); }
.msg.a { align-self: flex-start; padding: 14px 17px; border-radius: 9px; background: var(--panel); }
.msg.a.ans-wrap { width: 100%; max-width: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; white-space: normal; }
.ans-top { display: flex; align-items: center; gap: 9px; margin: 0 0 18px; }
.botav { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none; }
.botav img { display: block; width: 26px; height: 26px; object-fit: contain; }
.botav svg { width: 26px; height: 26px; }
.ans-head { margin: 0; font-size: 12px; color: var(--accent); font-weight: 600; }
.answer-hint { margin-left: auto; color: var(--muted); font-size: 10px; }
.ans-box { padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.ans-text { color: var(--ink); font-size: 16px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.step { margin: 0 0 22px; }
.step-h { margin: 0 0 8px; color: var(--sub); font-size: 12px; font-weight: 600; }
.step-msg { display: block; width: 100%; min-height: 70px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 16px; line-height: 1.8; resize: none; overflow: hidden; }
.step-msg:focus { background: var(--card); }
.step-actions, .answer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.step-actions .step-copy { margin-top: 0; }
.step > .step-actions { justify-content: space-between; margin: 0 0 9px; }
.step > .step-actions .step-h { margin: 0; }
.step > .step-actions .step-copy { padding: 5px 10px; min-height: 30px; border-color: var(--line-strong); background: var(--card); color: var(--accent); font-size: 11px; }
.step > .step-actions .step-copy:hover { border-color: var(--accent); background: var(--accent-soft); }
.step-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.step-buttons .answer-feedback-button { min-height: 30px; padding: 5px 10px; border-color: var(--accent); background: var(--accent-soft); font-size: 11px; }
.step-edit-status, .answer-permission { margin: 7px 0 0; color: var(--sub); font-size: 11px; line-height: 1.6; }
.step-actions .step-meta, .answer-actions .action-note { margin-left: auto; color: var(--sub); font-size: 11px; }
.step-copy, .ans-copy, .copy, .save-all, .ans-confirm, .inq-apply, .logapply, .fb-save { display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--action); border-radius: 6px; background: var(--action); color: var(--card); font-size: 13px; font-weight: 600; line-height: 1.5; }
.step-copy, .ans-copy { margin-top: 10px; }
.step-copy:hover:not(:disabled), .ans-copy:hover:not(:disabled), .copy:hover:not(:disabled), .save-all:hover:not(:disabled), .ans-confirm:hover:not(:disabled) { background: var(--action-hover); border-color: var(--action-hover); }
.step-copy.done, .copy.done, .save-card.done, .save-all.done, .ans-confirm.done, .logapply.done { background: var(--ok); color: var(--card); border-color: var(--ok); }
.msgcopy, .save-card, .mini, .fb-open, .logedit { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); color: var(--accent); font-size: 12px; line-height: 1.5; }
.msgcopy { margin-top: 8px; }
.msgcopy:hover, .save-card:hover, .mini:hover, .fb-open:hover, .logedit:hover { background: var(--panel); border-color: var(--line-strong); }
.mini.del:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.ans-policy, .ans-caut { margin: 14px 0 0; color: var(--sub); font-size: 13px; line-height: 1.75; }
.ans-policy b, .ans-caut b { color: var(--ink); margin-right: 6px; font-size: 12px; font-weight: 600; }
.ans-caut ul { margin: 6px 0 0; padding-left: 20px; }
.ans-caut li { margin: 4px 0; }
.step-why, .note { margin: 9px 0 0; padding: 10px 12px; border-left: 2px solid var(--line-strong); border-radius: 0 5px 5px 0; color: var(--sub); background: var(--panel); font-size: 12px; line-height: 1.7; }
.step-context { margin-top: 10px; color: var(--sub); font-size: 12px; }
.step-context summary { width: fit-content; cursor: pointer; padding: 4px 0; color: var(--sub); }
.step-context[open] summary { color: var(--accent); }
.step-context .step-why { margin-top: 4px; }
.step-context > p { margin: 6px 0 0; padding: 11px 13px; border-left: 2px solid var(--line-strong); background: var(--panel); line-height: 1.8; }
.answer-actions { padding-top: 16px; border-top: 1px solid var(--line); margin-top: 22px; }
.answer-actions .save-all, .answer-actions .ans-confirm, .answer-actions .ans-copy { margin: 0; width: auto; }
.ans-confirm { margin: 12px 0 0; }
.ans-fb { margin: 14px 0 0; }
.fb-form { margin-top: 9px; }
.fb-form textarea { width: 100%; min-height: 80px; font-size: 14px; resize: vertical; }
.fb-save { margin-top: 7px; }
.fb-done { margin-top: 6px; color: var(--ok); font-size: 13px; }
.fb-status { margin-top: 7px; color: var(--danger); font-size: 12px; }
.clarify-head { color: var(--accent); }
.clarify-q { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 15px 17px; font-size: 15px; line-height: 1.75; white-space: pre-wrap; }
.clarify-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.clarify-btn { padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); color: var(--ink); font-size: 13px; text-align: left; }
.clarify-btn:hover, .mode-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.mode-opts { flex-direction: column; }
.mode-opts .mode-btn { width: 100%; }
.scope-box { margin: 14px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.scope-h { margin-bottom: 10px; color: var(--accent); font-size: 13px; font-weight: 600; }
.scope-opts { display: flex; flex-direction: column; gap: 7px; }
.scope-dis { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.scope-sel { min-width: 0; max-width: 100%; font-size: 13px; }
.scope-save { background: var(--action); color: var(--card); border-color: var(--action); }
.scope-save:hover { background: var(--action-hover); color: var(--card); }
.scope-st { margin-top: 9px; font-size: 12px; }
.ans-inq, .ans-report { margin: 14px 0 0; padding: 15px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.ans-inq b, .rep-h { color: var(--accent); font-size: 12px; font-weight: 600; }
.inq-ask { margin: 7px 0 5px; color: var(--ink); font-size: 14px; font-weight: 600; }
.inq-note { color: var(--sub); font-size: 12px; line-height: 1.65; }
.ans-report { border-color: var(--ok-line); background: var(--ok-soft); }
.rep-h { margin-bottom: 7px; color: var(--ok); }
.rep-body { font-size: 13px; line-height: 1.7; }
.rep-acts { display: flex; flex-direction: column; gap: 5px; padding-left: 17px; margin: 9px 0 0; font-size: 12px; }

/* Manual browsing and editing. */
#manualView { display: flex; flex-direction: column; padding: 0 32px 28px; }
.manual-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; flex: none; margin: 0 0 22px; }
.manual-search { position: relative; display: flex; flex: 1; min-width: 200px; max-width: 520px; align-items: center; }
.manual-search > svg { position: absolute; left: 13px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.manual-search .search { width: 100%; max-width: none; padding-left: 40px; padding-right: 60px; }
.manual-search .text-button { position: absolute; right: 12px; font-size: 11px; }
.manual-toolbar > .toolbtn { display: inline-flex; align-items: center; gap: 6px; }
.search { flex: 1; min-width: 160px; max-width: 520px; min-height: 44px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); font-size: 14px; }
#manualCount { margin-right: auto; color: var(--sub); font-size: 12px; white-space: nowrap; }
.manual-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; flex: 1; min-height: 0; overflow: hidden; }
.toc { min-height: 0; overflow: auto; padding: 4px 10px 20px 0; font-size: 13px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.toc-h { margin: 0 0 14px 10px; color: var(--sub); font-size: 11px; font-weight: 600; letter-spacing: .6px; }
.toc-sec > a { display: flex; gap: 7px; padding: 9px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.toc-sec > a:hover { background: var(--accent-soft); }
.toc-sec .num { min-width: 17px; color: var(--accent); }
.toc-sub { list-style: none; margin: 3px 0 14px; padding: 0; }
.toc-sub a { display: flex; justify-content: space-between; gap: 6px; padding: 7px 10px 7px 33px; border-radius: 5px; color: var(--sub); text-decoration: none; font-size: 12px; line-height: 1.5; }
.toc-sub a:hover, .toc-sub a.active { background: var(--accent-soft); color: var(--accent); }
.toc-sub a.active { font-weight: 600; }
.toc-sub .cnt { font-size: 10px; color: var(--muted); }
.category-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-bottom: 4px; padding: 11px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--sub); text-align: left; font-size: 13px; }
.category-link:hover { background: var(--accent-soft); color: var(--accent); }
.category-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.category-link .cnt { color: var(--muted); font-size: 11px; font-weight: 400; }
.library-heading { margin: 0 0 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.library-heading h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.4px; }
.library-heading p { margin: 7px 0 0; font-size: 12px; color: var(--sub); }
.manual-card { display: block; margin: 0 0 12px; padding: 0; }
.manual-card .cardtop { align-items: center; margin: 0; padding: 20px; border: 0; cursor: pointer; list-style: none; }
.manual-card .cardtop::-webkit-details-marker { display: none; }
.manual-card .cardtop > div { flex: 1; min-width: 0; }
.card-category { display: block; margin-bottom: 6px; font-size: 10px; color: var(--accent); }
.manual-card .title { display: block; }
.card-preview { display: block; margin-top: 7px; color: var(--sub); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-chevron { flex: none; margin-left: 5px; font-size: 17px; color: var(--muted); line-height: 1; }
.manual-card[open] .card-chevron { transform: rotate(180deg); }
.manual-card[open] .cardtop { padding-bottom: 17px; }
.manual-card[open] .card-preview { display: none; }
.card-detail { padding: 0 20px 20px; }
.card-detail > .flow { padding-top: 17px; border-top: 1px solid var(--line); }
.card-detail .flow:not(.multi) .cstep-n { display: none; }
.library-more { display: block; width: 100%; margin-top: 16px; padding: 13px; text-align: center; }
#content { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 5px 60px 0; scrollbar-width: thin; }
#content section { margin: 0 0 42px; scroll-margin-top: 15px; }
.sec-title { display: flex; align-items: baseline; gap: 11px; margin: 0 0 22px; padding: 0 0 14px; border-bottom: 1px solid var(--line); font-size: 22px; font-weight: 650; letter-spacing: -.5px; }
.sec-title .num { color: var(--accent); font-size: 16px; }
.subgroup { margin-top: 28px; scroll-margin-top: 15px; }
.sub-title { display: inline-block; margin: 0 0 14px; padding: 0; color: var(--accent); font-size: 14px; font-weight: 650; }
.subgroup.dis { padding: 18px; margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.subgroup.dis .sub-title { font-size: 16px; color: var(--ink); }
.subcov { margin-left: 8px; color: var(--sub); font-size: 11px; font-weight: 400; }
.disbadge { padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--accent); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.axisflow { display: flex; flex-direction: column; }
.axisrow { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 14px; align-items: start; padding: 17px 0; border-top: 1px solid var(--line); }
.axisrow:first-child { border-top: 0; }
.axislabel { padding-top: 9px; color: var(--sub); font-size: 12px; font-weight: 600; }
.axisrow.on .axislabel { color: var(--accent); }
.axisbody { min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; position: relative; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.card:hover { border-color: var(--line-strong); }
.card.hl { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.cardtop { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 15px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.cardtop .title { flex: 1; }
.title { font-size: 15px; font-weight: 650; line-height: 1.55; }
.ch { flex: none; padding: 3px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 10px; line-height: 1.5; white-space: nowrap; }
.cbody { color: var(--ink); font-size: 14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { padding: 2px 6px; border-radius: 4px; color: var(--sub); background: var(--panel); font-size: 10px; }
.cardbtns { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.flow { position: relative; display: flex; flex-direction: column; gap: 16px; }
.flow.multi { padding-left: 26px; }
.flow.multi::before { content: ""; position: absolute; top: 12px; bottom: 12px; left: 9px; width: 1px; background: var(--line-strong); }
.cstep { position: relative; min-width: 0; }
.cstep-n { position: absolute; top: 12px; left: -26px; display: grid; place-items: center; width: 19px; height: 19px; background: var(--accent-soft); color: var(--accent); border-radius: 50%; font-size: 10px; font-weight: 600; box-shadow: 0 0 0 3px var(--card); }
.cmsg { display: block; width: 100%; min-height: 48px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); font-size: 14px; line-height: 1.8; resize: none; overflow: hidden; }
.cmsg:focus { background: var(--card); }
.cstep-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.cstep-foot .copy { padding: 5px 10px; border-color: var(--line-strong); background: var(--card); color: var(--accent); font-size: 11px; }
.cstep-foot .copy:hover { border-color: var(--accent); background: var(--accent-soft); }
.cstep-foot .copy.done { background: var(--ok); color: var(--card); border-color: var(--ok); }
.cstep-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.cnote-in { width: 100%; padding: 6px 9px; margin-top: 8px; border: 0; border-left: 2px solid var(--line-strong); border-radius: 0; background: var(--panel); color: var(--sub); font-size: 12px; line-height: 1.6; }
.cnote-in:focus { box-shadow: none; background: var(--accent-soft); border-color: var(--accent); }
.slotadd, .subadd, .ministep, .tocadd { padding: 10px 13px; border: 1px dashed var(--line-strong); border-radius: 6px; background: transparent; color: var(--accent); font-size: 12px; text-align: left; }
.slotadd { width: 100%; }
.slotadd:hover, .subadd:hover, .ministep:hover, .tocadd:hover { background: var(--accent-soft); border-color: var(--accent); }
.subadd { margin-top: 14px; }
.subadd.wide { width: 100%; text-align: center; }
.tocadd { width: 100%; margin-top: 12px; }
.empty, .empty-state { padding: 40px 20px; color: var(--sub); font-size: 14px; text-align: center; line-height: 1.7; }
.reference-list .empty { padding: 24px 12px; font-size: 12px; }
.loading-state, .error-state { padding: 15px 17px; border: 1px solid var(--line); border-radius: 8px; color: var(--sub); font-size: 14px; line-height: 1.65; }
.error-state { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.loading-state { background: var(--panel); }
.msg.loading { padding: 13px 16px; border: 1px solid var(--line); border-radius: 8px; color: var(--sub); background: var(--panel); font-size: 14px; }
.msg.loading::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.error-state button { display: inline-flex; margin: 9px 0 0 9px; padding: 6px 10px; border: 1px solid var(--danger-line); border-radius: 5px; background: var(--card); color: var(--danger); font-size: 12px; }
.error-state button:hover { background: var(--danger-soft); }

/* Login: restrained brand welcome beside the form. */
#gate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 40px; overflow: auto; background: var(--bg); }
.login-scene { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: 100px; width: min(980px, 100%); margin: auto; }
.login-story { min-width: 0; }
.login-story .brand { margin: 0 0 64px; }
.login-story .brand img { width: 44px; height: 44px; }
.login-story h1 { margin: 0; color: var(--ink); font-size: clamp(32px, 3.2vw, 44px); line-height: 1.45; letter-spacing: -1.5px; font-weight: 600; word-break: keep-all; }
.login-story > p, .login-story > div > p { margin: 22px 0 0; font-size: 15px; line-height: 1.9; color: var(--sub); word-break: keep-all; }
.story-note { margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }
.story-note strong { display: block; margin-bottom: 5px; color: var(--accent); font-weight: 600; }
.login { width: 100%; max-width: 420px; padding: 36px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 12px 42px var(--shadow-soft); }
.login-bot { margin-bottom: 22px; }
.login-bot img, .login-bot svg { width: 38px; height: 38px; object-fit: contain; }
.login h2 { margin: 0 0 8px; font-size: 22px; font-weight: 650; letter-spacing: -.6px; }
.login p { margin: 0 0 27px; color: var(--sub); font-size: 13px; line-height: 1.7; }
.login label { display: block; margin: 17px 0 7px; color: var(--ink); font-size: 12px; font-weight: 600; }
.login input { display: block; width: 100%; min-height: 48px; padding: 12px; margin-bottom: 8px; border-color: var(--line-strong); border-radius: 7px; font-size: 15px; }
.login button { width: 100%; min-height: 48px; margin-top: 16px; padding: 12px; border: 0; border-radius: 7px; background: var(--action); color: var(--card); font-size: 14px; font-weight: 600; }
.login button:hover { background: var(--action-hover); }
.login .err { min-height: 18px; margin-top: 10px; color: var(--danger); font-size: 12px; line-height: 1.5; }
.switch { margin-top: 14px; color: var(--sub); font-size: 12px; line-height: 1.8; text-align: center; }
.switch a { margin-left: 3px; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-button, .login .text-button { display: inline; width: auto; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; color: var(--accent); background: transparent; font: inherit; cursor: pointer; }
.text-button:hover, .login .text-button:hover { color: var(--ink); background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.login .switch .text-button { margin-left: 3px; font-weight: 600; }
.login-foot { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; text-align: center; }

/* Dialogs retain all existing editing and administration workflows. */
#modal, #adminModal, #inqModal, #mapModal, #logPanel { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 24px; background: var(--overlay); z-index: 80; }
#adminModal { z-index: 85; }
#mapModal { z-index: 86; }
#logPanel { z-index: 88; }
#inqModal { z-index: 90; }
.sheet { width: min(640px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); padding: 26px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: 0 24px 80px var(--shadow-raised); }
.sheet h3 { margin: 0 0 22px; font-size: 18px; font-weight: 650; letter-spacing: -.3px; }
.f { margin-bottom: 16px; }
.f label { display: block; margin-bottom: 6px; color: var(--sub); font-size: 12px; line-height: 1.5; }
.f input, .f select, .f textarea { width: 100%; font-size: 14px; }
.f textarea { min-height: 130px; resize: vertical; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.sheetbtns { display: flex; justify-content: flex-end; gap: 8px; padding-top: 18px; margin-top: 8px; border-top: 1px solid var(--line); }
.save, .cancel { padding: 10px 16px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); color: var(--ink); font-size: 13px; font-weight: 500; }
.save { border-color: var(--action); background: var(--action); color: var(--card); }
.cancel:hover { background: var(--panel); }
.save:hover { background: var(--action-hover); }
.modetabs, .logtabs { display: flex; gap: 8px; margin-bottom: 20px; }
.modetab, .logtab { flex: 1; min-height: 42px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--sub); font-size: 13px; font-weight: 500; }
.modetab.on, .logtab.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.steprow { padding: 13px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.steprow .s-msg, .steprow .s-note { width: 100%; min-height: 68px; padding: 10px 12px; font-size: 14px; line-height: 1.7; resize: vertical; }
.steprow .s-note { min-height: 40px; margin-top: 7px; color: var(--accent); font-size: 12px; }
.steprow .s-del { margin-top: 8px; padding: 5px 9px; border: 1px solid var(--danger-line); border-radius: 5px; background: var(--card); color: var(--danger); font-size: 11px; }
#adminModal .sheet { width: min(760px, 100%); }
.adsec { margin-bottom: 26px; }
.adsec h4 { margin: 0 0 12px; font-size: 14px; font-weight: 650; color: var(--accent); }
.adrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; margin-bottom: 7px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.adrow > span { min-width: 0; overflow-wrap: anywhere; }
.adrow > span:last-child { flex-shrink: 0; }
.adrow.inq { align-items: flex-start; }
.adbtn { padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); color: var(--accent); font-size: 12px; font-weight: 500; }
.adbtn:hover { background: var(--accent-soft); }
.adbtn.del { color: var(--danger); border-color: var(--danger-line); }
.adbtn.syn { padding: 10px 14px; background: var(--action); color: var(--card); border-color: var(--action); }
.grade-badge, .mchip, .logent-mode { padding: 2px 6px; border: 1px solid var(--ok-line); border-radius: 4px; background: var(--ok-soft); color: var(--ok); font-size: 10px; font-weight: 500; }
.grade-badge.mk, .logent-mode { border-color: var(--pending-line); background: var(--pending-soft); color: var(--pending); }
.admuted { padding: 4px 0; color: var(--sub); font-size: 12px; line-height: 1.65; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.mcard { padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.mnum { color: var(--ink); font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -.7px; }
.mlbl { margin-top: 6px; font-size: 12px; font-weight: 600; }
.msub { margin-top: 5px; color: var(--sub); font-size: 10px; }
.mup { color: var(--ok); }
.mdn { color: var(--danger); }
.mrow2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; }
.mchip { background: var(--card); color: var(--sub); border-color: var(--line); }
.kbadd-ta { width: 100%; min-height: 100px; margin-bottom: 8px; font-size: 14px; resize: vertical; }
.synrow { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.synhint { margin-top: 12px; color: var(--sub); font-size: 12px; line-height: 1.7; }
.synhint code { padding: 2px 5px; background: var(--panel); border-radius: 3px; font-size: 11px; overflow-wrap: anywhere; }
.adlog { max-height: 46vh; overflow: auto; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; }
.logrow { display: flex; gap: 12px; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.logrow:last-child { border-bottom: 0; }
.logq { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.logedit { flex: none; }
.logsheet { display: flex; flex-direction: column; width: min(800px, 100%); overflow: hidden; }
.loglist { min-height: 0; flex: 1; overflow: auto; margin-bottom: 10px; }
.logentry { padding: 18px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; }
.logent-q { margin-bottom: 12px; font-size: 15px; font-weight: 600; line-height: 1.6; }
.logent-a { padding: 14px; margin-bottom: 12px; background: var(--panel); border-radius: 6px; color: var(--ink); font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.logent-name { color: var(--accent); font-size: 12px; font-weight: 600; }
.logent-mode { margin-left: 6px; }
.logmsg { display: block; width: 100%; min-height: 76px; padding: 13px 15px; margin-bottom: 9px; border-color: var(--line); background: var(--panel); font-size: 15px; line-height: 1.8; resize: vertical; overflow: hidden; }
.logmsg:focus { background: var(--card); }
.logapply { margin-top: 8px; }
.inqsheet { display: flex; flex-direction: column; width: min(680px, 100%); overflow: hidden; }
.maphead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.maphead h3 { margin: 0; }
.maphint { margin: 12px 0 8px; color: var(--sub); font-size: 12px; line-height: 1.75; }
.maphint b { color: var(--accent); font-weight: 600; }
.inqcount { display: inline-block; padding: 1px 6px; margin-left: 4px; border-radius: 4px; background: var(--danger-soft); color: var(--danger); font-size: 11px; vertical-align: middle; }
#inqList { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto; margin-top: 12px; }
.inqcard { padding: 17px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); }
.inq-q { font-size: 15px; font-weight: 600; line-height: 1.6; }
.inq-ctx { margin-top: 5px; font-size: 11px; color: var(--sub); }
.inq-ans { width: 100%; min-height: 90px; margin-top: 12px; font-size: 14px; resize: vertical; }
.inq-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.inq-st { font-size: 12px; }
.inq-done { padding-top: 10px; color: var(--ok); font-size: 13px; font-weight: 600; }
.mapsheet { display: flex; flex-direction: column; width: min(1100px, 100%); overflow: hidden; }
#mapBody { min-height: 0; overflow: auto; margin-top: 14px; }
.mapgrp { margin-bottom: 28px; }
.mapgrp-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gname { font-size: 14px; font-weight: 600; }
.gcov { color: var(--sub); font-size: 11px; }
.mapgrp-h .bar { flex: 1; max-width: 140px; height: 4px; border-radius: 2px; background: var(--accent-soft); overflow: hidden; }
.mapgrp-h .bar span { display: block; height: 100%; background: var(--accent); }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.matrix th, .matrix td { padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.matrix tr > :first-child { border-left: 1px solid var(--line); }
.matrix thead th { position: sticky; top: 0; z-index: 1; padding: 9px; border-top: 1px solid var(--line); background: var(--panel); color: var(--sub); font-size: 11px; font-weight: 500; white-space: nowrap; }
.matrix .corner { text-align: left; }
.matrix .rowh { min-width: 110px; padding: 10px; background: var(--panel); color: var(--ink); text-align: left; font-weight: 500; white-space: nowrap; }
.cell { display: flex; align-items: center; justify-content: center; gap: 5px; width: 100%; min-height: 42px; padding: 9px; border: 0; background: var(--card); font-size: 12px; }
.cell.on { background: var(--ok-soft); color: var(--ok); }
.cell.on:hover { background: var(--ok-soft); }
.cell.on .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.cell.on .n { font-size: 10px; }
.cell.off { color: var(--muted); }
.cell.off:hover { background: var(--accent-soft); color: var(--accent); }

/* Permissions and discreet confirmation messages. */
body.readonly .cardbtns, body.readonly .subadd, body.readonly .slotadd, body.readonly .tocadd,
body.readonly .ans-confirm, body.readonly .ans-fb, body.readonly .scope-box, body.readonly .logapply,
body.readonly .disbadge, body.readonly .cnote-in { display: none !important; }
body.readonly .cell.off { pointer-events: none; opacity: .35; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 150; width: max-content; max-width: calc(100vw - 32px); padding: 11px 17px; border: 1px solid var(--action); border-radius: 8px; background: var(--action); color: var(--card); font-size: 13px; line-height: 1.5; box-shadow: 0 7px 24px var(--shadow-raised); transform: translateX(-50%); }
.toast.error { border-color: var(--danger); background: var(--danger); }

@media (min-width: 1600px) {
  .workspace-header { padding-right: 42px; padding-left: 42px; }
  .chat-workspace { grid-template-columns: minmax(0, 1fr) 300px; gap: 30px; padding-right: 42px; padding-left: 42px; }
  #manualView { padding-right: 42px; padding-left: 42px; }
  .blog { padding-right: max(40px, calc((100% - 760px) / 2)); padding-left: max(40px, calc((100% - 760px) / 2)); }
}

@media (max-width: 1199px) {
  :root { --sidebar-width: 200px; }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .workspace-header { padding: 24px; }
  .chat-workspace { gap: 18px; padding: 0 24px 24px; grid-template-columns: minmax(0, 1fr) 260px; }
  .blog { padding: 24px; }
  .chat-welcome h2 { font-size: 26px; }
  .suggestion { padding: 14px; }
  #manualView { padding: 0 24px 24px; }
  .manual-layout { grid-template-columns: 165px minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 1099px) {
  .chat-workspace { display: flex; }
  #bot { flex: 1; }
  .reference-panel { display: none; }
  .chat-welcome { max-width: 580px; }
  .login-scene { gap: 60px; }
  .login { padding: 30px; }
  .manual-layout { grid-template-columns: 155px minmax(0, 1fr); gap: 18px; }
  .axisrow { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .axislabel { padding-top: 0; }
}

@media (max-width: 800px) {
  :root { --sidebar-width: 176px; }
  .sidebar { padding: 25px 10px 16px; }
  .brand { gap: 8px; margin: 0 6px 34px; }
  .brand img { width: 31px; height: 31px; }
  .brand strong, .brand b { font-size: 15px; }
  .brand > span { font-size: 14px; }
  .brand small { font-size: 9px; }
  .nav-item { gap: 8px; padding: 11px 10px; font-size: 13px; }
  .sidebar-section { margin-top: 24px; padding-top: 18px; }
  .sidebar-note { margin-right: 8px; margin-left: 8px; font-size: 11px; }
  .workspace-header { align-items: flex-start; padding: 22px 20px; }
  .page-heading h1 { font-size: 23px; }
  .page-heading p { font-size: 12px; }
  .header-actions .toolbtn { padding: 9px; font-size: 12px; }
  .header-actions kbd { display: none; }
  .chat-workspace { padding: 0 20px 20px; }
  .bh { padding: 14px 18px; }
  .blog { padding: 24px; }
  .chat-welcome { padding: 12px 0; }
  .chat-welcome h2 { font-size: 26px; }
  .suggestion-grid { margin-top: 25px; }
  .suggestion { min-height: 112px; }
  .composer { padding: 13px 18px 15px; }
  .composer-hint { font-size: 10px; }
  #manualView { padding: 0 20px 20px; }
  .manual-layout { display: flex; flex-direction: column; gap: 16px; overflow: auto; }
  .toc { flex: none; max-height: 200px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
  #content { overflow: visible; min-height: auto; padding-right: 0; }
  .manual-toolbar { gap: 8px; }
  .manual-toolbar .search { max-width: none; }
  .login-scene { gap: 40px; }
  .login-story h1 { font-size: 31px; }
  .login-story > p { font-size: 13px; }
  .login-story > div > p { font-size: 13px; }
  .login { padding: 28px; }
}

@media (max-width: 639px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { display: grid; grid-template-columns: 1fr auto; flex: none; gap: 12px; padding: 14px 18px 0; border-right: 0; border-bottom: 1px solid var(--line); background: var(--bg); overflow: visible; }
  .sidebar .brand { margin: 0; }
  .sidebar .brand img { width: 28px; height: 28px; }
  .sidebar .brand strong, .sidebar .brand b { font-size: 15px; }
  .sidebar .brand > span { display: block; font-size: 14px; }
  .sidebar .brand small { display: none; }
  .nav-main { grid-column: 1 / -1; grid-row: 2; flex-direction: row; gap: 22px; }
  .nav-main .nav-item { justify-content: center; width: auto; min-height: 43px; padding: 8px 1px 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--sub); font-size: 13px; }
  .nav-main .nav-item.active { color: var(--ink); background: var(--accent-soft); border-bottom-color: transparent; border-radius: 5px; }
  .nav-main .nav-item svg { width: 17px; height: 17px; }
  .sidebar > .sidebar-section { display: none; }
  .sidebar .nav-main[aria-label="관리 메뉴"] { grid-row: 3; justify-content: flex-start; flex-wrap: wrap; gap: 0 12px; margin-top: -12px; }
  .sidebar .nav-main[aria-label="관리 메뉴"]:not(:has(#inquiryBtn:not([hidden]))) { display: none; }
  .sidebar .nav-main[aria-label="관리 메뉴"] .nav-item { min-height: 34px; padding: 5px 1px 8px; gap: 5px; font-size: 10px; white-space: nowrap; }
  .sidebar .nav-main[aria-label="관리 메뉴"] .nav-item svg { width: 13px; height: 13px; }
  .sidebar-section > p, .sidebar-section > small, .sidebar-section > h2, .sidebar-label { display: none; }
  .sidebar-section .nav-item { width: auto; min-height: 36px; gap: 4px; padding: 6px; font-size: 11px; }
  .sidebar-section .nav-item svg { width: 15px; height: 15px; }
  .sidebar-bottom { grid-column: 2; grid-row: 1; display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; }
  .sidebar-note, .user-avatar, .profile-avatar, #userRole { display: none; }
  .user-profile { padding: 0; border: 0; }
  #userName { max-width: 70px; font-size: 11px; }
  #logoutBtn { width: auto; padding: 5px; font-size: 10px; }
  #logoutBtn svg { width: 14px; height: 14px; }
  .workspace { flex: 1; }
  .workspace-header { gap: 10px; padding: 18px 18px 16px; align-items: center; }
  .page-heading small { display: none; }
  .page-heading h1 { font-size: 21px; }
  .page-heading p { display: none; }
  .header-actions { gap: 5px; }
  .header-actions .toolbtn { min-height: 34px; padding: 7px 9px; font-size: 11px; }
  .header-actions button > svg { width: 15px; height: 15px; }
  .chat-workspace { padding: 0; }
  #bot { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
  .bh { min-height: 43px; padding: 9px 18px; }
  .chat-context { font-size: 10px; gap: 6px; }
  .chat-tools button { font-size: 10px; min-height: 26px; }
  .blog { gap: 20px; padding: 22px 20px 26px; }
  .chat-welcome { padding: 4px 0 12px; }
  .welcome-symbol { margin-bottom: 18px; }
  .welcome-symbol img { width: 34px; height: 34px; }
  .eyebrow { margin-bottom: 7px; font-size: 9px; }
  .chat-welcome h2 { font-size: 25px; letter-spacing: -.8px; }
  .chat-welcome > p:not(.eyebrow):not(.welcome-foot) { margin-top: 12px; font-size: 13px; line-height: 1.8; }
  .suggestion-grid { gap: 8px; margin-top: 24px; }
  .suggestion { min-height: 105px; gap: 4px; padding: 13px; }
  .suggestion-icon { margin-bottom: 4px; height: 18px; }
  .suggestion-icon svg { width: 17px; height: 17px; }
  .suggestion-title { font-size: 13px; }
  .suggestion-desc { font-size: 11px; line-height: 1.5; }
  .welcome-foot { margin-top: 18px; font-size: 10px; }
  .composer { padding: 10px 16px max(12px, env(safe-area-inset-bottom)); }
  .channel-tabs { margin-bottom: 8px; gap: 19px; }
  .channel-tab { font-size: 11px; }
  .bin { gap: 8px; padding: 10px 10px 10px 12px; }
  #bq { min-height: 48px; max-height: 120px; font-size: 16px; line-height: 1.6; }
  #bsend { min-width: 36px; min-height: 36px; padding: 8px 10px; }
  #bsend span { display: none; }
  .composer-hint { margin-top: 7px; font-size: 9px; }
  .composer-hint > :last-child:not(:first-child) { display: none; }
  .msg { max-width: 94%; font-size: 15px; }
  .msg.u { padding: 10px 14px; }
  .step-msg, .ans-text { font-size: 16px; line-height: 1.75; }
  .step-msg { padding: 14px; }
  .step-actions .step-meta, .answer-actions .action-note { width: 100%; margin-left: 0; }
  .answer-hint { display: none; }
  .ans-policy, .ans-caut { font-size: 12px; }
  .step-copy, .ans-copy, .copy, .save-all, .ans-confirm, .save-card { min-height: 38px; }
  #manualView { padding: 0 16px 20px; }
  .manual-toolbar { margin-bottom: 15px; }
  .manual-search { max-width: none; flex-basis: 100%; }
  .manual-toolbar .search { width: 100%; flex-basis: 100%; font-size: 16px; }
  .manual-toolbar .toolbtn { font-size: 11px; padding: 8px 10px; }
  #manualCount { font-size: 11px; }
  .manual-layout { gap: 20px; }
  .toc { max-height: 180px; }
  #toc { display: flex; flex-wrap: wrap; gap: 6px; }
  .category-link { width: auto; margin: 0; padding: 7px 9px; font-size: 11px; }
  .category-link .cnt { font-size: 9px; }
  .sec-title { font-size: 20px; }
  .card { padding: 16px; }
  .manual-card { padding: 0; }
  .manual-card .cardtop { padding: 16px; gap: 8px; }
  .card-detail { padding: 0 16px 16px; }
  .subgroup.dis { padding: 14px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .cmsg { font-size: 16px; }
  .axisrow { gap: 9px; }
  #gate { align-items: flex-start; padding: 30px 20px; }
  .login-scene { display: flex; flex-direction: column; gap: 28px; width: 100%; max-width: 400px; }
  .login-story { width: 100%; }
  .login-story .brand { margin: 0 0 30px; }
  .login-story .brand img { width: 34px; height: 34px; }
  .login-story h1 { font-size: 29px; line-height: 1.4; letter-spacing: -1px; }
  .login-story > p, .login-story > div > p { margin-top: 14px; font-size: 13px; }
  .story-note { display: none; }
  .login { padding: 26px; }
  .login-bot { display: none; }
  .login h2 { font-size: 20px; }
  .login input { font-size: 16px; }
  #modal, #adminModal, #inqModal, #mapModal, #logPanel { padding: 12px; }
  .sheet { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 20px; border-radius: 10px; }
  .sheet h3 { font-size: 17px; }
  .two { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .f input, .f textarea, .f select, .steprow .s-msg, .steprow .s-note, .inq-ans, .kbadd-ta, .logmsg, .fb-form textarea { font-size: 16px; }
  .adrow { flex-wrap: wrap; align-items: flex-start; gap: 9px; }
  .adrow > span:last-child { display: flex; flex-wrap: wrap; gap: 5px; }
  .logtabs { gap: 5px; }
  .logtab, .modetab { font-size: 11px; padding: 9px 6px; }
  .logentry { padding: 14px; }
  .maphead h3 { font-size: 15px; }
  .maphead .cancel { padding: 8px 10px; font-size: 12px; }
  .mapgrp-h { flex-wrap: wrap; }
  .toast { bottom: max(18px, env(safe-area-inset-bottom)); font-size: 12px; }
}

@media (max-width: 359px) {
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .sidebar-section .nav-item { padding: 5px; font-size: 10px; }
  .sidebar-section .nav-item svg { display: none; }
  .nav-main { gap: 18px; }
  .workspace-header { padding-right: 14px; padding-left: 14px; }
  .blog { padding-right: 16px; padding-left: 16px; }
  .chat-welcome h2 { font-size: 23px; }
  .suggestion { padding: 11px; }
}

/* Keep the first-use choices visible on typical laptop and phone screens. */
@media (max-height: 800px), (max-width: 639px) {
  .chat-welcome { padding: 5px 0; }
  .welcome-symbol { display: none; }
  .chat-welcome .eyebrow { margin-bottom: 8px; }
  .chat-welcome h2 { font-size: 25px; line-height: 1.45; }
  .chat-welcome h2 br { display: none; }
  .chat-welcome > p:not(.eyebrow):not(.welcome-foot) { margin-top: 10px; font-size: 13px; line-height: 1.7; }
  .suggestion-grid { margin-top: 18px; gap: 8px; }
  .suggestion { min-height: 74px; padding: 13px; gap: 5px; justify-content: center; }
  .suggestion-icon { display: none; }
  .suggestion-title { padding-right: 8px; font-size: 13px; }
  .suggestion-desc { font-size: 11px; line-height: 1.5; }
  .suggestion > svg { top: 14px; right: 10px; width: 12px; height: 12px; }
  .welcome-foot { display: none; }
}

@media (max-height: 800px) and (min-width: 640px) {
  .sidebar { padding-top: 24px; }
  .sidebar .brand { margin-bottom: 24px; }
  .sidebar > .sidebar-section { margin-top: 18px; margin-bottom: 8px; }
  .sidebar > .brand + .sidebar-section { margin-top: 0; }
  .nav-item { min-height: 42px; padding-top: 10px; padding-bottom: 10px; }
  .sidebar-note { margin-bottom: 18px; padding-top: 20px; }
  .sidebar-note p { display: none; }
  .workspace-header { padding-top: 22px; padding-bottom: 20px; }
  .blog { padding: 20px 26px; }
  .composer { padding-top: 12px; padding-bottom: 12px; }
  .reference-tip { margin-top: 16px; padding: 14px; }
  .reference-tip h3 { margin: 7px 0; font-size: 15px; }
  .reference-tip h3 br { display: none; }
  .reference-tip p { font-size: 11px; }
  .reference-card { padding: 13px; }
  .reference-card p { -webkit-line-clamp: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Shared documents and reviewed changes. */
.document-view { display: flex; flex-direction: column; min-height: 0; padding: 0 32px 28px; }
.document-workspace, .template-workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; flex: 1; min-height: 0; min-width: 0; overflow: hidden; }
.document-workspace.context-open { grid-template-columns: 260px minmax(0, 1fr) 260px; gap: 20px; }
.document-toc { padding-top: 10px; }
.document-toc .category-link { align-items: flex-start; padding: 11px 10px; line-height: 1.6; white-space: nowrap; word-break: keep-all; }
.document-toc .category-link > span:first-child { display: flex; flex-shrink: 0; gap: 9px; align-items: baseline; }
.document-toc .category-link small { color: var(--muted); font-size: 10px; font-weight: 400; font-variant-numeric: tabular-nums; }
.toc-question { padding-top: 4px; color: var(--pending); font-size: 7px; }
.document-panel { min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 32px 36px 48px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.manual-document { max-width: 840px; margin: 0 auto; }
.doc-kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--accent); font-size: 11px; font-weight: 600; }
.doc-kicker span { color: var(--muted); font-size: 10px; font-weight: 400; }
.doc-title-row { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.doc-title-row h2 { flex: 1 1 200px; margin: 0; font-size: 26px; font-weight: 600; line-height: 1.45; letter-spacing: -.7px; word-break: keep-all; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.doc-actions .mini { padding: 6px 9px; font-size: 11px; }
.doc-updated { margin: -10px 0 28px; color: var(--muted); font-size: 11px; }
.doc-body { color: var(--ink); font-size: 15px; line-height: 1.9; overflow-wrap: anywhere; }
.doc-body > p { margin: 0 0 22px; white-space: pre-wrap; }
.doc-body > p:last-child { margin-bottom: 0; }
.doc-body strong { font-weight: 650; }
.doc-body blockquote { margin: 18px 0 24px; padding: 12px 16px; border-left: 2px solid var(--line-strong); background: var(--panel); color: var(--sub); font-size: 13px; line-height: 1.8; }
.doc-body blockquote p { margin: 0; white-space: pre-wrap; }
.doc-body h2, .doc-body h3, .doc-body h4 { margin: 28px 0 13px; color: var(--ink); font-size: 18px; line-height: 1.6; font-weight: 600; letter-spacing: -.2px; }
.doc-body h2:first-child, .doc-body h3:first-child, .doc-body h4:first-child { margin-top: 0; }
.doc-review-note { margin-bottom: 24px; padding: 13px 15px; border-left: 2px solid var(--line-strong); background: var(--panel); color: var(--sub); font-size: 12px; line-height: 1.75; }
.doc-review-note strong { font-size: 11px; font-weight: 600; }
.doc-review-note p { margin: 6px 0 0; white-space: pre-wrap; }
.doc-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 35px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--sub); }
.doc-footer > span { margin-left: auto; font-size: 10px; color: var(--muted); }
.doc-footer .text-button { font-size: 12px; }
.question-link { padding: 4px 8px; border: 1px solid var(--pending-line); border-radius: 4px; background: var(--pending-soft); color: var(--pending); font-size: 11px; }
.doc-editor label, .review-sheet label, .document-inquiry label, .context-item-body label, .answer-feedback label { display: block; margin-bottom: 16px; color: var(--sub); font-size: 12px; line-height: 1.6; }
.doc-editor label > span, .document-inquiry label > span { margin-left: 5px; color: var(--muted); font-size: 10px; }
.doc-editor input, .doc-editor textarea, .doc-editor select, .review-sheet input, .review-sheet textarea, .review-sheet select, .document-inquiry textarea, .context-item-body textarea, .context-item-body select, .answer-feedback textarea, .answer-feedback select { display: block; width: 100%; max-width: 100%; margin-top: 7px; color: var(--ink); font-size: 14px; }
#sectionBody, #reviewDocumentBody { min-height: 380px; padding: 17px; font-size: 15px; line-height: 1.85; resize: vertical; }
#sectionReviewNote { min-height: 70px; resize: vertical; }
.editor-preview { margin-bottom: 18px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.editor-preview summary { width: fit-content; color: var(--accent); font-size: 12px; cursor: pointer; }
.editor-preview .doc-body { padding: 22px 0 5px; }
.editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.editor-actions > span { width: 100%; color: var(--sub); font-size: 11px; line-height: 1.7; }
.conflict-note { margin: 14px 0; padding: 14px; border: 1px solid var(--pending-line); border-radius: 7px; background: var(--pending-soft); color: var(--pending); font-size: 12px; line-height: 1.7; }
.conflict-note p { margin: 6px 0 12px; }
.conflict-note summary { cursor: pointer; font-weight: 600; }
.conflict-note .doc-body { max-height: 280px; margin: 12px 0; padding: 12px; overflow: auto; background: var(--card); color: var(--ink); font-size: 13px; }
.conflict-note .mini { margin-top: 9px; }
.document-inquiry { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.document-inquiry > summary { color: var(--accent); font-size: 12px; cursor: pointer; }
#newInquiryForm { margin-top: 22px; }
.document-inquiry textarea { min-height: 76px; resize: vertical; }
.form-status { display: block; margin: 9px 0 0; color: var(--sub); font-size: 11px; line-height: 1.75; white-space: pre-wrap; }

/* Feedback and director questions stay beside the section being read. */
.context-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--line); padding-left: 18px; }
.context-tabs { display: flex; flex: none; gap: 16px; border-bottom: 1px solid var(--line); }
.context-tabs button { display: flex; gap: 5px; align-items: center; padding: 9px 0 13px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--sub); background: transparent; font-size: 12px; }
.context-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.context-tabs button > span { font-size: 10px; color: var(--muted); }
.context-filter { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 8px; margin: 14px 0 7px; color: var(--sub); font-size: 10px; }
.context-filter label { display: flex; align-items: center; gap: 5px; }
.context-filter input { min-height: 0; width: 12px; height: 12px; margin: 0; accent-color: var(--accent); box-shadow: none; }
.context-filter .text-button { font-size: 10px; }
.context-list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.context-empty { padding: 28px 3px; color: var(--sub); font-size: 11px; line-height: 1.8; }
.context-empty strong { color: var(--sub); font-size: 12px; font-weight: 500; }
.context-empty p { margin: 9px 0; }
.context-item { border-bottom: 1px solid var(--line); padding: 16px 0; }
.context-item > summary { display: block; list-style: none; cursor: pointer; }
.context-item > summary::-webkit-details-marker { display: none; }
.context-item > summary > strong { display: block; margin: 7px 0 6px; color: var(--ink); font-size: 12px; font-weight: 550; line-height: 1.65; word-break: keep-all; }
.context-item > summary > small { color: var(--muted); font-size: 10px; line-height: 1.6; }
.review-status { display: inline-block; font-size: 9px; line-height: 1.6; color: var(--ok); letter-spacing: .1px; }
.review-status.pending { color: var(--pending); }
.context-item[open] > summary { margin-bottom: 16px; }
.context-item-body { font-size: 12px; line-height: 1.7; }
.context-item-body > p { margin: 5px 0 14px; color: var(--sub); white-space: pre-wrap; overflow-wrap: anywhere; }
.context-label { color: var(--muted); font-size: 10px; }
.context-item-body label { margin-top: 14px; font-size: 11px; }
.context-item-body select { min-height: 36px; padding: 8px; font-size: 11px; }
.context-item-body textarea { min-height: 130px; padding: 10px; font-size: 13px; resize: vertical; }
.context-item-body .save { padding: 8px 10px; font-size: 11px; }
.context-item-body .inquiry-scope { min-height: 92px; }
.context-item-body label > span { margin-left: 4px; color: var(--pending); font-size: 10px; }
.context-item-body .inquiry-publish-note { color: var(--sub); font-size: 11px; line-height: 1.7; }
.context-muted { color: var(--sub) !important; font-size: 11px; }
.resolution-note { margin: 12px 0; padding: 11px; border-left: 2px solid var(--ok-line); background: var(--ok-soft); color: var(--ok); font-size: 12px; line-height: 1.8; white-space: pre-wrap; }
.resolution-note p { margin: 7px 0 0; }
.patient-wait { margin: 17px 0; padding: 13px 15px; border-left: 2px solid var(--line-strong); background: var(--panel); color: var(--sub); font-size: 12px; line-height: 1.75; }
.answer-sources { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 17px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.answer-sources button { font-size: 11px; }
.answer-feedback { margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.answer-feedback h4 { margin: 0 0 7px; font-size: 14px; font-weight: 600; }
.feedback-form-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.feedback-form-head .text-button { flex: none; font-size: 12px; }
.feedback-comparison { margin: 0 0 17px; font-size: 12px; }
.feedback-comparison summary { cursor: pointer; color: var(--accent); }
.feedback-comparison > span { display: block; margin-top: 14px; color: var(--sub); font-size: 11px; }
.feedback-comparison > p { margin: 6px 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.feedback-followup { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.feedback-followup .form-status { width: 100%; margin: 0; }
.answer-feedback > p { margin: 0 0 17px; color: var(--sub); font-size: 12px; line-height: 1.75; }
.answer-feedback textarea { min-height: 100px; resize: vertical; }
.answer-feedback .feedback-scope-note { margin-top: -3px; color: var(--sub); font-size: 11px; }
.feedback-sent { margin: 0 !important; color: var(--ok) !important; }
.ans-inq > .mini { margin-top: 12px; }

/* Reference templates preserve their original three-message flow. */
.template-intro { margin: -5px 0 32px; color: var(--sub); font-size: 13px; line-height: 1.8; }
.template-message { margin: 0 0 30px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.template-message:last-child { margin-bottom: 0; border-bottom: 0; }
.template-message-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.template-message-head > span { color: var(--sub); font-size: 11px; }
.template-original { color: var(--ink); font-size: 16px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.template-document .step-context { margin-top: 17px; }

/* Review dialogs use plain full-document editors rather than auto-generated rewrites. */
.dialog-overlay, #adminModal.dialog-overlay, #mapModal.dialog-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 90; background: var(--overlay); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.dialog-head h3 { margin: 0; }
.history-sheet, .review-sheet { width: min(840px,100%); }
.history-entry { padding: 17px 0; border-bottom: 1px solid var(--line); }
.history-entry > summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: 13px; cursor: pointer; }
.history-entry > summary > span { color: var(--sub); font-size: 11px; }
.history-entry h4 { font-size: 17px; font-weight: 600; }
.history-entry .doc-body { margin: 20px 0; }
.feedback-summary { margin-bottom: 24px; padding: 16px; border-left: 2px solid var(--line-strong); background: var(--panel); font-size: 13px; line-height: 1.75; }
.feedback-summary p { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-summary summary { color: var(--accent); font-size: 11px; cursor: pointer; }
.feedback-summary h4 { margin: 17px 0 6px; color: var(--sub); font-size: 11px; }
.review-explainer { color: var(--sub); font-size: 12px; line-height: 1.7; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.review-actions > span { width: 100%; color: var(--sub); font-size: 12px; line-height: 1.7; }
.admin-footnote { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--sub); font-size: 12px; line-height: 1.8; }

@media (max-width: 1399px) {
  .document-workspace.context-open { grid-template-columns: 260px minmax(0, 1fr); overflow: auto; }
  .document-workspace.context-open .document-panel { min-height: 450px; overflow: auto; }
  .document-workspace.context-open .context-panel { grid-column: 2; max-height: 500px; min-height: 220px; padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .document-workspace.context-open .document-toc { grid-row: 1 / 3; }
}
@media (max-width: 1199px) {
  .document-view { padding: 0 24px 24px; }
  .document-workspace, .document-workspace.context-open, .template-workspace { gap: 18px; }
  .document-panel { padding: 28px; }
  .doc-title-row h2 { font-size: 24px; }
}
@media (max-width: 999px) {
  .document-view { padding: 0 20px 20px; }
  .document-workspace, .document-workspace.context-open, .template-workspace { display: flex; flex-direction: column; gap: 15px; overflow: auto; }
  .document-toc { flex: none; max-height: 170px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); }
  .document-toc #toc, .document-toc #templateToc { display: flex; flex-wrap: wrap; gap: 5px; }
  .document-toc .category-link { width: auto; margin: 0; padding: 7px; font-size: 11px; }
  .document-toc .category-link small { display: none; }
  .document-toc .toc-h { margin-bottom: 7px; font-size: 10px; }
  .document-panel, .document-workspace.context-open .document-panel { flex: none; min-height: 350px; overflow: auto; padding: 25px; }
  .document-workspace.context-open .context-panel { flex: none; min-height: 240px; max-height: 520px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
  .manual-toolbar .manual-search { max-width: none; }
}
@media (max-width: 639px) {
  .sidebar .nav-main[aria-label="주 메뉴"] { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
  .sidebar .nav-main[aria-label="주 메뉴"] .nav-item { min-width: 0; font-size: 11px; white-space: nowrap; }
  .sidebar .nav-main[aria-label="주 메뉴"] .nav-item > svg { display: none; }
  .sidebar .nav-main[aria-label="관리 메뉴"] { display: flex; }
  .sidebar .nav-main[aria-label="관리 메뉴"]:not(:has(#inquiryBtn:not([hidden]))) { display: flex; }
  .document-view { padding: 0 14px 16px; }
  .document-panel, .document-workspace.context-open .document-panel { padding: 22px 18px 28px; }
  .document-toc { max-height: 144px; }
  .doc-title-row h2 { flex-basis: 100%; font-size: 23px; }
  .doc-title-row { gap: 9px; margin-bottom: 20px; }
  .doc-body { font-size: 16px; line-height: 1.85; }
  .doc-actions { padding-top: 0; }
  .doc-actions .mini { min-height: 36px; }
  #contextToggle { font-size: 11px; }
  #manualCount { margin-right: auto; }
  .doc-editor input, .doc-editor textarea, .doc-editor select, .review-sheet input, .review-sheet textarea, .review-sheet select, .document-inquiry textarea, .context-item-body textarea, .context-item-body select, .answer-feedback textarea, .answer-feedback select { font-size: 16px; }
  #sectionBody, #reviewDocumentBody { min-height: 320px; padding: 12px; font-size: 16px; }
  .context-item > summary > strong { font-size: 14px; }
  .context-item-body { font-size: 13px; }
  .context-item-body .save { min-height: 40px; font-size: 12px; }
  .answer-feedback { padding: 15px; }
  .step-buttons .answer-feedback-button, .step > .step-actions .step-copy { min-height: 38px; }
  .template-original { font-size: 16px; }
  .template-document .doc-title-row .save { padding: 9px 13px; }
  .dialog-overlay, #adminModal.dialog-overlay, #mapModal.dialog-overlay { padding: 12px; }
  .review-sheet, .history-sheet { padding: 20px; }
  .dialog-head h3 { font-size: 16px; }
  .dialog-head .cancel { padding: 8px 10px; }
}

/* Conversation and a situation index share the available workspace width. */
body[data-view="chat"] .workspace-header { display: none; }
body[data-view="chat"] .page-heading > small, body[data-view="chat"] .page-heading > p { display: none; }
body[data-view="chat"] .page-heading h1 { font-size: 22px; }
.chat-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; width: 100%; max-width: none; align-self: stretch; padding: 16px 20px 14px; }
.chat-workspace #bot { flex: 1; }
.chat-workspace .blog { gap: 10px; padding: 14px 20px; }
.chat-workspace .msg { line-height: 1.55; }
.chat-workspace .msg.u { padding: 6px 12px; }
.chat-workspace .chat-welcome { max-width: 600px; padding: 24px 0; }
.chat-workspace .chat-welcome h2 { font-size: 25px; letter-spacing: -.6px; }
.chat-workspace .chat-welcome > p { font-size: 14px; line-height: 1.8; }
.chat-workspace .suggestion-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chat-workspace .suggestion { display: inline-flex; width: auto; min-height: 40px; padding: 9px 14px; border-radius: 20px; font-size: 13px; color: var(--sub); }
.chat-workspace .composer { padding: 9px 20px 10px; }
.composer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 9px; }
.composer-mode { display: flex; align-items: center; gap: 10px; min-width: 0; }
.composer-mode > label { flex: none; color: var(--sub); font-size: 12px; white-space: nowrap; }
.channel-buttons { display: flex; align-items: center; gap: 4px; min-width: 0; }
.channel-buttons > button { min-height: 32px; padding: 6px 10px; border: 0; border-radius: 4px; background: var(--panel); color: var(--ink); font-size: 12px; font-weight: 500; white-space: nowrap; }
.channel-buttons > button:hover { background: var(--hover); }
.channel-buttons > button[aria-pressed="true"] { background: var(--action); color: #fff; font-weight: 600; }
.chat-workspace .bin { padding: 9px 12px; }
.chat-workspace #bq { min-height: 48px; }
.chat-workspace #bsend { min-height: 44px; min-width: 44px; }
.chat-workspace .composer-hint { margin-top: 5px; font-size: 10px; }
.chat-workspace .step { --bubble-bg: #fffefa; --bubble-line: #eeece6; position: relative; display: grid; grid-template-columns: minmax(0,1fr) max-content; margin: 0 0 8px; padding: 0; border: 1px solid var(--bubble-line); border-radius: 14px 14px 14px 4px; background: var(--bubble-bg); }
.chat-workspace .step::before { content: ""; position: absolute; top: 13px; left: -6px; width: 7px; height: 10px; background: var(--bubble-bg); clip-path: polygon(100% 0,100% 100%,0 0); }
.chat-workspace .step:focus-within { border-color: #ccc9bf; }
.chat-workspace .step-content { display: flex; align-items: center; min-width: 0; padding: 14px 16px; }
.chat-workspace .step-msg { min-height: 1.55em; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 16px; line-height: 1.55; }
.chat-workspace .step-msg:focus { background: transparent; box-shadow: none; }
.chat-workspace .step > .step-actions { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; gap: 4px; min-width: 112px; margin: 0; padding: 6px 7px; border-left: 1px solid var(--bubble-line); border-radius: 0 13px 13px 0; background: #fafaf8; }
.step-caption { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 6px; white-space: nowrap; }
.chat-workspace .step-h { margin: 0; font-size: 10px; line-height: 14px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--sub); white-space: nowrap; }
.chat-workspace .step-edit-status { margin: 0; font-size: 10px; color: var(--ok); white-space: nowrap; }
.chat-workspace .step-edit-status:empty { display: none; }
.chat-workspace .step-buttons { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 4px; }
.chat-workspace .step-buttons .answer-feedback-button, .chat-workspace .step > .step-actions .step-copy { display: inline-flex; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: center; width: 100%; min-height: 26px; margin: 0; padding: 4px 8px; border: 1px solid #e4e3de; border-radius: 5px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 500; line-height: 16px; white-space: nowrap; }
.chat-workspace .step-buttons .answer-feedback-button:hover:not(:disabled), .chat-workspace .step > .step-actions .step-copy:hover:not(:disabled) { background: #f3f3ef; border-color: #ccc9bf; color: var(--ink); }
.chat-workspace .answer-actions { gap: 8px; margin: 4px 0 0; padding: 0; border: 0; }
.chat-workspace .ans-copy { min-height: 28px; padding: 3px 9px; background: var(--card); color: var(--accent); border-color: var(--line-strong); font-size: 12px; font-weight: 500; }
.chat-workspace .ans-copy:hover:not(:disabled) { background: var(--accent-soft); color: var(--action); border-color: var(--accent); }
.chat-workspace .patient-wait { margin: 4px 0; padding: 0; border: 0; background: transparent; font-size: 12px; line-height: 1.5; }
.answer-details { flex: 1 1 200px; color: var(--sub); font-size: 12px; }
.answer-details > summary { width: fit-content; cursor: pointer; padding: 3px 0; }
.answer-detail-body { padding: 8px 14px; border-left: 2px solid var(--line); font-size: 12px; line-height: 1.8; }
.answer-detail-body > p { margin: 0 0 8px; }
.answer-detail-body .answer-sources { margin: 0; padding: 0; border: 0; }
.chat-workspace .answer-feedback { margin: 12px 0 18px; padding: 18px; background: var(--card); }
.chat-workspace .answer-feedback h4 { font-size: 13px; }
.chat-workspace .answer-feedback textarea { min-height: 76px; }
.chat-workspace .answer-feedback label > span { color: var(--sub); font-size: 11px; }
.chat-workspace .feedback-comparison > .feedback-section-label { margin-top: 14px; }
.chat-workspace .feedback-scope-note:empty { display: none; }
.reference-sheet { display: flex; flex-direction: column; width: min(480px,100%); height: min(740px,85dvh); padding: 24px; overflow: hidden; }
.reference-sheet .dialog-head { flex: none; margin-bottom: 18px; }
.reference-sheet #referenceQ { flex: none; width: 100%; margin-bottom: 16px; }
.reference-sheet .reference-list { flex: 1; }
.reference-sheet .situation-link { min-height: 46px; }
.reference-sheet .situation-copy strong { white-space: nowrap; }
.reference-sheet .reference-footer { flex: none; }
.reference-reading { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.reference-reading-toolbar { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.reference-reading-toolbar button { padding: 5px 0; font-size: 12px; }
.reference-article { flex: 1; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; padding: 2px 3px 12px; overflow-wrap: anywhere; }
.reference-article:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.reference-kicker { margin-bottom: 7px; color: var(--sub); font-size: 11px; }
.reference-article > h4 { margin: 0 0 18px; font-size: 17px; font-weight: 600; line-height: 1.5; word-break: keep-all; }
.reference-article .doc-review-note { margin-bottom: 16px; padding: 8px 10px; }
.reference-body { font-size: 14px; line-height: 1.75; }
.reference-body > p { margin-bottom: 14px; }
.reference-body h2, .reference-body h3, .reference-body h4 { margin: 20px 0 9px; font-size: 15px; line-height: 1.6; }
.reference-body blockquote { margin: 12px 0 16px; padding: 8px 10px; font-size: 13px; }
@media (max-width: 800px) {
  .chat-workspace { padding: 12px; }
  .chat-workspace .blog { padding: 12px 16px; }
}
@media (max-width: 639px) {
  body[data-view="chat"] .workspace-header { padding: 8px; }
  body[data-view="chat"] .page-heading h1 { font-size: 19px; }
  .chat-workspace { padding: 0; }
  .chat-workspace .blog { padding: 12px; }
  .chat-workspace .chat-welcome h2 { font-size: 22px; }
  .chat-workspace .chat-welcome > p { font-size: 13px; }
  .chat-workspace .composer { padding: 7px 12px max(8px, env(safe-area-inset-bottom)); }
  .chat-workspace .step-content { padding: 12px; }
  .chat-workspace .step > .step-actions .step-copy, .chat-workspace .step-buttons .answer-feedback-button { min-height: 30px; }
  .chat-workspace .ans-copy { min-height: 32px; }
  .chat-workspace .answer-feedback { padding: 15px; }
  .reference-sheet { padding: 20px; }
}

/* Small rectangular patient buttons; selection uses fill without a line. */
.patient-toolbar { display: flex; align-items: center; flex: none; min-width: 0; height: 52px; padding: 8px 12px; background: var(--card); gap: 8px; }
.patient-tabs { display: flex; flex: 0 1 auto; align-items: center; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 0; gap: 6px; }
.patient-tabs::-webkit-scrollbar { display: none; }
.patient-tab-wrap { display: flex; flex: 0 0 120px; align-items: center; min-width: 0; height: 34px; padding: 0 3px 0 0; border-radius: 4px; background: var(--panel); color: var(--sub); }
.patient-tab-wrap:hover { background: var(--hover); color: var(--ink); }
.patient-tab-wrap.active { background: var(--selected); color: var(--ink); }
.patient-tab, .patient-close { border: 0; background: transparent; color: inherit; cursor: pointer; }
.patient-tab { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; height: 100%; padding: 0 8px 0 12px; text-align: left; font-size: 13px; white-space: nowrap; }
.patient-tab-wrap.active .patient-tab { font-weight: 600; }
.patient-tab-name { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.patient-close { display: grid; place-items: center; flex: none; width: 26px; height: 30px; padding: 0; border-radius: 5px; color: var(--muted); font-size: 17px; font-weight: 400; opacity: 0; }
.patient-tab-wrap.active .patient-close, .patient-tab-wrap:hover .patient-close, .patient-tab-wrap:focus-within .patient-close { opacity: 1; }
.patient-close:hover { background: var(--card); color: var(--ink); }
.patient-tab:focus-visible, .patient-close:focus-visible { outline-offset: -3px; }
.patient-tab-dot { width: 5px; height: 5px; flex: none; border-radius: 50%; background: var(--ok); }
.patient-tab-dot.pending { background: var(--pending); }
.patient-name-input { flex: 1; width: 0; min-width: 0; min-height: 28px; height: 28px; margin-left: 5px; padding: 3px 5px; border: 0; border-radius: 3px; background: var(--card); color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.5; }
.patient-name-input:focus { border: 0; box-shadow: none; outline: none; background: var(--card); }
#newChatBtn, #headerManual { display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none; align-self: center; min-height: 32px; margin: 0; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--sub); font-size: 12px; }
#newChatBtn { width: auto; min-height: 34px; padding: 6px 9px; border-radius: 4px; background: var(--panel); white-space: nowrap; }
#headerManual { margin-left: auto; }
#newChatBtn:hover, #headerManual:hover { background: var(--panel); color: var(--ink); }
#newChatBtn svg, #headerManual svg { width: 17px; height: 17px; }
@media (hover: none) { .patient-close { opacity: 1; } }
#patientConversation { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.patient-sheet { width: min(420px,100%); padding: 24px; }
.patient-sheet label { display: block; font-size: 13px; margin-bottom: 8px; }
.patient-sheet input { width: 100%; margin-bottom: 18px; }
.patient-sheet p { font-size: 14px; line-height: 1.8; margin-bottom: 20px; }
/* One set of reference controls acts as a right column or a drawer. */
#referenceModal.is-docked { position: static; display: flex; min-width: 0; min-height: 0; padding: 0; background: transparent; z-index: auto; align-items: stretch; justify-content: stretch; }
#referenceModal.is-docked .reference-sheet { width: 100%; height: 100%; max-height: none; min-height: 0; padding: 18px 14px 12px; border: 1px solid var(--line); border-radius: 10px; box-shadow: none; background: var(--card); }
#referenceModal.is-docked .dialog-head { margin-bottom: 14px; }
#referenceModal.is-docked .dialog-head h3 { font-size: 15px; letter-spacing: -.3px; }
#referenceModal.is-docked #referenceQ { min-height: 37px; font-size: 12px; padding: 8px 10px; margin-bottom: 12px; }
#referenceModal.is-docked .reference-list { gap: 0; }
#referenceModal.is-docked .situation-link { min-height: 42px; padding: 8px 3px; }
#referenceModal.is-docked .situation-copy strong { font-size: 12px; font-weight: 500; white-space: nowrap; }
#referenceModal.is-docked .situation-link > svg { width: 11px; height: 11px; }
#referenceModal.is-docked .reference-footer { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; }
#referenceModal.is-docked .reference-footer button { font-size: 11px; }
@media (max-width: 1199px) {
  .chat-workspace { display: flex; }
  #referenceModal:not(.is-docked) { justify-content: flex-end; padding: 12px; }
  #referenceModal:not(.is-docked) .reference-sheet { width: min(360px,100%); height: 100%; max-height: none; }
}
@media (max-width: 639px) {
  .patient-toolbar { height: 48px; padding: 7px 6px; gap: 4px; }
  .patient-tabs { gap: 5px; }
  .patient-tab-wrap { flex-basis: 110px; }
  .patient-tab { padding-left: 9px; font-size: 12px; }
  .patient-close { width: 28px; height: 34px; }
  .patient-name-input { font-size: 16px; }
  #headerManual { padding: 6px; gap: 4px; font-size: 11px; }
}

/* Conversation recovery is explained once on the empty screen and always available at the composer. */
.conversation-recovery { margin-top: 22px; }
.conversation-recovery > strong { color: var(--ink); font-size: 13px; font-weight: 600; }
.conversation-recovery > p { margin: 5px 0 11px; color: var(--sub); font-size: 12px; line-height: 1.7; word-break: keep-all; }
.conversation-recovery > button { padding: 8px 12px; background: var(--panel); border-color: var(--line); font-size: 12px; }
.conversation-import-trigger { margin-left: auto; padding: 3px 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; white-space: nowrap; }
.conversation-import-trigger:hover { color: var(--ink); }
.conversation-import-sheet { width: min(680px,100%); }
.conversation-import-sheet > p { margin: -5px 0 22px; color: var(--sub); font-size: 14px; line-height: 1.8; }
.conversation-import-sheet form > label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
#conversationImportText { display: block; width: 100%; min-height: 240px; max-height: 45dvh; resize: vertical; font-size: 14px; }
.conversation-import-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; margin-top: 8px; color: var(--sub); font-size: 11px; }
#conversationImportStatus { color: var(--danger); }
#conversationImportSubmit { margin-top: 10px; }
.imported-conversation { flex: none; width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 6px; color: var(--sub); font-size: 12px; }
.imported-conversation summary { cursor: pointer; }
.imported-conversation pre { max-height: 240px; margin: 14px 0 0; overflow: auto; color: var(--ink); font: inherit; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation-wait-notice { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 14px; }
.conversation-wait-notice strong { font-size: 14px; font-weight: 600; }
.conversation-wait-notice p { margin: 8px 0; line-height: 1.8; white-space: pre-wrap; }
.conversation-wait-notice small, .staff-only-label { color: var(--sub); font-size: 12px; line-height: 1.7; }
.staff-only-label { margin: 0 0 8px; }
@media (max-width: 639px) {
  .composer-mode { flex: 1 1 100%; gap: 8px; }
  .composer-mode > label { font-size: 11px; }
  .channel-buttons { flex: 1; gap: 3px; }
  .channel-buttons > button { flex: 1; padding: 6px; font-size: 11px; }
  .conversation-import-trigger { font-size: 11px; }
  #conversationImportText { font-size: 16px; min-height: 210px; }
  .conversation-import-sheet { padding: 20px; }
  .conversation-recovery { margin-top: 18px; }
}


/* Shared specialty filters keep their labels on one line at every viewport. */
.specialty-filters { display: flex; align-items: center; flex: none; flex-wrap: nowrap; gap: 6px; min-width: 0; max-width: 100%; margin: -6px 0 18px; padding: 2px 0 5px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; overscroll-behavior-x: contain; }
.specialty-filters > button { flex: none; min-height: 33px; padding: 7px 12px; border: 0; border-radius: 5px; background: transparent; color: var(--sub); font-size: 12px; line-height: 1.5; white-space: nowrap; word-break: keep-all; }
.specialty-filters > button:hover { background: var(--panel); color: var(--ink); }
.specialty-filters > button[aria-pressed="true"] { background: var(--selected); color: var(--ink); font-weight: 600; }
.reference-specialty-label { display: flex; align-items: center; flex: none; gap: 10px; margin: 0 0 10px; color: var(--sub); font-size: 11px; white-space: nowrap; }
.reference-specialty-label select { flex: 1; min-width: 0; min-height: 32px; padding: 5px 28px 5px 9px; font-size: 12px; }
.inquiry-move-note:empty { display: none; }
@media (max-width: 639px) {
  .specialty-filters { gap: 4px; margin-bottom: 12px; }
  .specialty-filters > button { padding: 7px 10px; font-size: 11px; }
  .reference-specialty-label select { font-size: 16px; }
}
