/* TDS 기준 글꼴. 공식 배포본(v1.3.9, SIL OFL)을 fonts/에 두고 직접 제공한다. */
@font-face {
  font-family: "Pretendard Variable";
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
  src: url("/static/fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f2f4f6;
  --text: #191f28;
  --text-soft: #4e5968;
  --muted: #6b7684;
  --line: #e5e8eb;
  --line-strong: #d1d6db;
  --blue: #2c74db;
  --blue-pressed: #1b64da;
  --blue-soft: #e8f3ff;
  --danger: #f04452;
  --warning: #f59f00;
  --success: #16834c;
  --warning-strong: #a86600;
  --purple: #7655d6;
  --shadow: 0 12px 32px rgba(25, 31, 40, 0.08);
  /* 모서리: 작은 요소 6 · 입력·버튼 8 · 카드 12 · 큰 요약 카드 16 · 칩은 999px */
  --radius-sm: 6px;
  --control-radius: 8px;
  --radius-card: 12px;
  --radius-lg: 16px;
  /* 버튼 높이: 큰 버튼(모달·폼 확인, 로그인) 44 · 기본 40 · 작은 버튼 36 */
  --button-height-lg: 44px;
  --button-height: 40px;
  --button-height-compact: 36px;
  /* 입력창·선택창은 같은 줄의 큰 버튼과 높이를 맞춘다. */
  --control-height: 44px;
  /* 칩: 기본 32px(필터·템플릿·후속 질문), 작은 칩 28px(답변 위 검색 조건·기준). 글자는 모두 13px. */
  --chip-height: 32px;
  --chip-height-sm: 28px;
  --chip-font-size: 13px;
  /* 제목: 페이지·모달·상세 패널 20 · 강조 헤드라인 17 · 섹션 15 */
  --font-title: 20px;
  --font-headline: 17px;
  --font-section: 15px;
  --button-font-size: 14px;
  --button-font-size-compact: 13px;
  --button-weight: 600;
  --focus-ring-color: color-mix(in srgb, var(--blue) 16%, transparent);
  --focus-ring: 0 0 0 3px var(--focus-ring-color);
  /* 강조색으로 채운 요소 위의 글자색 */
  --on-accent: #ffffff;
  --on-danger: #ffffff;
  --chart-1: #3182f6;
  --chart-2: #1cab63;
  --chart-3: #f59f00;
  --chart-4: #f04452;
  --chart-5: #8b5cf6;
  --chart-6: #0ea5b7;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #111318;
  --surface: #1b1f27;
  --surface-alt: #242a34;
  --text: #eef2f7;
  --text-soft: #c4ccd8;
  --muted: #8f9aaa;
  --line: #303743;
  --line-strong: #465061;
  --blue: #5b9bff;
  --blue-pressed: #3c7ee8;
  --blue-soft: #17283f;
  --danger: #ff6b78;
  --warning: #ffbe3d;
  --success: #34d399;
  --warning-strong: #fbbf24;
  --purple: #a78bfa;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  /* var(--blue)는 선언한 요소에서 계산되므로 다크 모드의 --blue로 포커스 색을 다시 만든다. */
  --focus-ring-color: color-mix(in srgb, var(--blue) 16%, transparent);
  --focus-ring: 0 0 0 3px var(--focus-ring-color);
  /* 밝은 파랑 위에는 흰 글자 대비가 2.77 이라 어두운 글자를 쓴다 */
  --on-accent: #111318;
  --on-danger: #111318;
  --chart-1: #5b9bff;
  --chart-2: #34d399;
  --chart-3: #ffbe3d;
  --chart-4: #ff6b78;
  --chart-5: #a78bfa;
  --chart-6: #22d3ee;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* TDS 기준 글꼴은 Pretendard. 기기에 설치돼 있으면 쓰고, 없으면 시스템 글꼴로 대신한다. */
  font-family: "Pretendard Variable", Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

[hidden],
.model-control-hidden {
  display: none !important;
}

/* 화면에는 숨기고 스크린리더에만 읽히는 글자 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* '데이터 기준' 배지(modules/data_badge.js). 화면마다 같은 상태 이름과 색을 쓴다. */
.data-badge-slot {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.data-badge-slot:empty {
  display: none;
}

.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 19.5px;
  font-weight: 600;
  white-space: nowrap;
}

.data-badge .ui-icon {
  transition: transform 0.16s ease;
}

.data-badge[aria-expanded="true"] .ui-icon {
  transform: rotate(180deg);
}

.data-badge:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.data-badge-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: currentColor;
}

.data-badge.is-fresh { background: color-mix(in srgb, var(--success) 10%, transparent); color: var(--success); }
.data-badge.is-fresh .data-badge-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.data-badge.is-refreshing { background: var(--blue-soft); color: var(--blue); }
.data-badge.is-partial,
.data-badge.is-warning { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning-strong); }
.data-badge.is-snapshot { background: var(--surface-alt); color: var(--text-soft); }
.data-badge.is-error { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.data-badge.is-loading { background: var(--surface-alt); color: var(--muted); }
.data-badge.is-refreshing .data-badge-dot,
.data-badge.is-loading .data-badge-dot { animation: data-badge-pulse 1s ease-in-out infinite; }

@keyframes data-badge-pulse { 50% { opacity: 0.35; } }

.data-badge-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.data-badge-pop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.data-badge-pop-head strong {
  color: var(--text);
  font-size: 15px;
  line-height: 22.5px;
  font-weight: 700;
}

.data-badge-pop-head span {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.data-badge-pop ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.data-badge-pop li {
  display: grid;
  grid-template-columns: 16px 72px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 19.5px;
}

.data-badge-pop li .ui-icon { margin-top: 3px; }
.data-badge-pop li.is-ok { color: var(--success); }
.data-badge-pop li.is-warn { color: var(--warning-strong); }
.data-badge-pop li.is-error { color: var(--danger); }
.data-badge-pop li.is-pending { color: var(--blue); }
.data-badge-pop li b { color: var(--text); font-weight: 600; }
.data-badge-pop li > span:last-child { color: var(--text-soft); overflow-wrap: anywhere; }

.data-badge-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13px;
  line-height: 19.5px;
}

.data-badge-note.is-partial,
.data-badge-note.is-warning { background: color-mix(in srgb, var(--warning) 14%, transparent); }
.data-badge-note.is-error { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.data-badge-retry {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 19.5px;
  font-weight: 600;
}

.data-badge-retry:hover { background: var(--surface-alt); }
.data-badge-retry:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.chat-header > .data-badge-slot {
  margin-left: auto;
}

/* 공통 아이콘(index.html 의 스프라이트). 크기는 width·height 속성이나 놓인 자리의 CSS가 정한다. */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ui-icon {
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

/* 숫자 옆 증감 화살표처럼 작은 자리는 선을 조금 굵게 해 글자 무게와 맞춘다. */
.ui-icon.is-bold {
  stroke-width: 2.2;
}

body.modal-open {
  overflow: hidden;
}

body.auth-pending {
  overflow: hidden;
}

body.auth-pending .app-shell {
  visibility: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  /* WebGL 장면을 못 쓰거나 그리기 전에 보이는 정지 배경 */
  background:
    radial-gradient(circle at 18% 34%, color-mix(in srgb, var(--blue) 16%, transparent), transparent 26%),
    radial-gradient(circle at 84% 70%, color-mix(in srgb, var(--purple) 13%, transparent), transparent 24%),
    radial-gradient(circle at 50% 12%, color-mix(in srgb, var(--blue) 13%, transparent), transparent 34%),
    var(--bg);
}

/* auth_scene.js가 그리는 3D 배경. 첫 장면을 그린 뒤 is-ready로 서서히 나타난다. */
.auth-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease;
}

.auth-scene.is-ready {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .auth-scene {
    transition: none;
  }
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 32px 32px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 28px 90px rgba(25, 31, 40, 0.14);
  backdrop-filter: blur(18px) saturate(1.2);
}

/* 서비스 이름은 작게 위에 두고, '로그인' 제목이 카드의 주인공이 되게 한다. */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.auth-brand div {
  display: grid;
  gap: 2px;
}

.auth-brand strong {
  color: var(--text);
  font-size: 15px;
}

.auth-brand span:not(.brand-mark) {
  color: var(--muted);
  font-size: 13px;
}

.auth-checking {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 52px 12px 24px;
  color: var(--muted);
  font-size: 14px;
}

.auth-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: auth-spin 0.75s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.login-form {
  display: grid;
  gap: 14px;
  padding-top: 24px;
}

.login-form > div:first-child {
  margin-bottom: 8px;
}

.login-form h2 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  line-height: 1.35;
}

.login-form p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  outline: 0;
  background: var(--surface);
  color: var(--text);
}

.password-field { position: relative; display: block; }
.login-form .password-field input { padding-right: 46px; }
.password-toggle {
  position: absolute; top: 50%; right: 4px; display: grid; place-items: center; width: 36px; height: 36px;
  padding: 0; border: 0; border-radius: var(--control-radius); background: transparent; color: var(--muted); cursor: pointer; transform: translateY(-50%);
}
.password-toggle:hover { background: var(--surface-alt); color: var(--text); }
.password-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.login-form input:focus {
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

.auth-primary-button {
  min-height: var(--button-height-lg);
  margin-top: 4px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--blue);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: var(--button-weight);
}

.auth-primary-button:hover {
  background: var(--blue-pressed);
}

.auth-primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.auth-link-button {
  justify-self: center;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: var(--button-weight);
}

.auth-link-button:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.login-error {
  margin: 0 !important;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(240, 68, 82, 0.09);
  color: var(--danger) !important;
  font-size: 13px;
  line-height: 1.5;
}

.login-error.is-success {
  background: color-mix(in srgb, var(--success) 10%, transparent);
  color: var(--success) !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  --rail-w: 76px;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(245, 247, 250, 0) 240px),
    var(--bg);
}

body.theme-dark .app-shell {
  background:
    linear-gradient(180deg, rgba(27, 31, 39, 0.84), rgba(17, 19, 24, 0) 240px),
    var(--bg);
}

.app-shell:not([data-view="chat"]) .sidebar {
  display: none;
}

/* 앱 공통 사이드바. 좁은 화면에서는 아래 탭바가 된다(responsive.css). */
.app-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  height: 100vh;
  height: 100dvh;
  padding: 16px 8px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.rail-header {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.rail-brand {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

.rail-brand:hover {
  background: var(--surface-alt);
}

.rail-items {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.rail-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 56px;
  padding: 6px 2px;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

/* 활성·hover 표시는 칸 전체 대신 아이콘 뒤 알약 모양으로만 둔다. */
.rail-item .ui-icon {
  box-sizing: content-box;
  width: 20px;
  height: 20px;
  padding: 6px 16px;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.rail-item:hover {
  color: var(--text);
}

.rail-item:hover .ui-icon {
  background: var(--surface-alt);
}

.rail-item.is-active {
  color: var(--text);
  font-weight: 700;
}

.rail-item.is-active .ui-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.rail-brand:focus-visible,
.rail-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* 읽지 않은 알림 · 승인 대기 수는 아이콘 오른쪽 위에 붙인다. */
.rail-item em, .rail-subitem em {
  position: absolute;
  top: 2px;
  left: calc(50% + 8px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--on-danger);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.rail-subitem em { position: static; display: inline-block; margin-left: 6px; vertical-align: middle; }
.rail-subitem em[hidden] { display: none; }

.rail-account {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-top: auto;
}

/* 접은 메뉴에서는 계정 버튼 위, 펼친 메뉴에서는 계정 버튼 오른쪽에 둔다. */
.rail-theme-toggle {
  display: grid;
  flex: none;
  order: -1;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.rail-theme-toggle .ui-icon { width: 20px; height: 20px; }
.rail-theme-toggle:hover { background: var(--surface-alt); color: var(--text); }
.rail-theme-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.rail-theme-toggle .theme-icon-sun,
.theme-dark .rail-theme-toggle .theme-icon-moon { display: none; }
.theme-dark .rail-theme-toggle .theme-icon-sun { display: block; }

.rail-account-button .signed-in-user-avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.rail-account-button[aria-expanded="true"] {
  color: var(--text);
}

.rail-account-button[aria-expanded="true"] .signed-in-user-avatar {
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.account-menu {
  position: absolute;
  bottom: 0;
  left: calc(100% + 16px);
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 280px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(25, 31, 40, 0.04), 0 16px 40px rgba(25, 31, 40, 0.12);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.sidebar-head h2 {
  margin: 0 auto 0 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 25.5px;
}

/* 전송은 입력창 안 원형 아이콘 버튼이다. 답변 생성 중에는 멈춤 아이콘으로 바뀐다. */
.send-button .stop-icon,
.send-button.stop-mode .send-icon {
  display: none;
}

.send-button.stop-mode .stop-icon {
  display: block;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}

.rail-brand img,
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.chat-header h2 {
  margin: 0;
  color: var(--text);
  font-size: var(--font-title);
  font-weight: 700;
  line-height: 29px;
}

.chat-header p,
.model-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.icon-command {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.workspace-navigation {
  display: grid;
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.workspace-nav-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}

.workspace-nav-button:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

.workspace-nav-button > span {
  color: var(--blue);
  font-size: 17px;
  text-align: center;
}

.workspace-nav-button strong {
  font-size: 12px;
}

.workspace-nav-button em {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  text-align: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.sidebar-primary-control {
  padding: 10px 0;
}

.compact-controls {
  gap: 8px;
}

.field-caption {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.parameter-heading {
  display: flex;
  position: relative;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.parameter-heading > label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.parameter-help {
  position: static;
  display: inline-flex;
  flex: 0 0 auto;
}

.help-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.help-icon:hover,
.help-icon:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
  outline: none;
  box-shadow: var(--focus-ring);
}

.help-tooltip {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  right: 0;
  width: min(230px, calc(100vw - 48px));
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.advanced-settings-body .mini-range-row:nth-child(odd) .help-tooltip {
  left: 0;
  right: auto;
}

.parameter-help:hover .help-tooltip,
.parameter-help:focus-within .help-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.advanced-settings {
  border-top: 1px solid var(--line);
  color: var(--text-soft);
}

.advanced-settings summary {
  padding: 13px 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.advanced-settings-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 0 0 14px;
}

.advanced-settings-body .mini-range-row {
  grid-template-columns: 1fr;
  gap: 4px;
}

.advanced-settings-body .field-row {
  grid-column: 1 / -1;
}

.sidebar-advanced {
  border-top: 1px solid var(--line);
  color: var(--text-soft);
}

.sidebar-advanced > summary {
  padding: 12px 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-advanced-body {
  display: grid;
  gap: 14px;
  padding-bottom: 12px;
}

/* 관리자 전용 생성 파라미터는 일반 설정과 섞이지 않게 보라 표시가 붙은 카드로 묶는다. */
.sidebar-advanced.is-admin { padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.sidebar-advanced.is-admin > summary { display: flex; align-items: center; gap: 8px; color: var(--text); }
.sidebar-advanced.is-admin > summary::after {
  content: "관리자"; margin-left: auto; padding: 0 6px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--purple) 12%, transparent); color: var(--purple); font-size: 12px; font-weight: 700; line-height: 20px;
}
.sidebar-advanced.is-admin .range-row output { color: var(--blue); font-weight: 700; font-variant-numeric: tabular-nums; }
.sidebar-advanced.is-admin .advanced-settings-body { padding-top: 10px; border-top: 1px solid var(--surface-alt); }
.sidebar-advanced.is-admin :is(.mini-range-row, .field-row) input { min-height: 36px; }

.advanced-section {
  display: grid;
  gap: 8px;
}

.admin-settings-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.control-group label,
.section-label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

select,
.field-row input,
.mini-range-row input {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
}

select {
  padding: 0 12px;
  outline: none;
}

select:focus,
.field-row input:focus,
.mini-range-row input:focus {
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

select.custom-select-native {
  position: absolute !important;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: var(--control-height);
  padding: 0 13px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(25, 31, 40, 0.03);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.custom-select-trigger:hover {
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line-strong));
  background: color-mix(in srgb, var(--blue-soft) 22%, var(--surface));
}

.custom-select-trigger:focus-visible,
.custom-select.is-open .custom-select-trigger {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent), 0 4px 12px rgba(25, 31, 40, 0.07);
}

.custom-select-value {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease, stroke 0.18s ease;
}

.custom-select.is-open .custom-select-chevron {
  transform: rotate(180deg);
  stroke: var(--blue);
}

.custom-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.custom-select-menu {
  position: fixed;
  z-index: 180;
  display: grid;
  gap: 3px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--blue) 20%, var(--line));
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 18px 44px rgba(25, 31, 40, 0.17), 0 3px 10px rgba(25, 31, 40, 0.08);
  backdrop-filter: blur(18px);
  animation: custom-select-enter 0.14s ease-out;
}

.custom-select-options {
  display: grid;
  gap: 3px;
}

.custom-select-search {
  position: sticky;
  /* 메뉴 안쪽 여백(6px)까지 덮어, 스크롤한 항목이 검색창 위 틈으로 비치지 않게 한다. */
  top: -6px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.custom-select-search::before {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 100%;
  left: -6px;
  height: 6px;
  background: var(--surface);
}

.custom-select-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}

.custom-select-search svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.custom-select-search input {
  width: 100%;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font: inherit;
}

.custom-select-search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.custom-select-empty {
  margin: 0;
  padding: 15px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.custom-select-menu[data-placement="top"] {
  transform-origin: bottom center;
}

.custom-select-menu[data-placement="bottom"] {
  transform-origin: top center;
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
  transition: color 0.13s ease, background 0.13s ease;
}

.custom-select-option:hover,
.custom-select-option.is-active {
  background: var(--surface-alt);
  color: var(--text);
}

.custom-select-option.is-selected {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.custom-select-option.is-selected.is-active,
.custom-select-option.is-selected:hover {
  background: color-mix(in srgb, var(--blue) 16%, var(--surface));
}

.custom-select-option svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.custom-select-option.is-selected svg {
  opacity: 1;
}

.custom-select-option:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.custom-select-option-meta {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.template-options-hint {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  font-weight: 400;
}

.template-options-hint span {
  display: block;
  font-size: 12px;
}

.custom-select-hint {
  margin: 0;
  padding: 4px 10px 6px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.template-field .custom-select-trigger {
  min-height: var(--control-height);
  padding: 10px 12px;
  border-radius: var(--control-radius);
}

.field-row .custom-select-trigger {
  min-height: 38px;
  padding: 0 10px;
  border-color: var(--line);
  border-radius: var(--control-radius);
}

@keyframes custom-select-enter {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .custom-select-menu {
    animation: none;
  }
}

.field-row,
.mini-range-row {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.field-row input,
.mini-range-row input {
  min-height: 38px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.field-row select {
  min-height: 38px;
}

.mini-range-row {
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
}

.mini-range-row > span:not(.parameter-heading) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  color: var(--text);
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

button.theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background-color: var(--surface);
  background-image: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

button.theme-toggle:hover {
  border-color: var(--line-strong);
  background-color: var(--surface-alt);
}

button.theme-toggle:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

button.theme-toggle .theme-toggle-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

button.theme-toggle .theme-toggle-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

button.theme-toggle .theme-toggle-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

button.theme-toggle .theme-toggle-track {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: var(--surface-alt);
  transition: border-color 0.18s ease, background 0.18s ease;
}

button.theme-toggle .theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background-color: var(--surface);
  box-shadow: 0 2px 6px rgba(25, 31, 40, 0.18);
  transition: transform 0.18s ease, background 0.18s ease;
}

button.theme-toggle[aria-pressed="true"] .theme-toggle-track {
  border-color: var(--blue);
  background-color: var(--blue);
}

button.theme-toggle[aria-pressed="true"] .theme-toggle-thumb {
  transform: translateX(18px);
  background-color: #ffffff;
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
}

.range-row input {
  accent-color: var(--blue);
}

.range-row output {
  color: var(--text-soft);
  font-size: 13px;
  text-align: right;
}

.secondary-button {
  width: 100%;
  margin-top: auto;
  min-height: var(--button-height);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--button-font-size);
  font-weight: var(--button-weight);
  cursor: pointer;
}

.subtle-button {
  margin-top: 0;
  min-height: var(--button-height);
  background: var(--surface-alt);
  color: var(--text-soft);
}

.secondary-button:hover {
  background: var(--surface-alt);
}

/* 내 계정 메뉴의 이름 · 역할 · 로그아웃 줄 */
/* 계정 메뉴는 프로필 → 다크 모드 → 로그아웃 순서의 목록이다. 로그아웃 버튼은 마크업상 프로필 안에 있어
   프로필 묶음을 풀고(display: contents) 순서로 맨 아래에 놓는다. */
.signed-in-user {
  display: contents;
}

.signed-in-user-copy {
  order: 0;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--surface-alt);
}

.account-menu .theme-toggle {
  order: 1;
  margin-top: 6px;
}

/* 메뉴 안의 다크 모드는 테두리 없는 목록 행으로 둔다. */
.account-menu button.theme-toggle {
  min-height: 44px;
  padding: 6px 10px;
  border-color: transparent;
}

/* 계정 메뉴로 옮긴 대화 정리 동작은 설정 토글 다음, 로그아웃 앞에 둔다. */
.account-menu > .account-menu-action {
  order: 1;
}

.signed-in-user .account-menu-action {
  order: 2;
}

.signed-in-user-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.signed-in-user-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.signed-in-user-copy strong,
.signed-in-user-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signed-in-user-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.signed-in-user-copy small {
  color: var(--muted);
  font-size: 12px;
}

.account-menu-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.account-menu-action .ui-icon {
  width: 18px;
  height: 18px;
  color: var(--text-soft);
}

.account-menu-action:hover {
  background: var(--surface-alt);
}

.subtle-button:hover {
  background: var(--line);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.sidebar-menu-toggle {
  flex-shrink: 0;
  order: -1;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 28px 16px;
  overflow-y: auto;
}

.source-card {
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.source-card:hover {
  border-color: color-mix(in srgb, var(--blue) 40%, transparent);
  box-shadow: 0 8px 18px rgba(25, 31, 40, 0.08);
  transform: translateY(-1px);
}

.source-card:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 2px;
}

.source-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.source-card-top strong {
  color: var(--blue);
}

.source-card-top em {
  margin-left: auto;
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
}

.source-card h4 {
  margin: 6px 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.source-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.source-card-action {
  display: inline-flex;
  margin-top: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.message-content {
  min-width: 0;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}

.user-message-content .message-actions {
  justify-content: flex-end;
}

/* 질문한 시각: 동작 줄 끝에 두고 마우스를 올리거나 키보드로 닿을 때만 보인다. */
.message-time {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.message:hover .message-time,
.message:focus-within .message-time {
  opacity: 1;
}

/* 마우스가 없는 터치 화면에서는 항상 보인다. */
@media (hover: none) {
  .message-time {
    opacity: 1;
  }
}

.message-date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: calc(var(--chat-width) + 42px);
  margin: 4px auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
}

.message-date-divider::before,
.message-date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.message-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  /* 11px 본문이라 --muted(대비 4.22)로는 AA 4.5 에 못 미친다. */
  color: var(--text-soft);
  font-size: 13px;
  font-weight: var(--button-weight);
  cursor: pointer;
}

.message-actions button svg {
  flex-shrink: 0;
}

.message-actions button:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.message-action-divider {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--line);
}

.message-feedback-label {
  color: var(--muted);
  font-size: 12px;
}

.message-actions .feedback-action-btn[aria-pressed="true"] {
  background: var(--blue-soft);
  color: var(--blue);
}

.search-condition-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.answer-data-scope {
  margin: 14px 0 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.answer-data-scope summary {
  cursor: pointer;
  color: var(--text-soft);
  font-weight: 600;
}

.answer-data-scope summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 3px;
}

.answer-data-scope-row + .answer-data-scope-row,
.answer-data-scope summary + .answer-data-scope-row {
  margin-top: 6px;
}

.answer-data-scope-row.is-warning {
  color: var(--warning-strong);
}

.answer-data-scope.is-warning {
  border-left-color: var(--warning-strong);
}

.answer-data-scope-row small {
  display: block;
  font-size: inherit;
}

.search-condition-label {
  flex: 0 0 auto;
  padding-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-condition-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.search-condition-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: var(--chip-height-sm);
  padding: 3px 7px 3px 9px;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, transparent);
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--text-soft);
  cursor: pointer;
  font-size: var(--chip-font-size);
}

.search-condition-chip.is-readonly {
  border-color: var(--line);
  background: var(--surface-alt);
  cursor: default;
}

.search-condition-chip.is-readonly strong { color: var(--text-soft); }

.search-condition-chip span {
  color: var(--muted);
}

.search-condition-chip strong {
  max-width: 190px;
  overflow: hidden;
  color: var(--blue);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-condition-chip i {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  color: var(--muted);
  font-style: normal;
}

.search-condition-chip:not(.is-readonly):hover {
  border-color: var(--blue);
}

.search-condition-chip:not(.is-readonly):hover i {
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
}

.stream-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.stream-progress span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
  animation: stream-pulse 1.1s infinite ease-in-out;
}

.stream-progress em {
  font-style: normal;
}

@keyframes stream-pulse {
  50% { opacity: 0.35; transform: scale(0.8); }
}

.ab-comparison {
  display: grid;
  gap: 10px;
}

.ab-panels {
  display: grid;
  gap: 12px;
}

.ab-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.ab-tab {
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ab-tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--blue);
  box-shadow: 0 2px 8px rgba(25, 31, 40, 0.08);
}

.ab-tab:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.ab-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.ab-panel.is-collapsed {
  display: none;
}

/* 일반 답변은 카드 없이 두지만, A/B 비교는 두 답변을 나란히 구분해야 하므로 카드를 남긴다. */
.message.assistant .ab-panel .bubble {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.message.assistant .ab-panel .ab-baseline-bubble {
  border-style: dashed;
}

.ab-panel-title {
  display: none;
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.ab-method-note {
  margin: 0;
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ab-method-note.is-error {
  color: var(--warning);
}

.ab-baseline-bubble {
  border-style: dashed;
  box-shadow: none;
}

/* 자동 비교: 맨 위 카드 한 장에 결론 한 줄과 A·B 점수 */
.ab-evaluation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 20px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.ab-evaluation-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  font-size: 13px;
}

.ab-evaluation-header strong {
  color: var(--text);
  font-size: 14px;
}

.ab-evaluation-header em {
  color: var(--text-soft);
  font-style: normal;
  font-weight: 500;
}

.ab-score-grid {
  display: flex;
  gap: 8px;
}

.ab-score-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 4px 12px;
  border-radius: var(--control-radius);
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.ab-score-item.is-winner {
  background: var(--blue-soft);
  color: var(--blue);
}

.ab-score-item strong {
  color: inherit;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.ab-evaluation > :not(.ab-evaluation-header, .ab-score-grid) {
  grid-column: 1 / -1;
}

.ab-evaluation-details summary {
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.ab-evaluation-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 10px;
}

.ab-evaluation-variant {
  min-width: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.ab-evaluation-variant strong {
  color: var(--text);
}

.ab-evaluation-variant p {
  margin: 4px 0;
}

.ab-evaluation-variant ul {
  margin: 0;
  padding-left: 16px;
}

.ab-shared-extras {
  display: grid;
  gap: 10px;
}

/* 넓은 화면에서는 두 답변을 나란히 둔다. 패널은 틀 없이 제목만 두고, 테두리는 답변 카드 하나만 가진다. */
@media (min-width: 1100px) {
  .message.assistant.ab-layout {
    max-width: 1102px;
  }

  .ab-tabs {
    display: none;
  }

  .ab-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
  }

  .ab-panels .ab-panel,
  .ab-panels .ab-panel.is-collapsed {
    display: grid;
  }

  .ab-panel-title {
    display: block;
  }
}

@media (max-width: 640px) {
  .ab-evaluation-body {
    grid-template-columns: 1fr;
  }
}

.follow-up-panel {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.follow-up-panel h3 {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.follow-up-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.follow-up-chip {
  appearance: none;
  -webkit-appearance: none;
  max-width: 100%;
  min-height: var(--chip-height);
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: var(--chip-font-size);
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
  overflow-wrap: anywhere;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.follow-up-chip:hover {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 8%, transparent);
  color: var(--blue);
}

.follow-up-chip:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

.source-list {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin-top: 10px;
}

.source-list-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.source-list-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-alt);
}

.source-list-toggle:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

.source-list-toggle span {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
}

.source-list-toggle strong {
  color: var(--blue);
}

.source-list-toggle em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.source-list-toggle em {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.source-list-toggle .ui-icon {
  transition: transform 0.16s ease;
}

.source-list-toggle[aria-expanded="true"] .ui-icon {
  transform: rotate(180deg);
}

.source-list-panel {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.source-list-panel[hidden] {
  display: none;
}

.related-issue-item {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.related-issue-item:first-child {
  border-top: 0;
}

.related-issue-item:hover {
  background: var(--surface-alt);
}

.related-issue-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.related-issue-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.related-issue-top strong {
  color: var(--blue);
}

.related-issue-top span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-issue-top em {
  flex: 0 0 auto;
  color: var(--muted);
  font-style: normal;
}

.related-issue-item h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.related-issue-action {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 20, 28, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: modal-backdrop-in 0.18s ease-out;
}

.modal-backdrop[hidden] {
  display: none;
}

@keyframes modal-backdrop-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-pop-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

.modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(920px, 100%);
  max-height: min(780px, calc(100vh - 56px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 32px 90px rgba(10, 16, 25, 0.35);
  overflow: hidden;
  animation: modal-pop-in 0.22s cubic-bezier(0.21, 0.9, 0.35, 1.1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

/* 모달 제목 위 작은 분류 글자. 파랑 알약 대신 회색 글자로 제목을 앞세운다. */
.modal-header p {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.modal-header h3,
.workspace-modal-header h2 {
  margin: 0;
  color: var(--text);
  font-size: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 29px;
  word-break: keep-all;
}

.modal-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.modal-close:hover {
  background: var(--line);
  color: var(--text);
  transform: rotate(90deg);
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: 0;
  padding: 22px 24px 26px;
  overflow: auto;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.feedback-modal {
  width: min(680px, 100%);
}

.logout-confirm-modal,
.account-password-modal {
  width: min(440px, 100%);
}

.account-password-fields:not([hidden]) {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.account-password-modal .modal-form-actions:has(#accountPasswordSubmit[hidden]) {
  grid-template-columns: 1fr;
}

/* 로그아웃은 데이터를 지우는 동작이 아니라 빨강 대신 차분한 진한 버튼으로 확인한다. */
.logout-confirm-button {
  width: 100%;
  min-height: var(--button-height-lg);
  border: 0;
  border-radius: var(--control-radius);
  background: var(--text);
  color: var(--surface);
  cursor: pointer;
  font-weight: var(--button-weight);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.logout-confirm-button:hover {
  filter: brightness(0.94);
}

.logout-confirm-button:active {
  transform: translateY(1px);
}

.logout-confirm-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.modal-form {
  display: grid;
  gap: 18px;
  padding: 22px 24px 24px;
  overflow-y: auto;
}

.modal-form-description,
.feedback-question {
  margin: 0;
  padding: 11px 13px;
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.template-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.template-field,
.feedback-comment-field {
  display: grid;
  gap: 7px;
}

.template-field > span,
.feedback-comment-field > span,
.feedback-reason-group legend {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.template-field small,
.feedback-comment-field small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.template-field .required-mark {
  color: var(--blue);
}

.template-field input,
.template-field select,
.feedback-comment-field textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-shadow: none;
}

.template-field input:focus,
.template-field select:focus,
.feedback-comment-field textarea:focus {
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

.modal-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-form-actions .secondary-button,
.modal-form-actions .run-evaluation-button {
  width: 100%;
  min-height: var(--button-height-lg);
}

.feedback-reason-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.feedback-reason-group legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.feedback-reason-group label {
  position: relative;
  cursor: pointer;
}

.feedback-reason-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.feedback-reason-group span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.feedback-reason-group label:hover span {
  border-color: var(--line-strong);
}

.feedback-reason-group input:checked + span {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue-soft) 70%, var(--surface));
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--blue);
}

.feedback-reason-group input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--blue) 22%, transparent);
  outline-offset: 2px;
}

.detail-plain {
  margin: 0;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* 원문 메타는 상자 대신 이름·값 두 줄을 격자로 놓고, 아래 구분선 하나로 본문과 나눈다. */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px 16px;
  margin: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--surface-alt);
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-key {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.detail-value {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.detail-badge--positive {
  background: color-mix(in srgb, var(--chart-2) 14%, transparent);
  color: var(--chart-2);
}

.detail-badge--info {
  background: var(--blue-soft);
  color: var(--blue);
}

.detail-badge--warning {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
}

.detail-badge--neutral {
  background: var(--line);
  color: var(--text-soft);
}

.detail-link {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}

.detail-link:hover {
  text-decoration: underline;
}

.detail-prose {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 40px 0;
  color: var(--muted);
  text-align: center;
}

.empty-state > div {
  width: min(100%, 760px);
}

.empty-state-examples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  max-width: 420px;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.35;
  font-weight: 700;
  word-break: keep-all;
}

.empty-state p {
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
  word-break: keep-all;
}

.empty-state-eyebrow {
  margin-bottom: 8px !important;
  color: var(--blue) !important;
  font-size: 14px;
  font-weight: 600;
}

/* 팀 템플릿은 카드 여러 장 대신 테두리 하나 안의 2열 목록이다. */
.starter-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin-top: 32px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); text-align: left;
}
.starter-grid > .status-warning { grid-column: 1 / -1; margin: 0; padding: 16px; }
/* 마지막 줄의 아래 선은 목록 테두리와 겹치지 않게 잘라 낸다(margin-bottom: -1px). */
.starter-card {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 68px; margin-bottom: -1px; padding: 12px 16px;
  border: 0; border-bottom: 1px solid var(--surface-alt); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; transition: background-color 0.15s ease;
}
.starter-card:nth-child(odd) { border-right: 1px solid var(--surface-alt); }
.starter-card:hover { background: color-mix(in srgb, var(--blue-soft) 45%, var(--surface)); }
.starter-card:focus-visible { position: relative; outline: 2px solid var(--blue); outline-offset: -2px; }
.starter-card-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--control-radius); background: var(--blue-soft); color: var(--blue); }
.starter-card-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.starter-card-copy { display: grid; min-width: 0; gap: 1px; }
/* 분류는 목록에서 반복되면 시끄러워 화면에는 숨기고 스크린리더에만 읽힌다. */
.starter-card-copy small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.starter-card-copy strong { color: var(--text); font-size: 14px; line-height: 1.5; }
.starter-card-copy em { overflow: hidden; color: var(--muted); font-size: 12px; font-style: normal; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.starter-card-arrow { color: var(--muted); font-size: 15px; opacity: 0; transition: opacity 0.15s ease, transform 0.15s ease; }
.starter-card:hover .starter-card-arrow,
.starter-card:focus-visible .starter-card-arrow { color: var(--blue); opacity: 1; transform: translateX(2px); }

/* 빈 대화: 제목 → 입력창 → 템플릿 목록 순서로 화면 가운데에 놓는다. 메시지 칸과 빈 화면 묶음을 풀어(display: contents)
   제목·입력창·템플릿 팝오버·목록을 대화 칸 그리드의 형제로 만들고 order로 줄을 세운다. 첫 질문을 보내면 원래 배치로 돌아간다. */
.chat-panel:has(> .messages > .empty-state) { grid-template-rows: none; align-content: start; overflow-y: auto; }
.chat-panel:has(> .messages > .empty-state) > .messages,
.messages > .empty-state,
.messages > .empty-state > div { display: contents; }
.empty-state > div > * { box-sizing: border-box; width: min(var(--composer-width), calc(100% - 56px)); margin-inline: auto; }
.empty-state-eyebrow { order: 1; margin-top: clamp(32px, 16vh, 160px) !important; }
.empty-state h3 { order: 2; }
.empty-state > div > p:not(.empty-state-eyebrow) { order: 3; }
.chat-panel:has(> .messages > .empty-state) > .composer { order: 4; padding-top: 24px; }
.chat-panel:has(> .messages > .empty-state) > .template-picker { position: static; order: 5; width: min(var(--composer-width), calc(100% - 56px)); max-height: min(460px, 60vh); margin: -14px auto 8px; }
.empty-state .starter-grid { order: 6; margin-top: 4px; margin-bottom: 40px; }

/* 질문·답변·로딩은 같은 넓은 칸에 정렬한다. 아바타와 간격은 본문 폭 밖에 둔다. */
.message {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  width: 100%;
  max-width: calc(var(--chat-width) + 42px);
  margin-inline: auto;
}

.message.assistant.has-issue-table {
  max-width: calc(var(--chat-width) + 42px);
}

/* 질문은 아바타 없이 오른쪽 말풍선으로 둔다. */
.message.user {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}

.message.user .avatar {
  display: none;
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--control-radius);
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.assistant-avatar {
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}

.assistant-avatar img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.user-message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: min(78%, 620px);
}

.bubble {
  padding: 10px 16px;
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
  background: var(--blue-soft);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 답변은 카드 없이 본문으로 읽힌다. 표·이슈 목록처럼 데이터가 있는 부분만 테두리를 가진다. */
.message.assistant .bubble {
  padding: 3px 0 0;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
  line-height: 1.7;
  white-space: normal;
}

.message.assistant.has-issue-table .bubble {
  width: 100%;
}

.wide-message-content {
  width: 100%;
}

.assistant-answer {
  display: grid;
  gap: 16px;
}

.assistant-answer p {
  margin: 0;
  line-height: 1.5;
}

.answer-source-quote {
  min-width: 0;
  margin: 0;
  padding: 12px 16px;
  border-left: 3px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
}

.answer-source-quote pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
  line-height: 1.6;
}

.answer-source-quote code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
}

.answer-source-history > summary {
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.answer-source-long-quote > summary {
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.answer-source-long-quote > .answer-source-quote {
  margin-top: 12px;
}

.answer-source-history > :not(summary) {
  margin-top: 16px;
}

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* .toast-stack 이 pointer-events 를 막고 있으므로 실행 취소 버튼만 되살린다. */
.toast-action {
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.16);
}

.toast-action:focus-visible {
  outline: 2px solid var(--surface);
  outline-offset: 2px;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-warning {
  background: var(--warning);
  color: #191308;
}

.inline-issue-ref {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--blue) 35%, transparent);
  text-underline-offset: 2px;
}

.inline-issue-ref:hover {
  text-decoration-color: var(--blue);
}

.inline-code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
}

.answer-heading {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.answer-list {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 6px;
  line-height: 1.5;
}

.criteria-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.criteria-chips-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-right: 2px;
}

.criteria-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: var(--chip-height-sm);
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: var(--chip-font-size);
  font-weight: 700;
}

.criteria-chip small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* 결정형 업무 답변의 '조회 기준' 묶음(chat_rendering.js renderQueryBasis). 답보다 작고 흐리게. */
.answer-basis {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.answer-basis-title {
  margin: 0;
}

.answer-basis-title strong {
  margin-right: 4px;
  color: var(--text-soft);
  font-weight: 600;
}

.answer-basis-notes {
  margin: 4px 0 0;
  padding-left: 18px;
}

.answer-basis-notes li + li {
  margin-top: 2px;
}

.answer-callout {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.answer-callout svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.callout-info {
  background: var(--blue-soft);
  color: var(--text-soft);
}

.callout-info svg {
  color: var(--blue);
}

.callout-warning {
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  color: var(--text-soft);
}

.callout-warning svg {
  color: var(--warning);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.status-badge.status-green {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.status-badge.status-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-badge.status-amber {
  background: color-mix(in srgb, var(--warning) 13%, transparent);
  color: var(--warning-strong);
}

.status-badge.status-red {
  background: color-mix(in srgb, var(--danger) 11%, transparent);
  color: var(--danger);
}

.status-badge.status-purple {
  background: color-mix(in srgb, var(--purple) 12%, transparent);
  color: var(--purple);
}

.status-badge.status-neutral {
  background: var(--surface-alt);
  color: var(--text-soft);
}

.markdown-table-wrap {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.markdown-table th,
.markdown-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.5;
}

.markdown-table thead th {
  background: var(--surface-alt);
  color: var(--text-soft);
  font-weight: 700;
  white-space: nowrap;
}

.markdown-table td.table-atomic {
  white-space: nowrap;
  overflow-wrap: normal;
}

.markdown-table td.table-prose {
  min-width: 18ch;
}

.markdown-table tbody tr:last-child th,
.markdown-table tbody tr:last-child td {
  border-bottom: none;
}

.markdown-table tbody tr:nth-child(even) {
  background: var(--surface-alt);
}

.answer-criteria {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.issue-detail-card {
  display: grid;
  gap: 16px;
}

.issue-section-label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.issue-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.issue-detail-header h3 {
  margin: 6px 0 0;
  color: var(--text);
  font-size: var(--font-title);
  line-height: 29px;
}

.issue-detail-id {
  display: inline-flex;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.issue-detail-header em {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.issue-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.issue-detail-meta div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.issue-detail-meta dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.issue-detail-meta dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.issue-detail-body {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.issue-detail-body h4 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.issue-detail-text {
  display: grid;
  gap: 10px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.5;
}

.issue-detail-text p {
  margin: 0;
}

.issue-reference-notes {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.issue-reference-notes h4 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.issue-reference-notes ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.issue-detail-action {
  justify-self: start;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.issue-detail-action:hover {
  background: var(--surface-alt);
}

.issue-summary-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.issue-table-wrap {
  width: 100%;
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.issue-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
  line-height: 1.5;
}

.issue-table th,
.issue-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  vertical-align: middle;
}

.issue-table thead th {
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.issue-table tbody tr:last-child td {
  border-bottom: 0;
}

.issue-table-row {
  transition: background 0.15s ease;
}

.issue-table-clickable {
  cursor: pointer;
}

.issue-table-clickable:hover,
.issue-table-clickable:focus {
  background: var(--surface-alt);
}

.issue-table-clickable:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: -3px;
}

.issue-table th:nth-child(1),
.issue-table td:nth-child(1) {
  width: 90px;
}

.issue-table th:nth-child(2),
.issue-table td:nth-child(2) {
  width: 190px;
}

.issue-table th:nth-child(4),
.issue-table td:nth-child(4) {
  width: 124px;
}

.issue-table th:nth-child(5),
.issue-table td:nth-child(5) {
  width: 88px;
}

.issue-table th:nth-child(6),
.issue-table td:nth-child(6) {
  width: 104px;
}

.issue-table th:nth-child(7),
.issue-table td:nth-child(7) {
  width: 118px;
}

.issue-table-id {
  color: var(--blue) !important;
  font-weight: 700;
  white-space: nowrap;
}

.issue-table-project,
.issue-table-date,
.issue-table-priority {
  color: var(--text-soft) !important;
  white-space: nowrap;
}

.issue-table-project {
  overflow: hidden;
  text-overflow: ellipsis;
}

.issue-table-title {
  font-weight: 700;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.issue-table .status-badge {
  white-space: nowrap;
}

.issue-summary-row {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 13px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.issue-summary-row + .issue-summary-row {
  border-top: 1px solid var(--line);
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--line) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton-line-title {
  width: 62%;
  height: 14px;
}

.skeleton-line-meta {
  width: 38%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
  }
}

.issue-summary-clickable {
  cursor: pointer;
  transition: background 0.15s ease, padding 0.15s ease;
}

.issue-summary-clickable:hover {
  margin: 0 -10px;
  padding-right: 10px;
  padding-left: 10px;
  border-radius: 8px;
  background: var(--surface-alt);
}

.issue-summary-clickable:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 2px;
  border-radius: 8px;
}

.issue-summary-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.issue-summary-top strong {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 14px;
}

.issue-summary-top span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-summary-top em {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.issue-summary-row h4 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.issue-summary-meta {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.notion-answer {
  display: grid;
  gap: 14px;
}

.notion-card-list {
  display: grid;
  gap: 10px;
}

.notion-card {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.notion-card:hover {
  border-color: color-mix(in srgb, var(--blue) 34%, transparent);
  background: var(--surface-alt);
  transform: translateY(-1px);
}

.notion-card:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 2px;
}

.notion-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.notion-card-top strong {
  min-width: 0;
  overflow: hidden;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notion-card-top em {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.notion-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.notion-card-meta {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.message.user .bubble {
  border-color: transparent;
  background: var(--blue-soft);
  color: #123766;
}

body.theme-dark .message.user .bubble {
  color: #d7e8ff;
}

.message.loading .bubble {
  color: var(--muted);
}

.loading-inline,
.chroma-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 답변 진행 단계: 끝난 단계는 초록 체크, 지금 단계는 굵은 글자와 도는 점, 남은 단계는 회색 */
.progress-steps { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; padding: 0; list-style: none; font-size: 13px; }
.progress-step { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.progress-step.is-done { color: var(--success); }
.progress-step.is-current { color: var(--text); font-weight: 600; }
.progress-step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.progress-step.is-current .progress-step-dot {
  width: 12px; height: 12px; border: 2px solid color-mix(in srgb, var(--blue) 25%, var(--surface)); border-top-color: var(--blue);
  background: transparent; animation: progress-step-spin 0.75s linear infinite;
}
@keyframes progress-step-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .progress-step.is-current .progress-step-dot { animation: none; border-color: var(--blue); } }

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
  animation: loading-dot 1s infinite ease-in-out;
}

.loading-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes loading-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* 입력창은 넓은 대화 칸 안에 놓인 떠 있는 카드다. 폼은 전체 폭을 유지해
   템플릿 팝오버가 폼 높이로 위치를 잡고, 카드 모양은 ::before가 그린다. */
.composer {
  --composer-gutter: max(28px, calc((100% - var(--composer-width)) / 2));
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "notice notice notice"
    "input input input"
    "template . send";
  align-items: center;
  gap: 6px 8px;
  padding: 19px calc(var(--composer-gutter) + 11px) 33px calc(var(--composer-gutter) + 15px);
}

.composer::before {
  content: "";
  position: absolute;
  inset: 8px var(--composer-gutter) 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(25, 31, 40, 0.04), 0 8px 24px rgba(25, 31, 40, 0.06);
  pointer-events: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer:focus-within::before {
  border-color: var(--blue);
  box-shadow: var(--focus-ring), 0 8px 24px rgba(25, 31, 40, 0.06);
}

body.theme-dark .composer::before {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.composer > :not(.scroll-to-top-button) {
  position: relative;
}

.composer textarea {
  grid-area: input;
  min-height: 44px;
  padding: 6px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 15px;
}

.composer textarea:focus {
  box-shadow: none;
}

.scroll-to-top-button {
  position: absolute;
  top: -56px;
  right: 36px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text-soft);
  box-shadow: 0 8px 22px rgba(25, 31, 40, 0.14);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.scroll-to-top-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scroll-to-top-button:hover {
  border-color: var(--blue);
  background: var(--surface);
  color: var(--blue);
  transform: translateY(-2px);
}

.scroll-to-top-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 24%, transparent);
  outline-offset: 2px;
}

body.theme-dark .scroll-to-top-button {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.edit-notice {
  grid-area: notice;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 32%, transparent);
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.edit-notice[hidden] {
  display: none;
}

.edit-notice button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: var(--button-weight);
  cursor: pointer;
}

textarea {
  min-height: 54px;
  max-height: 180px;
  resize: none;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  line-height: 1.5;
  box-shadow: var(--shadow);
}

textarea::placeholder {
  color: var(--muted);
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: var(--focus-ring), var(--shadow);
}

.send-button {
  grid-area: send;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: var(--on-accent);
  font-weight: var(--button-weight);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

/* 글자는 스크린리더에만 읽힌다(aria-label과 같은 말). */
.send-button > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.send-button:hover {
  background: var(--blue-pressed);
}

.send-button.is-empty:not(.stop-mode):not(:disabled) {
  background: color-mix(in srgb, var(--blue) 35%, var(--surface));
}

.send-button:disabled {
  cursor: not-allowed;
  background: #b0b8c1;
}

.send-button.stop-mode {
  background: var(--text);
  color: var(--surface);
}

.send-button.stop-mode:hover {
  filter: brightness(0.92);
}

.status-active {
  color: var(--blue);
}

.status-warning {
  color: var(--warning);
}

.status-danger {
  color: var(--danger);
}

.validation-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0;
  padding: 9px 12px;
  border-color: color-mix(in srgb, var(--blue) 34%, transparent);
  color: var(--blue);
}

.validation-button small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.verification-panel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.verification-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.verification-panel summary::-webkit-details-marker {
  display: none;
}

.verification-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.verification-title strong {
  font-size: 14px;
}

.verification-title em,
.verification-state {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.verification-pass .verification-state {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.verification-warning .verification-state {
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--warning);
}

.verification-fail .verification-state {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.verification-body {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
}

.verification-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
}

.verification-chips span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.verification-chips small {
  color: var(--blue);
  font-size: 12px;
}

.verification-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.verification-dimensions {
  display: grid;
  gap: 10px;
}

.verification-dimension {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.verification-dimension > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: var(--surface-alt);
}

.verification-dimension > header > div {
  display: grid;
  gap: 2px;
}

.verification-dimension > header strong {
  color: var(--text);
  font-size: 13px;
}

.verification-dimension > header small {
  color: var(--muted);
  font-size: 12px;
}

.verification-dimension > header em {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.dimension-pass > header em {
  color: var(--success);
}

.dimension-warning > header em,
.dimension-review > header em {
  color: var(--warning);
}

.dimension-fail > header em {
  color: var(--danger);
}

.dimension-na {
  opacity: 0.72;
}

.verification-dimension .verification-checks {
  padding: 9px;
}

.verification-check {
  display: grid;
  grid-template-columns: 10px auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--surface-alt);
  font-size: 12px;
}

.verification-check > span:last-child {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.check-warning .check-mark {
  background: var(--warning);
}

.check-fail .check-mark {
  background: var(--danger);
}

.check-review .check-mark {
  background: var(--warning);
}

.verification-trace {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.verification-trace span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.verification-trace .trace-error {
  color: var(--danger);
}

.verification-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.verification-footer code {
  flex: 0 0 auto;
  color: var(--text-soft);
}

.run-evaluation-button {
  min-height: var(--button-height);
  padding: 0 14px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--blue);
  color: var(--on-accent);
  cursor: pointer;
  font-size: var(--button-font-size);
  font-weight: var(--button-weight);
}

.run-evaluation-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.summary-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-stat-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  gap: 4px;
}

.summary-stat-card strong {
  font-size: 26px;
  line-height: 35px;
  color: var(--text);
}

.summary-stat-card span {
  font-size: 12px;
  color: var(--muted);
}

.summary-stat-card.tone-pass strong {
  color: var(--success);
}

.summary-stat-card.tone-warning strong {
  color: var(--warning-strong);
}

:is(
  .auth-primary-button,
  .secondary-button,
  .run-evaluation-button,
  .logout-confirm-button,
  .modal-close,
  .account-menu-action,
  .icon-command
):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.summary-stat-card.tone-fail strong {
  color: var(--danger);
}

.summary-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-soft);
}
