@import url('/theme-tokens.css');

:root {
  --touch: 48px;
  --nav-h: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}

.site-shell.assistant-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.site-shell.assistant-shell > .site-header {
  flex-shrink: 0;
  padding: 0.5rem 1.25rem 0;
  max-width: 100%;
}

.site-shell.assistant-shell [data-vt-start-guide] {
  padding: 0 1.25rem;
}

.site-shell.assistant-shell > .bottom-nav {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

body.sub-view { padding-bottom: var(--safe-bottom); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.app-header {
  padding: 1rem 1rem 0.5rem;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-header .sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.app-header .top-nav {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.lang-switch {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.lang-btn {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.lang-btn:hover { color: var(--text); border-color: var(--accent); }
.lang-btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-btn.active { color: var(--text); border-color: var(--accent); background: rgba(77, 159, 255, 0.12); }

.header-bar .lang-switch { margin-left: auto; }

.app-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-bar h2 {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-back {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 0 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-back:active { opacity: 0.85; }

#main {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 20;
}

.bottom-nav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: var(--nav-h);
  padding: 0.35rem;
}

.bottom-nav button .icon { font-size: 1.25rem; line-height: 1; }

.bottom-nav button.active {
  color: var(--accent);
  background: rgba(77, 159, 255, 0.08);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.85rem;
}

.card h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

input, select, textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  margin-bottom: 0.85rem;
  min-height: var(--touch);
}

textarea {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(77, 159, 255, 0.2);
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: -0.5rem 0 0.85rem;
  line-height: 1.45;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  min-height: var(--touch);
  transition: background 0.15s;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent); background: var(--surface2); }

.btn-block { width: 100%; }

.btn-sm {
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}

.btn-warn {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.btn-warn:hover { background: rgba(251, 191, 36, 0.25); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.search-row input { margin-bottom: 0; flex: 1; }

.record-list { list-style: none; }

.record-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  color: var(--text);
  cursor: pointer;
  min-height: var(--touch);
}

.record-item:active { border-color: var(--accent); }

.record-item .title { font-weight: 500; font-size: 1rem; }
.record-item .meta { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-pending { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.badge-done { color: var(--success); border-color: rgba(52, 211, 153, 0.4); }
.badge-failed, .badge-unavailable { color: var(--error); border-color: rgba(248, 113, 113, 0.4); }

.file-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.file-card:active { border-color: var(--accent); }

.file-card .name { font-weight: 500; word-break: break-word; }
.file-card .meta { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.file-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.85rem;
}

.file-preview-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}

.upload-zone {
  margin-bottom: 0.85rem;
}

.upload-zone input[type="file"] {
  font-size: 0.9rem;
  padding: 0.5rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.section-head h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

.loading-bar {
  background: rgba(77, 159, 255, 0.12);
  border: 1px solid rgba(77, 159, 255, 0.35);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.banner-warn {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.85rem;
}

.disclaimer {
  background: var(--surface2);
  border-left: 3px solid var(--warn);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 1rem;
  border-radius: 0 8px 8px 0;
}

.md-body h1, .md-body h2, .md-body h3 {
  margin: 1rem 0 0.5rem;
  line-height: 1.3;
}

.md-body h1 { font-size: 1.25rem; }
.md-body h2 { font-size: 1.1rem; }
.md-body h3 { font-size: 1rem; }

.md-body p { margin: 0.5rem 0; }
.md-body ul { margin: 0.5rem 0 0.5rem 1.25rem; }
.md-body li { margin: 0.25rem 0; }

.md-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.75rem 0;
  display: block;
  overflow-x: auto;
}

.md-body th, .md-body td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: left;
}

.md-body th { background: var(--surface2); }
.md-body code {
  background: var(--surface2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  max-height: 64vh;
  overflow-y: auto;
}

.chat-msg {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  font-size: 0.92rem;
  max-width: 92%;
  word-break: break-word;
}

.chat-msg.user {
  align-self: flex-end;
  background: rgba(77, 159, 255, 0.18);
  border: 1px solid rgba(77, 159, 255, 0.35);
}

.chat-msg.assistant {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  min-height: 52px;
  margin-bottom: 0;
}

.chat-input-row .btn {
  flex-shrink: 0;
  min-width: var(--touch);
}

#toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(420px, calc(100% - 2rem));
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  animation: toast-in 0.25s ease;
}

@keyframes toast-in {
  from { transform: translateY(-8px); }
  to { transform: translateY(0); }
}

.field-row.editing .field-value { display: none; }
.field-row:not(.editing) .field-edit { display: none; }

@media (min-width: 600px) {
  .app-header h1 { font-size: 1.5rem; }
  #main { padding: 1.25rem 1.5rem; }
}

/* --- P1: onboarding picker, active pack, filters, empty states, hints --- */
.hero { padding: 0.5rem 0 1rem; }
.hero h2 { font-size: 1.3rem; margin-bottom: 0.25rem; }

.pick-list { display: flex; flex-direction: column; gap: 0.6rem; }
.pick-card {
  display: flex; align-items: center; gap: 0.85rem;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.9rem 1rem; color: var(--text);
  transition: border-color 0.15s, transform 0.05s;
}
.pick-card:hover { border-color: var(--accent); }
.pick-card:active { transform: scale(0.995); }
.pick-icon { font-size: 1.6rem; line-height: 1; }
.pick-body { flex: 1; min-width: 0; }
.pick-body .title { font-weight: 600; }
.pick-desc { color: var(--muted); font-size: 0.85rem; margin: 0.15rem 0; }
.pick-go { color: var(--accent); font-size: 1.3rem; }

.pill { display: inline-block; font-size: 0.68rem; padding: 0.05rem 0.4rem; border-radius: 999px; vertical-align: middle; }
.pill-paid { background: rgba(251,191,36,0.15); color: var(--warn); border: 1px solid var(--warn); }

.active-pack {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.75rem; padding: 0.5rem 0.75rem;
  background: var(--surface2); border-radius: 8px;
}
.active-pack .ap-name { font-weight: 600; }
.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: 0.85rem; padding: 0.25rem; text-decoration: underline;
}

.filter-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.filter-row select { flex: 1; }

.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty-icon { font-size: 2.5rem; opacity: 0.5; margin-bottom: 0.5rem; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }

.field-hint { margin: -0.15rem 0 0.5rem; font-size: 0.8rem; }
details.advanced { margin: 0.5rem 0; border-top: 1px solid var(--border); padding-top: 0.5rem; }
details.advanced > summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; padding: 0.35rem 0; list-style: revert; }

/* Desktop: wider canvas + grid for pickers and patient lists */
@media (min-width: 900px) {
  #app { max-width: 1040px; }
  .pick-list { display: grid; grid-template-columns: repeat(2, 1fr); }
  .record-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .record-list li { margin: 0; }
}

/* Guided flow on a patient card: record a visit → upload a lab → review → treatment plan */
.next-steps {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.ns-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ns-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.ns-step {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}
.ns-step:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ns-step:disabled { opacity: 0.45; cursor: default; }
.ns-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  font-size: 0.68rem;
}
.ns-arrow { color: var(--muted); font-size: 0.8rem; }
@media (max-width: 720px) {
  .ns-step { min-height: 44px; padding: 0.4rem 0.7rem; }
}

.reco-item { border-top: 1px solid var(--border); padding: 0.7rem 0; }
.reco-item:first-of-type { border-top: none; }
.reco-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.reco-title { font-weight: 600; }
.reco-none, .reco-fresh, .reco-stale { font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px; white-space: nowrap; }
.reco-none { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.reco-fresh { background: rgba(52,211,153,0.15); color: var(--success); border: 1px solid var(--success); }
.reco-stale { background: rgba(251,191,36,0.15); color: var(--warn); border: 1px solid var(--warn); }
.reco-body { margin-top: 0.5rem; }
.reco-body > summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; padding: 0.3rem 0; }

/* Chat: LibreChat-style sidebar + markdown messages */
body.chat-layout #app { max-width: min(1600px, 96vw); }
.chat-shell { display: flex; gap: 0.75rem; min-height: 50vh; }
.chat-sidebar {
  width: 220px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.65rem; display: flex; flex-direction: column; max-height: 70vh;
}
.chat-sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.thread-search { width: 100%; margin-bottom: 0.5rem; padding: 0.45rem 0.55rem; font-size: 0.85rem;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.thread-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.thread-item {
  text-align: left; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.45rem 0.55rem; cursor: pointer; color: var(--text);
}
.thread-item.active { border-color: var(--accent); background: rgba(77,159,255,0.12); }
.thread-title { display: block; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-date { font-size: 0.7rem; color: var(--muted); }
.chat-main { flex: 1; min-width: 0; }
.chat-msg { position: relative; margin-bottom: 0.65rem; padding: 0.55rem 2rem 0.55rem 0.65rem; border-radius: 8px; }
.chat-msg.user { background: rgba(77,159,255,0.12); border: 1px solid rgba(77,159,255,0.25); }
.chat-msg.assistant { background: var(--surface2); border: 1px solid var(--border); }
.chat-msg .btn-copy {
  position: absolute; top: 0.35rem; right: 0.35rem; background: transparent; border: none;
  color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 0.2rem;
}
.chat-ollama { font-size: 0.8rem; padding: 0.35rem 0.55rem; border-radius: 8px; margin-bottom: 0.5rem; }
.chat-ollama.ok { background: rgba(52,211,153,0.12); color: var(--success); }
.chat-ollama.off { background: rgba(251,191,36,0.12); color: var(--warn); }
.chat-ext { margin-bottom: 0.5rem; font-size: 0.8rem; }
@media (max-width: 720px) {
  .chat-shell { flex-direction: column; }
  .chat-sidebar { width: 100%; max-height: 180px; }
}

.chat-stream-hint { font-size: 0.75rem; color: var(--muted); margin: 0.25rem 0 0.5rem; }

body.simple-mode .chat-sidebar,
body.simple-mode .chat-ollama,
body.simple-mode .chat-ext,
body.simple-mode .banner-warn,
body.simple-mode label[for="chat-model"],
body.simple-mode #chat-model,
body.simple-mode #btn-del-thread { display: none !important; }
body.simple-mode .chat-shell { display: block; }

/* ── agentA-ux: chat_fullwidth (chat-focus) ─────────────────────────────── */
/* One-click focus mode hides BOTH side panels and lets the chat card span full width. */
body.chat-focus .chat-sidebar { display: none !important; }
body.chat-focus .w7-artifacts-panel { display: none !important; }
body.chat-focus .chat-shell { display: block; }
body.chat-focus .chat-main { flex: 1 1 auto; width: 100%; }
body.chat-focus .chat-main-with-artifacts { display: block; }
body.chat-focus .chat-main-with-artifacts > .card { flex: 1 1 auto; width: 100%; }

/* ── agentA-ux: VeriThink on/off + focus toggle buttons ──────────────────── */
.vt-toggle-btn.is-off {
  border-color: var(--warn);
  color: var(--warn);
  background: rgba(251, 191, 36, 0.12);
}
.chat-focus-btn.is-on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(77, 159, 255, 0.12);
}
.vt-fast-note {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--warn);
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}

/* ── agentA-ux: clarify_clean panel (assistant.html now loads clarify-panel.js) ── */
.chat-clarify {
  margin: 0.5rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(77, 159, 255, 0.06);
}
.chat-clarify[hidden] { display: none !important; }
.chat-clarify .clarify-hint { margin: 0 0 0.6rem; font-size: 0.82rem; color: var(--muted); }
.chat-clarify .clarify-q { margin-bottom: 0.65rem; }
.chat-clarify .clarify-q strong { display: block; font-size: 0.88rem; margin-bottom: 0.35rem; }
.chat-clarify .clarify-opts { display: flex; flex-direction: column; gap: 0.3rem; }
.chat-clarify .clarify-opt {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface2); cursor: pointer; font-size: 0.85rem;
}
.chat-clarify .clarify-opt:hover { border-color: var(--accent); }
.chat-clarify .clarify-opt input { flex: none; }
.chat-clarify .clarify-actions { display: flex; gap: 0.5rem; margin-top: 0.65rem; flex-wrap: wrap; }
.chat-clarify .clarify-submit {
  padding: 0.45rem 0.85rem; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; font-size: 0.85rem;
}
.chat-clarify .clarify-skip {
  padding: 0.45rem 0.85rem; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 0.85rem;
}
.chat-clarify .clarify-submit:disabled,
.chat-clarify .clarify-skip:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-clarify .clarify-empty { margin: 0; font-size: 0.82rem; color: var(--muted); }

/* ── agentA-ux: clean answer — collapsed reasoning ──────────────────────── */
.vt-reasoning { margin-top: 0.6rem; border-top: 1px dashed var(--border); padding-top: 0.4rem; }
.vt-reasoning > summary {
  cursor: pointer; color: var(--muted); font-size: 0.82rem; list-style: none;
  padding: 0.2rem 0; user-select: none;
}
.vt-reasoning > summary:hover { color: var(--accent); }
.vt-reasoning > summary::-webkit-details-marker { display: none; }
.vt-reasoning[open] > summary { color: var(--accent); }
.vt-reasoning-body { margin-top: 0.35rem; opacity: 0.92; }

/* ── agentA-ux: medicine_ux — collapsible hints/disclaimer ──────────────── */
.collapsible-hint { margin: -0.15rem 0 0.5rem; }
.collapsible-hint > summary { cursor: pointer; list-style: none; user-select: none; }
.collapsible-hint > summary::-webkit-details-marker { display: none; }
.collapsible-hint > summary .hint-more { color: var(--accent); font-weight: 600; }
.collapsible-hint[open] > summary { opacity: 0.7; }
.disclaimer-collapsible > summary.disclaimer {
  border-left: 3px solid var(--warn); margin-top: 1rem;
}

/* UX-1: first-run wizard (4 steps) */
.wizard-card { margin-bottom: 0.75rem; }
.wizard-steps { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.wizard-step { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.5rem 0.55rem; border-radius: 8px; border: 1px solid var(--border, rgba(128,128,128,0.25)); }
.wizard-step.active { border-color: var(--accent, #4d9fff); background: rgba(77, 159, 255, 0.06); }
.wizard-step.done { opacity: 0.72; }
.wizard-num {
  flex-shrink: 0; width: 1.65rem; height: 1.65rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 650; background: var(--surface-2, rgba(128,128,128,0.12));
}

/* B7: follow-up chips (shared with chat.css contract) */
.chat-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 100%;
  margin: 0.35rem 0 0.5rem;
}
.chat-chip {
  min-height: 2.75rem;
  max-width: 100%;
  padding: 0.5rem 0.85rem;
  background: var(--surface, #151b26);
  border: 1px solid var(--border, #2a3548);
  border-radius: 999px;
  color: var(--text, #e8edf5);
  font-size: 0.85rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.chat-chip:hover:not(:disabled) { border-color: var(--accent, #4d9fff); }
.chat-chip:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-chip:focus-visible {
  outline: 2px solid var(--accent, #4d9fff);
  outline-offset: 2px;
}
.chat-toolbar-stub { margin-left: 0.25rem; }
@media (prefers-reduced-motion: no-preference) {
  .chat-followups { animation: chat-pane-rise 0.35s var(--ease, cubic-bezier(.2,.7,.2,1)) both; }
}
.wizard-step.active .wizard-num { background: var(--accent, #4d9fff); color: #fff; }
.wizard-step.done .wizard-num { background: rgba(80, 200, 120, 0.25); color: var(--ok, #50c878); }
.wizard-body .hint { margin: 0.2rem 0 0.35rem; font-size: 0.82rem; }
