.right-tabs {
  display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 0;
  align-items: center; flex-shrink: 0;
}
.right-tabs button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 12px; font-size: 14px; font-weight: 500; border: 1px solid transparent; border-radius: 8px;
  background: transparent; cursor: pointer; color: var(--text-muted); font-family: inherit;
}
.right-tabs button:hover { color: var(--text); background: var(--bg-app); }
.right-tabs button.is-active {
  color: var(--accent); background: var(--accent-soft); font-weight: 600;
  border: 1px solid var(--accent-border); box-shadow: inset 0 -2px 0 var(--accent);
}
.right-tabs button:focus:not(:focus-visible) { outline: none; }
.right-tabs button:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.right-tab__icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notify-btn:focus:not(:focus-visible) { outline: none; }
.notify-btn:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.btn-cite:focus:not(:focus-visible) { outline: none; }
.btn-cite:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.right-panel-bd { padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.cust-analysis-stack { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; border-top: 1px solid var(--border); }
.layout-customer-detail.cust-detail-cite-open .cust-analysis-stack { flex-direction: row; align-items: stretch; }
.layout-customer-detail.cust-detail-cite-open .cust-chat-main {
  flex: 1; min-width: 0; min-height: 0;
}
.layout-customer-detail.cust-detail-cite-open .cust-cite-bottom:not([hidden]) {
  flex: 0 0 minmax(260px, 42%); max-width: min(480px, 46vw); min-height: 0;
  max-height: none; border-top: none; border-left: 1px solid var(--border);
}
@media (max-width: 900px) {
  .layout-customer-detail.cust-detail-cite-open .cust-analysis-stack { flex-direction: column; }
  .layout-customer-detail.cust-detail-cite-open .cust-cite-bottom:not([hidden]) {
    flex: 1 1 auto; max-width: none; border-left: none; border-top: 1px solid var(--border);
    max-height: min(42vh, 340px);
  }
}
.cust-chat-main { flex: 1; min-width: 0; min-height: 220px; display: flex; flex-direction: column; }
.chat-thread { flex: 1; overflow-y: auto; padding: 12px; background: var(--bg-app); }
.chat-row { display: flex; margin-bottom: 10px; }
.chat-row--user { justify-content: flex-end; }
.chat-row--bot { justify-content: flex-start; }
.chat-bubble { max-width: 92%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.chat-bubble--user { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble--user .btn-cite { border-color: rgba(255,255,255,.85); color: #fff; background: rgba(255,255,255,.12); }
.chat-bubble--bot { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-bubble .chat-meta { font-size: 10px; opacity: .85; margin-bottom: 4px; letter-spacing: .04em; }
.cust-cite-bottom { flex-shrink: 0; border-top: 1px solid var(--border); background: var(--bg-app); display: flex; flex-direction: column; max-height: min(38vh, 320px); min-height: 0; }
.cust-cite-bottom[hidden] { display: none !important; }
.cust-cite-bottom-hd { flex-shrink: 0; padding: 8px 12px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-app); }
.cust-cite-bottom-bd { flex: 1; overflow-y: auto; padding: 12px; font-size: 13px; min-height: 0; }
.cite-prose { line-height: 1.65; color: var(--text); }
.cite-prose .cite-lead { font-size: 12px; color: var(--text-muted); margin: 0 0 0.75rem; padding: 10px 12px; background: var(--accent-bg-tint); border-radius: 8px; border-left: 3px solid var(--accent); }
.cite-doc-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; margin-bottom: 12px;
}
.cite-doc-card:last-child { margin-bottom: 0; }
.cite-prose--readable .cite-doc-card--readable {
  border-radius: 12px; padding: 18px 20px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); border-color: #e2e6ea;
}
.cite-prose--readable .cite-doc-card--readable:last-child { margin-bottom: 0; }
.cite-prose--readable .cite-lead {
  font-size: 13px; line-height: 1.55; padding: 12px 14px;
}
.cite-prose--readable .cite-card-title { font-size: 15px; }
.cite-prose--readable .cite-card-body { font-size: 14px; line-height: 1.65; }
.cite-doc-card__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.cite-doc-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--border); color: var(--text-muted); }
.cite-card-more { font-size: 12px; font-weight: 600; color: var(--accent); background: none; border: none; cursor: pointer; padding: 4px 0; font-family: inherit; }
.cite-card-more:hover { text-decoration: underline; }
.cite-card-more:focus:not(:focus-visible) { outline: none; }
.cite-card-more:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
.cite-card-title { font-size: 14px; font-weight: 700; margin: 0 0 6px; color: var(--text); line-height: 1.35; }
.cite-card-meta { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; }
.cite-card-body { line-height: 1.6; font-size: 13px; }
.cite-card-body h5 { font-size: 13px; margin: 0 0 0.5rem; color: var(--accent); }
.cite-card-body p { margin: 0 0 0.85rem; text-align: left; }
.cite-card-body p:last-child { margin-bottom: 0; }
.citation-panel .cp-bd.cite-prose { max-width: none; }
.chat-input-wrap {
  display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface);
  align-items: flex-end;
}
.chat-composer-inner {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 14px; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  min-height: 48px;
  padding: 6px 58px 6px 12px;
}
.chat-input-wrap .chat-composer-inner .chat-input {
  flex: 1; min-width: 0; min-height: 44px; max-height: 140px;
  padding: 10px 6px 10px 4px; border: none; border-radius: 0; box-shadow: none; background: transparent;
  font-family: inherit; font-size: 14px; resize: none; line-height: 1.5;
}
.chat-input-wrap .chat-composer-inner .chat-input::placeholder {
  line-height: 1.45;
}
.chat-composer-send {
  position: absolute; right: 6px; bottom: 6px; padding: 8px 14px; font-size: 13px;
  border-radius: 10px; font-weight: 600; flex-shrink: 0;
}
.chat-composer-send:focus:not(:focus-visible) { outline: none; }
.chat-composer-send:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.msg { margin-bottom: 12px; max-width: 100%; }
.msg-user .bubble { background: var(--accent-soft); border: 1px solid var(--bubble-border); }
.msg-assistant .bubble { background: var(--surface); border: 1px solid var(--border); }
.bubble { padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.bubble .label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.bubble-suggest { font-size: 13px; color: var(--text-muted); font-style: italic; }
.cite-btn-wrap { margin-top: 10px; }
.btn-cite { font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--accent); background: #fff; color: var(--accent); font-weight: 600; cursor: pointer; }

/* ========== 예시 보기 칩 (composer 위) ========== */
.chat-example-row {
  display: flex; justify-content: flex-end; align-items: center; padding: 4px 14px; background: var(--surface);
}
.chat-example-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: 12px; font-weight: 600; line-height: 1;
  color: var(--accent); background: var(--accent-soft, rgba(0, 97, 180, 0.08));
  border: 1px solid var(--accent-border, rgba(0, 97, 180, 0.3));
  border-radius: 999px; cursor: pointer; font-family: inherit;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.chat-example-chip:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.chat-example-chip:active:not(:disabled) { transform: translateY(1px); }
.chat-example-chip:disabled {
  opacity: 0.55; cursor: not-allowed;
}
.chat-example-chip:focus:not(:focus-visible) { outline: none; }
.chat-example-chip:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.chat-example-chip__icon { width: 12px; height: 12px; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: currentColor; stroke: currentColor; }

/* ========== 어시스턴트 pending(생각중) 버블 ========== */
.chat-bubble--pending { min-width: 64px; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); opacity: 0.45;
  animation: typingBlink 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBlink {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* ========== 리치 답변(섹션/약관 인용/출처) ========== */
.chat-bubble--rich { max-width: 100%; width: 100%; white-space: normal; padding: 12px 16px; }
.chat-bubble--streaming::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  animation: streamCaret 0.9s steps(1) infinite;
  font-weight: 500;
}
@keyframes streamCaret {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}
.chat-bubble--streaming .rich-answer > *,
.chat-bubble--streaming .rich-answer li,
.chat-bubble--streaming .rich-answer .rich-section-ico {
  animation: streamBlockIn 0.26s ease both;
}
@keyframes streamBlockIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
.rich-answer { font-size: 13px; line-height: 1.65; color: var(--text); }
.rich-answer .rich-lead { margin: 0 0 10px; font-size: 13px; line-height: 1.65; }
.rich-answer .rich-lead strong { color: var(--accent); }
.rich-answer .rich-divider {
  height: 1px; background: var(--border); margin: 12px 0;
}
.rich-answer .rich-section-title {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 0 10px; font-size: 13px; font-weight: 700; color: var(--text);
}
.rich-answer .rich-section-ico { font-size: 14px; line-height: 1; }
.rich-answer .rich-clauses {
  margin: 0; padding: 0; list-style: none; counter-reset: rich-clause;
  display: flex; flex-direction: column; gap: 12px;
}
.rich-answer .rich-clauses > li {
  counter-increment: rich-clause;
  position: relative;
  padding: 10px 12px 10px 38px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.rich-answer .rich-clauses > li::before {
  content: counter(rich-clause);
  position: absolute; left: 10px; top: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.rich-answer .rich-clause-head {
  margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--text);
}
.rich-answer .rich-clause-meta,
.rich-answer .rich-clause-desc {
  margin: 0 0 4px; font-size: 12.5px; line-height: 1.6; color: var(--text);
}
.rich-answer .rich-clause-meta:last-child,
.rich-answer .rich-clause-desc:last-child { margin-bottom: 0; }
.rich-answer .rich-clause-meta strong,
.rich-answer .rich-clause-desc strong { color: var(--text-muted); font-weight: 600; }
.rich-answer .rich-sources {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}
.rich-answer .rich-sources > li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; background: var(--bg-app);
  border: 1px dashed var(--border); border-radius: 6px;
  font-size: 12.5px;
}
.rich-answer .rich-src-name {
  font-weight: 600; color: var(--text);
  word-break: break-all;
}
/* PDF로 연결되는 파일명은 버튼 형태 — 기본 브라우저 스타일을 리셋하고 링크처럼 보이게 함 */
button.rich-src-name {
  background: none; border: 0; padding: 0;
  font: inherit; color: var(--accent, #2256c7);
  text-align: left; cursor: pointer;
  text-decoration: underline; text-decoration-style: dotted;
  text-underline-offset: 3px;
}
button.rich-src-name:hover,
button.rich-src-name:focus-visible {
  color: var(--accent, #2256c7);
  text-decoration-style: solid;
}
button.rich-src-name:focus-visible {
  outline: 2px solid var(--accent, #2256c7);
  outline-offset: 2px;
  border-radius: 3px;
}
button.js-open-pdf.is-pdf-unavailable {
  color: var(--text-muted);
  text-decoration-line: line-through;
  text-decoration-style: solid;
  cursor: not-allowed;
  opacity: 0.65;
}
button.js-open-pdf.is-pdf-unavailable:hover,
button.js-open-pdf.is-pdf-unavailable:focus-visible {
  color: var(--text-muted);
  text-decoration-style: solid;
}
.rich-answer .rich-src-desc { color: var(--text-muted); font-size: 12px; }

/* ========== 에이전트 스타일 로딩 단계(trace) ========== */
.chat-row--trace { margin-bottom: 6px; }
.agent-trace {
  max-width: 100%; width: 100%;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--bg-app) 0%, var(--surface) 100%);
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 12.5px; line-height: 1.55; color: var(--text);
}
.agent-steps {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
}
.agent-steps::before {
  content: ""; position: absolute;
  left: 9px; top: 10px; bottom: 10px;
  width: 1px; background: var(--border);
  pointer-events: none;
}
.agent-step {
  position: relative; padding-left: 30px;
  animation: streamBlockIn 0.24s ease both;
}
.agent-step__icon {
  position: absolute; left: 0; top: 0;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  z-index: 1;
}
.agent-step__icon svg { width: 12px; height: 12px; }
.agent-step__spinner {
  border-color: var(--border);
  border-top-color: var(--accent);
  animation: agentSpin 0.8s linear infinite;
}
@keyframes agentSpin {
  to { transform: rotate(360deg); }
}
.agent-step.is-running .agent-step__label {
  color: var(--text); font-weight: 600;
}
.agent-step.is-running .agent-step__label::after {
  content: ""; display: inline-block;
  width: 14px; text-align: left; color: var(--text-muted);
  animation: agentDots 1.4s steps(4, end) infinite;
}
@keyframes agentDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
  100% { content: ""; }
}
.agent-step.is-done .agent-step__icon {
  border-color: var(--accent); background: var(--accent); color: #fff;
  animation: none;
}
.agent-step.is-done .agent-step__icon svg { stroke: #fff; }
.agent-step.is-done .agent-step__label {
  color: var(--text-muted); font-weight: 500;
}
.agent-step__label { font-size: 12.5px; }
.agent-step-detail-wrap {
  margin-top: 8px;
  animation: streamBlockIn 0.28s ease both;
}
.agent-step-detail {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px; line-height: 1.6;
}
.agent-detail-head {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--text);
}
.agent-detail-ico { font-size: 13px; line-height: 1; }
.agent-detail-sub {
  margin: 8px 0 4px; font-size: 11.5px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.agent-detail-list {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 4px;
}
.agent-detail-list > li {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 12.5px;
}
.agent-detail-list:not(.agent-detail-list--bullet) > li .agent-detail-lbl {
  min-width: 72px; color: var(--text-muted); font-weight: 500;
}
.agent-detail-list:not(.agent-detail-list--bullet) > li .agent-detail-val {
  color: var(--text); font-weight: 500;
}
.agent-detail-list--bullet { padding-left: 2px; }
.agent-detail-list--bullet > li::before {
  content: "•"; color: var(--accent); margin-right: 6px; font-weight: 700;
}
.agent-detail-timeline {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}
.agent-detail-timeline > li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 6px 8px; background: var(--bg-app); border-radius: 6px;
}
.agent-tl-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--accent); font-weight: 700;
  white-space: nowrap;
}
.agent-tl-text { font-size: 12.5px; color: var(--text); line-height: 1.5; }
.agent-tl-text em { font-style: normal; color: var(--text-muted); font-size: 11.5px; }

/* 리치 답변 추가 요소 */
.rich-answer .rich-note {
  margin: 0 0 10px; padding: 8px 12px;
  background: var(--bg-app); border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0; font-size: 12.5px; line-height: 1.6;
}
.rich-answer .rich-bullet {
  margin: 0 0 6px; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}
.rich-answer .rich-bullet > li {
  position: relative; padding-left: 18px; font-size: 13px; line-height: 1.6;
}
.rich-answer .rich-bullet > li::before {
  content: "✔"; position: absolute; left: 0; top: 0;
  color: var(--accent); font-weight: 700;
}
.rich-answer .rich-formula {
  margin: 6px 0 0; padding: 8px 10px;
  background: var(--surface); border: 1px dashed var(--accent-border, rgba(0, 97, 180, 0.3));
  border-radius: 6px;
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12.5px;
}
.rich-answer .rich-formula-lbl {
  font-size: 11px; font-weight: 700; color: var(--accent);
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 6px; background: var(--accent-soft, rgba(0, 97, 180, 0.08));
  border-radius: 4px; flex-shrink: 0;
}
.rich-answer .rich-formula-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}
.rich-answer .rich-summary {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-app); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
}
.rich-answer .rich-summary > li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; font-size: 13px;
}
.rich-answer .rich-summary > li + li { border-top: 1px solid var(--border); }
.rich-answer .rich-summary-lbl { color: var(--text-muted); }
.rich-answer .rich-summary-val { color: var(--text); font-weight: 500; }
.rich-answer .rich-summary-total {
  background: var(--accent-soft, rgba(0, 97, 180, 0.08));
}
.rich-answer .rich-summary-total .rich-summary-lbl { color: var(--accent); font-weight: 700; }
.rich-answer .rich-summary-total .rich-summary-val { color: var(--accent); font-size: 14px; }

/* ========== 후속질문 칩 ========== */
.followup-wrap {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.followup-title {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.followup-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; font-size: 12.5px; line-height: 1.3; text-align: left;
  color: var(--accent); background: #fff;
  border: 1px solid var(--accent-border, rgba(0, 97, 180, 0.3));
  border-radius: 999px; cursor: pointer; font-family: inherit; font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  max-width: 100%;
}
.followup-chip:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.followup-chip:disabled { opacity: 0.55; cursor: not-allowed; }
.followup-chip:focus:not(:focus-visible) { outline: none; }
.followup-chip:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.followup-chip__icon { width: 12px; height: 12px; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.followup-chip > span { white-space: normal; }
.qna-composer textarea { width: 100%; min-height: 100px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-family: inherit; font-size: 13px; resize: vertical; }
.composer-foot { display: flex; justify-content: flex-end; margin-top: 8px; gap: 8px; }
