/* ═══════════════════════════════════════════════════════════════════
   AI Chat Window — ChatGPT-like conversational interface
   ═══════════════════════════════════════════════════════════════════ */

/* Legacy chat primitives. Current workspace rules below intentionally remain
   unlayered so they are the only source of final component decisions. */
@layer fy-legacy-chat {
/* ── Shell ── */
.fy-chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--fluid-shell-pad) * 2 - 40px);
  max-width: 860px;
  margin: 0 auto;
}

/* ── Messages area ── */
.fy-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ── Empty state (#UI 上轻下重：紧凑靠上，不居中漂空) ── */
.fy-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  text-align: center;
  padding: var(--space-6) var(--space-4) var(--space-4);
  animation: fy-rise 0.42s ease both;
}

.fy-chat-empty-icon {
  margin-bottom: var(--space-3);
  opacity: 0.85;
}

.fy-chat-empty-icon img {
  width: 72px;
  height: 72px;
}

.fy-chat-empty h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-ink);
  margin: 0 0 var(--space-2);
}

.fy-chat-empty > p {
  color: var(--color-ink-soft);
  font-size: var(--text-base);
  max-width: 48ch;
  margin: 0 0 var(--space-8);
  line-height: var(--leading-normal);
}

/* ── Quick start chips ── */
.fy-chat-quick-start {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  width: 100%;
  max-width: 640px;
}

.fy-quick-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-4) var(--space-3);
  border: 1px solid rgba(25, 38, 43, 0.1);
  border-radius: var(--radius-lg);
  background: var(--color-paper-light);
  cursor: pointer;
  transition: border-color var(--ease-out), box-shadow var(--ease-out), transform var(--ease-out);
  text-align: center;
  min-height: 90px;
  font-family: inherit;
}

.fy-quick-chip:hover {
  border-color: var(--color-brand-300);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.fy-quick-chip:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.fy-quick-icon {
  font-size: 28px;
  line-height: 1;
}

.fy-quick-label {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-ink);
}

.fy-quick-desc {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  line-height: 1.3;
}

/* ── Message bubble ── */
.fy-chat-msg {
  display: flex;
  gap: var(--space-3);
  max-width: 85%;
  animation: rise 0.28s ease both;
}

.fy-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.fy-msg-assistant {
  align-self: flex-start;
}

/* ── Avatar ── */
.fy-msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-brand-400), var(--color-brand-700));
  display: grid;
  place-items: center;
}

.fy-msg-avatar img {
  width: 24px;
  height: 24px;
}

.fy-msg-avatar-user {
  background: var(--color-accent-500);
  color: #fff;
}

.fy-msg-avatar-user svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
}

/* ── Message body ── */
.fy-msg-body {
  min-width: 0;
}

.fy-msg-assistant .fy-msg-body {
  background: var(--color-paper-light);
  border: 1px solid rgba(25, 38, 43, 0.07);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-xs);
}

.fy-msg-user .fy-msg-body {
  background: linear-gradient(135deg, var(--color-brand-100), var(--color-brand-50));
  border: 1px solid rgba(168, 78, 47, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}

/* ── Message header ── */
.fy-msg-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.fy-msg-sender {
  font-size: var(--text-sm);
  color: var(--color-ink);
  font-weight: var(--weight-semibold);
}

/* ── Risk badge ── */
.fy-risk-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  line-height: 1.5;
}

.fy-risk-badge.critical,
.fy-risk-badge.blocked {
  background: var(--color-risk-blocked-bg);
  color: var(--color-risk-blocked);
}

.fy-risk-badge.high {
  background: var(--color-risk-high-bg);
  color: var(--color-risk-high);
}

.fy-risk-badge.medium {
  background: var(--color-risk-medium-bg);
  color: var(--color-risk-medium);
}

.fy-risk-badge.low {
  background: var(--color-risk-low-bg);
  color: var(--color-risk-low);
}

/* ── Message content ── */
.fy-msg-content {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  word-break: break-word;
}

.fy-msg-content p {
  margin: 0;
}

.fy-msg-content p + p {
  margin-top: var(--space-2);
}

.fy-msg-user .fy-msg-content {
  font-size: var(--text-base);
}

/* ── Message timestamp ── */
.fy-msg-time {
  flex-shrink: 0;
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  font-weight: var(--weight-regular);
  white-space: nowrap;
}

.fy-msg-user .fy-msg-content .fy-msg-time {
  display: block;
  text-align: right;
  margin-top: var(--space-1);
}

/* ── Risk-level message emphasis ── */
.fy-msg-risk-critical .fy-msg-body,
.fy-msg-risk-blocked .fy-msg-body {
  border-color: rgba(184, 50, 50, 0.35);
  border-left: 4px solid var(--color-risk-blocked);
  background: linear-gradient(180deg, rgba(184, 50, 50, 0.05), var(--color-paper-light));
}

.fy-msg-risk-high .fy-msg-body {
  border-color: rgba(168, 78, 47, 0.3);
  border-left: 4px solid var(--color-risk-high);
  background: linear-gradient(180deg, rgba(168, 78, 47, 0.05), var(--color-paper-light));
}

.fy-msg-risk-critical .fy-msg-content,
.fy-msg-risk-blocked .fy-msg-content {
  color: #7a1d1d;
}

.fy-msg-risk-high .fy-msg-content {
  color: #6d3410;
}

/* ── Confirmation card (high/critical risk) ── */
.fy-confirm-card {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid rgba(184, 50, 50, 0.35);
  border-radius: var(--radius-md);
  background: rgba(184, 50, 50, 0.06);
}

.fy-confirm-icon {
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1.3;
}

.fy-confirm-title {
  display: block;
  font-size: var(--text-sm);
  color: #7a1d1d;
  margin-bottom: 2px;
}

.fy-confirm-question {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-ink);
}

/* ── Handoff card (求助方式) ── */
.fy-handoff-card {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid rgba(25, 38, 43, 0.1);
  border-radius: var(--radius-md);
  background: var(--color-paper);
}

.fy-handoff-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-ink);
}

.fy-handoff-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-1);
}

.fy-handoff-list li {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.fy-handoff-type {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: rgba(168, 78, 47, 0.1);
  color: var(--color-brand-800);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.fy-handoff-value {
  color: var(--color-ink);
  word-break: break-word;
}

.fy-handoff-value small {
  color: var(--color-ink-muted);
}

/* ── Media generation pending ── */
.fy-msg-media-pending {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
}

.fy-media-spinner {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(168, 78, 47, 0.2);
  border-top-color: var(--color-brand-500);
  animation: fy-spin 0.8s linear infinite;
}

@keyframes fy-spin {
  to { transform: rotate(360deg); }
}

/* ── Action card (embedded in message) ── */
.fy-action-card-embed {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1.5px solid var(--color-brand-200);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(254, 247, 240, 0.7), rgba(255, 255, 255, 0.5));
}

.fy-action-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.fy-action-card-icon {
  font-size: 20px;
}

.fy-action-card-header strong {
  font-size: var(--text-base);
  color: var(--color-brand-800);
}

/* ── Sources ── */
.fy-msg-sources {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(25, 38, 43, 0.06);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.fy-source-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: rgba(25, 38, 43, 0.04);
  font-size: var(--text-xs);
}

/* ── Message actions ── */
.fy-msg-actions {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(25, 38, 43, 0.06);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.fy-msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid rgba(25, 38, 43, 0.1);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--ease-out), border-color var(--ease-out);
}

.fy-msg-action-btn:hover {
  background: var(--color-brand-50);
  border-color: var(--color-brand-300);
}

.fy-msg-action-btn:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* ── Message error ── */
.fy-msg-error {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-danger-bg);
  border: 1px solid rgba(197, 48, 48, 0.15);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-danger);
}

/* ── System message ── */
.fy-chat-system-msg {
  text-align: center;
  padding: var(--space-3) 0;
}

.fy-chat-system-msg span {
  display: inline-block;
  padding: 4px 16px;
  border-radius: var(--radius-full);
  background: rgba(25, 38, 43, 0.05);
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

/* ── Input area ── */
.fy-chat-input-area {
  flex-shrink: 0;
  padding: var(--space-4) var(--space-4) var(--space-2);
  background: linear-gradient(180deg, transparent, var(--color-paper) 40%);
}

.fy-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid rgba(25, 38, 43, 0.12);
  border-radius: var(--radius-xl);
  background: #fff;
  transition: border-color var(--ease-out), box-shadow var(--ease-out);
}

.fy-chat-input-row:focus-within {
  border-color: var(--color-brand-300);
  box-shadow: 0 0 0 4px rgba(168, 78, 47, 0.08);
}

.fy-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--text-base);
  font-family: var(--font-body);
  line-height: 1.5;
  color: var(--color-ink);
  resize: none;
  padding: var(--space-2) 0;
  min-height: 24px;
  max-height: 160px;
  outline: none;
}

.fy-chat-input::placeholder {
  color: var(--color-ink-muted);
}

.fy-chat-voice-btn,
.fy-chat-send-btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: background var(--ease-out), color var(--ease-out);
}

.fy-chat-voice-btn svg,
.fy-chat-send-btn svg {
  width: 22px;
  height: 22px;
}

.fy-chat-voice-btn:hover,
.fy-chat-send-btn:hover {
  background: rgba(25, 38, 43, 0.06);
  color: var(--color-ink);
}

/* #UI 发送按钮：明确 Filled Primary，老人不猜怎么提交 */
.fy-chat-send-btn {
  width: auto;
  min-width: 72px;
  height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  background: #3F67C8;
  color: #fff;
  font-size: var(--text-base);
  font-weight: 600;
  gap: 6px;
}

.fy-chat-send-btn svg {
  width: 18px;
  height: 18px;
}

.fy-chat-send-btn:not(:disabled) {
  background: #3F67C8;
  color: #fff;
}

.fy-chat-send-btn:not(:disabled):hover {
  background: #3157A9;
}

.fy-chat-send-btn:disabled {
  background: rgba(63, 103, 200, 0.35);
  color: rgba(255, 255, 255, 0.8);
  cursor: default;
}

/* ── Hint chips ── */
.fy-chat-hint {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  text-align: center;
}

.fy-hint-chip {
  display: inline;
  border: none;
  background: none;
  color: var(--color-brand-600);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

.fy-hint-chip:hover {
  color: var(--color-brand-800);
}

/* ── Hide voice recorder (used as internal controller) ── */
.fy-chat-input-area #senior-voice-recorder {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
}

/* ═══════════════════════════════════════════════════════════════════
   UI 2.0 — 快速救助页：风险事件处理工作台 (Issue 04)
   从“聊天页”升级为“Case Workspace”。保留全部 bind DOM 钩子。
   ═══════════════════════════════════════════════════════════════════ */

/* ── 助手消息 → 结构化卡片 ── */
.fy-msg-assistant .fy-msg-body {
  background: var(--surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-m);
  padding: var(--sp-5) var(--sp-6);
  box-shadow: var(--shadow-card);
  max-width: 100%;
}

.fy-msg-user .fy-msg-body {
  background: var(--accent-100);
  border: 1px solid rgba(201, 93, 50, 0.16);
  border-radius: var(--radius-m);
}

/* 风险强调改为左侧指示条 + 语义色，不再大面积变色 */
.fy-msg-risk-high .fy-msg-body,
.fy-msg-risk-medium .fy-msg-body,
.fy-msg-risk-critical .fy-msg-body,
.fy-msg-risk-blocked .fy-msg-body {
  border-left: 4px solid var(--color-risk-high);
  background: var(--surface);
}

/* ── 当前判断卡 ── */
.fy-conclusion {
  margin-bottom: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--accent-600);
  border-radius: var(--radius-m);
  background: var(--surface-muted);
}

.fy-conclusion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--sp-2);
}

.fy-conclusion-label {
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.fy-conclusion-text {
  margin: 0;
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: var(--lh-body);
  color: var(--text-primary);
}

/* ── 行动卡：紧凑行式 (方案 §7.5) ── */
.fy-action-card-embed {
  margin-top: var(--sp-5);
  padding: var(--sp-5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.fy-action-card-header strong {
  color: var(--text-primary);
  font-size: var(--fs-h3);
}

/* ── 依据与可信度面板 (方案 §7.6) ── */
.fy-evidence {
  margin-top: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-m);
  background: var(--surface-muted);
}

.fy-evidence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--sp-3);
}

.fy-evidence-title-lg {
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--text-secondary);
}

.fy-evidence-count {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

.fy-evidence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.fy-evidence-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-s);
  background: var(--surface);
  border: 1px solid var(--border-default);
  font-size: var(--fs-body-s);
  color: var(--text-primary);
}

.fy-evidence-kind {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--brand-700);
  color: var(--text-inverse);
  font-size: var(--fs-caption);
}

.fy-evidence-item small {
  color: var(--text-tertiary);
}

.fy-evidence-foot {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-default);
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}

.fy-evidence-foot strong {
  color: var(--text-primary);
}

/* ── AI 加载 Skeleton (UI 2.1，方案 §15) ── */
.fy-loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

.fy-skeleton-bar {
  display: block;
  height: 14px;
  border-radius: var(--radius-s);
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--surface-hover) 40%, var(--surface-muted) 55%);
  background-size: 200% 100%;
  animation: fy-skeleton 1.4s ease-in-out infinite;
}

.fy-skeleton-status {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  margin-top: 2px;
}

@keyframes fy-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 底部输入区 (方案 §7.7) ── */
.fy-chat-input-area {
  padding: var(--sp-4) var(--sp-5) var(--sp-3);
  background: var(--surface);
  border-top: 1px solid var(--border-default);
}

.fy-chat-input-row {
  min-height: 56px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  background: var(--surface);
  box-shadow: none;
  transition: border-color var(--ease-out), box-shadow var(--ease-out);
}

.fy-chat-input-row:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.fy-chat-input {
  color: var(--text-primary);
}

.fy-chat-voice-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-s);
}

.fy-chat-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--radius-s);
  font-size: var(--fs-body-s);
  font-weight: 600;
}

.fy-chat-send-btn:not(:disabled) {
  color: var(--text-inverse);
  background: var(--primary-600, #2F62BE);
}

.fy-chat-send-btn:not(:disabled):hover {
  background: var(--primary-700, #244F9E);
}

.fy-chat-send-btn:disabled {
  opacity: 0.4;
}

/* ── 消息操作按钮：克制 (方案 §10) ── */
.fy-msg-action-btn {
  border-radius: var(--radius-s);
  border: 1px solid var(--border-default);
  background: var(--surface);
  color: var(--text-secondary);
  min-height: 40px;
}

.fy-msg-action-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 940px) {
  .fy-chat-shell {
    max-width: 100%;
    height: calc(100dvh - 200px);
    margin: 0;
  }

  .fy-chat-msg {
    max-width: 92%;
  }

  .fy-chat-quick-start {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* UI 3.0: start with safety, then offer examples. This final layer deliberately
   uses semantic tokens only so the workspace no longer inherits warm legacy UI. */
.fy-chat-empty { max-width: 720px; margin: 0 auto; }
.fy-chat-empty-icon { display: none; }
.fy-chat-empty > p { margin-bottom: var(--sp-4); }
.fy-emergency-guidance {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 4px 0 20px;
  padding: 14px 16px;
  border: 1px solid #F1D6CF;
  border-radius: var(--radius-m);
  background: #FFF6F3;
  color: #8E493D;
  text-align: left;
  font-size: var(--fs-body-s);
  line-height: var(--lh-body-s);
}
.fy-emergency-guidance strong { color: #8E493D; }
.fy-emergency-guidance-icon { color: #8E493D; }
.fy-emergency-guidance-action {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--primary-700);
  font-weight: 600;
  white-space: nowrap;
}
.fy-modal-title,
.fy-suggested-title,
.fy-detection-tag { display: inline-flex; align-items: center; gap: 6px; }
.fy-detection-tag .fy-icon { flex: 0 0 auto; }
.fy-quick-start-label { color: var(--text-secondary); font-size: var(--fs-body-s); }
.fy-chat-input-row:focus-within { border-color: var(--primary-500); box-shadow: var(--focus-ring); }
.fy-hint-chip { color: var(--primary-600); }
.fy-hint-chip:hover { color: var(--primary-700); }
html[data-font-scale="large"] .fy-chat-shell {
  height: auto;
  min-height: calc(100dvh - var(--shell-header-h) - 96px);
}
html[data-font-scale="large"] .fy-chat-input-row { min-height: 64px; }
@media (max-width: 640px) {
  .fy-emergency-guidance { grid-template-columns: auto minmax(0, 1fr); }
  .fy-emergency-guidance-action { grid-column: 2; justify-self: start; }
  html[data-font-scale="large"] .fy-chat-shell { min-height: calc(100dvh - 168px); }
}

/* Workspace archive and creation tools. */
.fy-chat-create-grid { display:grid; grid-template-columns:1fr; gap:7px; padding-bottom:12px; border-bottom:1px solid #e3e9f1; }
.fy-chat-create-grid button { display:flex; align-items:center; justify-content:center; gap:6px; min-height:38px; padding:0 8px; border:1px solid #d8e1ec; border-radius:8px; background:#fff; color:#344a65; font:600 12px/1 inherit; cursor:pointer; }
.fy-chat-create-grid .fy-chat-new { grid-column:1/-1; border-color:#8caee0; background:#edf4ff; color:#244f91; }
.fy-chat-create-grid button:hover { border-color:#82a9df; background:#f5f8ff; }
.fy-chat-project-list { padding-top:8px; }
.fy-chat-archive-section { display:grid; gap:4px; padding:5px 0 9px; }
.fy-chat-archive-section h3 { margin:0; padding:5px 7px; color:#748399; font-size:11px; letter-spacing:.04em; }
.fy-chat-section-empty { margin:0; padding:5px 8px 7px; color:#9aa5b3; font-size:11px; }
.fy-chat-project { grid-template-columns:minmax(0,1fr) 26px 26px; }
.fy-chat-project-pin { display:grid; width:25px; height:25px; padding:0; place-items:center; border:0; border-radius:6px; background:transparent; color:#8795a8; font-size:15px; cursor:pointer; opacity:0; }
.fy-chat-project:hover .fy-chat-project-pin,.fy-chat-project-pin:focus-visible,.fy-chat-project-pin.is-pinned { opacity:1; }
.fy-chat-project-pin.is-pinned { color:#3566bd; }
.fy-workspace-project { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px; padding:8px; border:1px solid #e1e7ef; border-radius:8px; background:#fff; }
.fy-workspace-project > div { min-width:0; display:flex; flex-direction:column; }
.fy-workspace-project strong { overflow:hidden; color:#344a65; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.fy-workspace-project span { color:#8b98a8; font-size:10px; }
.fy-workspace-project button { border:0; background:transparent; color:#4776ba; font-size:10px; cursor:pointer; }
.fy-workspace-project button:disabled { color:#93a0af; cursor:default; }
.fy-workspace-project select { grid-column:1/-1; width:100%; padding:5px 7px; border:1px solid #e1e7ef; border-radius:6px; background:#f8fafc; color:#55667a; font-size:11px; }
.fy-workspace-counts { display:flex; gap:8px; padding:9px 5px 0; border-top:1px solid #e3e9f1; color:#7f8c9d; font-size:11px; }
.fy-workspace-dialog[hidden] { display:none; }
.fy-workspace-dialog { position:fixed; z-index:100; inset:0; display:grid; place-items:center; padding:20px; background:rgba(15,31,54,.48); }
.fy-workspace-dialog form { position:relative; display:grid; gap:14px; width:min(100%,520px); max-height:calc(100dvh - 40px); overflow:auto; padding:26px; border-radius:16px; background:#fff; box-shadow:0 24px 70px rgba(11,28,53,.28); }
.fy-workspace-dialog h2 { margin:0; color:#1c304b; font-size:21px; }
.fy-workspace-dialog p { margin:-7px 0 2px; color:#718096; font-size:13px; }
.fy-workspace-dialog label,.fy-workspace-dialog fieldset { display:grid; gap:7px; margin:0; color:#3f536c; font-size:13px; font-weight:650; }
.fy-workspace-dialog fieldset { grid-template-columns:1fr 1fr; padding:12px; border:1px solid #dfe6ef; border-radius:9px; }
.fy-workspace-dialog fieldset label { display:flex; align-items:center; font-weight:500; }
.fy-workspace-dialog input:not([type=radio]),.fy-workspace-dialog textarea { width:100%; padding:10px 11px; border:1px solid #d8e1ec; border-radius:8px; color:#263b56; font:inherit; resize:vertical; }
.fy-workspace-save { min-height:42px; border:0; border-radius:9px; background:#3568c8; color:#fff; font-weight:700; cursor:pointer; }
.fy-workspace-close { position:absolute; top:14px; right:14px; display:grid; width:34px; height:34px; place-items:center; border:0; border-radius:50%; background:#f1f4f8; color:#596a7f; font-size:20px; cursor:pointer; }

@media (max-width:900px) {
  .fy-chat-projects { display:flex; max-height:176px; overflow:hidden; }
  .fy-chat-create-grid { display:flex; flex:0 0 auto; padding:0 0 7px; overflow-x:auto; }
  .fy-chat-create-grid .fy-chat-new { width:auto; }
  .fy-chat-create-grid button { flex:0 0 auto; padding-inline:11px; }
  .fy-chat-project-list { display:flex; padding-top:0; overflow-x:auto; }
  .fy-chat-archive-section { display:flex; align-items:center; flex:0 0 auto; }
  .fy-chat-archive-section h3 { writing-mode:vertical-rl; }
  .fy-workspace-project { min-width:180px; }
  .fy-workspace-counts { display:none; }
}

/* Conversation projects: a compact ChatGPT-style rail with legal-workspace
   restraint. The message canvas remains the visual priority. */
#app:has(.fy-chat-workbench) {
  overflow: hidden;
}

.fy-chat-workbench {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: calc(100dvh - 118px);
}

.fy-chat-main { min-width: 0; min-height: 0; }
.fy-chat-workbench .fy-chat-shell { height: 100%; }

.fy-chat-projects {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 12px;
  border: 1px solid #e0e7ef;
  border-radius: 11px;
  background: #f7f9fc;
  overflow: hidden;
}

.fy-chat-new {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #c9d7e8;
  border-radius: 9px;
  background: #fff;
  color: #19324f;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.fy-chat-new:hover { border-color: #7fa7dc; background: #f9fbff; }
.fy-chat-project-label { padding: 19px 9px 8px; color: #7a8797; font-size: 11px; font-weight: 700; }
.fy-chat-project-list { display: grid; gap: 4px; min-height: 0; overflow-y: auto; }

.fy-chat-project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  border-radius: 8px;
  color: #4c5d72;
}

.fy-chat-project.is-active { background: #e8effa; color: #193d70; }
.fy-chat-project-open {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.fy-chat-project-open span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.fy-chat-project-delete { display: grid; width: 26px; height: 26px; padding: 0; place-items: center; border: 0; border-radius: 6px; background: transparent; color: #8190a2; font-size: 17px; cursor: pointer; opacity: 0; }
.fy-chat-project:hover .fy-chat-project-delete,
.fy-chat-project.is-active .fy-chat-project-delete,
.fy-chat-project-delete:focus-visible { opacity: 1; }
.fy-chat-project-delete:hover { background: #fff; color: #a13e3e; }

@media (max-width: 900px) {
  #app:has(.fy-chat-workbench) { overflow: visible; }
  .fy-chat-workbench { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 145px); gap: 8px; }
  .fy-chat-projects { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 8px; overflow: visible; }
  .fy-chat-new { width: auto; white-space: nowrap; }
  .fy-chat-project-label { display: none; }
  .fy-chat-project-list { display: flex; gap: 5px; overflow-x: auto; overflow-y: hidden; }
  .fy-chat-project { flex: 0 0 min(210px, 52vw); background: #fff; }
  .fy-chat-project-delete { opacity: 1; }
}

@media (max-width: 640px) {
  .fy-chat-workbench { height: calc(100dvh - 150px); }
  .fy-chat-projects { grid-template-columns: 42px minmax(0, 1fr); }
  .fy-chat-new { justify-content: center; width: 42px; padding: 0; }
  .fy-chat-new span { display: none; }
  .fy-chat-project { flex-basis: min(180px, 58vw); }
}

/* Final composer alignment: later size overrides must not reset the icon-only
   send button to inline-flex's start alignment. */
.fy-chat-input-row .fy-chat-send-btn {
  display: grid;
  place-items: center;
  gap: 0;
  padding: 0;
  line-height: 0;
}

.fy-chat-input-row .fy-chat-send-btn svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
}

@media (max-width: 540px) {
  .fy-chat-messages {
    padding: var(--space-3) var(--space-2);
    gap: var(--space-3);
  }

  .fy-chat-msg {
    max-width: 95%;
  }

  .fy-chat-quick-start {
    grid-template-columns: 1fr 1fr;
  }

  .fy-quick-chip {
    min-height: 72px;
    padding: var(--space-3) var(--space-2);
  }

  .fy-quick-icon {
    font-size: 22px;
  }

  .fy-msg-actions {
    flex-direction: column;
  }

  .fy-msg-action-btn {
    justify-content: center;
  }
}

/* ── UI 2.1：≤480px 类别单列、输入区合理重排 (方案 §14) ── */
@media (max-width: 480px) {
  .fy-chat-quick-start {
    grid-template-columns: 1fr;
  }

  .fy-chat-input-row {
    flex-wrap: wrap;
  }

  .fy-chat-input {
    flex: 1 1 100%;
  }

  .fy-chat-send-btn {
    margin-left: auto;
  }

  .fy-chat-shell {
    height: calc(100dvh - 180px);
  }

  .fy-chat-empty {
    min-height: 480px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   #UI — 手绘教程式行动卡 + 检测面板 + 建议问题
   ═══════════════════════════════════════════════════════════════════ */

/* ── 手绘行动卡容器 ── */
.fy-handbook {
  position: relative;
  border: 2px solid var(--color-ink, #19262b) !important;
  border-radius: 16px !important;
  box-shadow: 4px 4px 0 rgba(25, 38, 43, 0.12);
  background: var(--color-paper-card, #fffaf1) !important;
}

.fy-handbook .fy-action-card-header {
  margin-bottom: var(--space-3);
}

.fy-handbook .fy-action-card-header strong {
  font-size: var(--text-lg);
  color: var(--color-brand-deep, #85351a);
}

/* ── 单步卡片 ── */
.fy-step-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 10px;
  border: 2px dashed var(--color-line, #8a969b);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 4px;
}

.fy-step-card:last-of-type { margin-bottom: 0; }

.fy-step-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2.5px solid var(--color-ink, #19262b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: var(--color-brand-700, #a84e2f);
  box-shadow: 2px 2px 0 rgba(25, 38, 43, 0.2);
  transform: rotate(-4deg);
}

.fy-step-card:nth-child(2) .fy-step-badge { background: var(--color-accent-600, #284842); transform: rotate(3deg); }
.fy-step-card:nth-child(3) .fy-step-badge { background: var(--color-blue-600, #4079b6); transform: rotate(-2deg); }

.fy-step-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--color-accent-100, #d4ebe3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: 2px solid var(--color-ink, #19262b);
  box-shadow: 2px 2px 0 rgba(25, 38, 43, 0.15);
}

.fy-step-body { flex: 1; min-width: 0; }
.fy-step-title { font-size: 17px; font-weight: 800; color: var(--color-ink, #19262b); }
.fy-step-detail { font-size: 13px; color: var(--color-ink-soft, #526268); margin-bottom: 6px; }

.fy-step-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-brand-700, #a84e2f);
  color: #fff;
  border: 2px solid var(--color-ink, #19262b);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 2px 2px 0 rgba(25, 38, 43, 0.2);
  cursor: pointer;
  font-family: inherit;
}

.fy-step-action:active { transform: translate(2px, 2px); box-shadow: none; }

.fy-step-arrow {
  text-align: center;
  font-size: 13px;
  color: var(--color-brand-deep, #85351a);
  line-height: 1.4;
  padding: 2px 0;
  font-weight: 700;
}

/* ── 检测面板 ── */
.fy-detection {
  margin-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fy-detection-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-blue-100, #eaf2fb);
  color: var(--color-blue-600, #4079b6);
  border: 1.5px solid var(--color-blue-400, #88a8de);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ── 建议问题 ── */
.fy-suggested {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid rgba(25, 38, 43, 0.1);
  border-radius: var(--radius-md);
  background: var(--color-paper, #f4efe4);
}

.fy-suggested-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-ink-soft, #526268);
  margin-bottom: var(--space-2);
}

.fy-suggested-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fy-suggested-item {
  text-align: left;
  background: #fff;
  border: 1px solid rgba(25, 38, 43, 0.12);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--color-ink, #19262b);
  cursor: pointer;
  font-family: inherit;
}

.fy-suggested-item:hover {
  background: var(--color-brand-50, #fef7f0);
  border-color: var(--color-brand-300, #f5b076);
}

/* ── #UI 弹窗（居中，盖住侧边栏） ── */
.fy-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 38, 43, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.fy-modal-overlay[hidden] { display: none; }

.fy-modal {
  background: var(--color-paper-card, #fffaf1);
  border: 2px solid var(--color-ink, #19262b);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  max-height: 90vh;
  overflow-y: auto;
}

.fy-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-ink, #19262b);
  margin-bottom: 4px;
}

.fy-modal-sub {
  font-size: 13px;
  color: var(--color-ink-soft, #526268);
  margin-bottom: 14px;
}

.fy-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.fy-modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--color-ink, #19262b);
  cursor: pointer;
  font-family: inherit;
}

.fy-modal-btn.primary { background: var(--color-brand-700, #a84e2f); color: #fff; }
.fy-modal-btn.ghost { background: #fff; color: var(--color-ink, #19262b); }

.fy-contact-list { margin-top: 8px; }

.fy-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  border: 2px solid var(--color-line, #8a969b);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.fy-contact-item.selected { border-color: var(--color-brand-700, #a84e2f); background: #fff8ef; }

.fy-contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent-100, #d4ebe3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.fy-contact-name { font-size: 15px; font-weight: 700; color: var(--color-ink, #19262b); }
.fy-contact-name small { font-size: 12px; color: var(--color-ink-soft, #526268); font-weight: 400; }
.fy-contact-check { margin-left: auto; font-size: 20px; color: var(--color-brand-700, #a84e2f); }

.fy-upload-zone {
  display: block;
  border: 2px dashed var(--color-line, #8a969b);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: #fff;
  cursor: pointer;
}

.fy-upload-icon { font-size: 32px; display: block; }
.fy-upload-text { font-size: 13px; color: var(--color-ink-soft, #526268); }

.fy-upload-preview { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.fy-upload-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 2px solid var(--color-line, #8a969b);
  background: var(--color-blue-100, #eaf2fb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  position: relative;
}

.fy-ocr-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: var(--color-blue-600, #4079b6);
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 999px;
}

/* ── #UI OCR 识别结果 ── */
.fy-upload-result {
  margin-top: 8px;
}

.fy-ocr-loading {
  font-size: 13px;
  color: var(--color-ink-soft, #526268);
  text-align: center;
  padding: 8px;
}

.fy-ocr-result {
  background: #fff;
  border: 1.5px solid var(--color-line, #8a969b);
  border-radius: 10px;
  padding: 10px 12px;
}

.fy-ocr-result strong {
  display: block;
  font-size: 13px;
  color: var(--color-ink, #19262b);
  margin-bottom: 4px;
}

.fy-ocr-result pre {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-ink-soft, #526268);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.fy-ocr-error {
  font-size: 13px;
  color: var(--color-danger, #b64032);
  text-align: center;
  padding: 8px;
}

/* ── #UI Evidence State：来源分类 + 完整度 ── */
.fy-evidence-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(25, 38, 43, 0.12);
  font-size: 12px;
  color: var(--color-ink-soft, #526268);
}

.fy-evidence-breakdown b {
  color: var(--color-blue-600, #4079b6);
  font-weight: 700;
}

/* ── #UI 来源可点击（跳转 /sources 列表页） ── */
.fy-evidence-link {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  font: inherit;
  text-align: left;
  padding: 0;
}

.fy-evidence-link:hover .fy-evidence-title {
  color: var(--color-blue-600, #4079b6);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.fy-evidence-link:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Conversation workspace: calm, document-like surface matching the service desk. */
.fy-chat-shell { height: calc(100dvh - 106px); min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; border: 1px solid #e8edf4; border-radius: 8px; background: rgba(255,255,255,.92); box-shadow: 0 2px 14px rgba(22,50,83,.035); overflow: hidden; }
.fy-workspace-bar { display: none; }
.fy-chat-messages { min-height: 0; padding: 18px 26px; overflow-y: auto; overscroll-behavior: contain; background: linear-gradient(150deg,#fff 0%,#fbfcff 100%); }
.fy-chat-empty { align-content: center; justify-items: center; max-width: 690px; min-height: 100%; margin: auto; padding: 36px 20px 50px; text-align: center; }
.fy-chat-empty-icon { width: 58px; height: 58px; margin-bottom: 13px; padding: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 25%,#80c9ff,#3766d4 70%); box-shadow: 0 8px 20px rgba(50,99,200,.18); }
.fy-chat-empty-icon img { width: 100%; height: 100%; filter: brightness(0) invert(1); }
.fy-chat-empty h2 { margin: 0; color: #1a2b45; font-size: 19px; font-weight: 700; }.fy-chat-empty > p { margin: 7px 0 18px; color: #68788f; font-size: 12px; }
.fy-emergency-guidance { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; width: min(100%, 760px); margin: 0 0 22px; padding: 12px 14px; border: 1px solid #f0d2ca; border-radius: 10px; background: #fff7f4; color: #7b3529; text-align: left; font-size: 13px; line-height: 1.5; }
.fy-emergency-guidance strong { color: #8b3326; }
.fy-emergency-guidance-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #ffebe7; color: #b64432; }
.fy-emergency-guidance-action { display: none; }
.fy-chat-shell:has(.fy-chat-intent-notice) .fy-emergency-guidance { display: none; }
.fy-quick-start-label { margin-top: 22px !important; font-size: 11px !important; color: #8795a9 !important; }
.fy-chat-quick-start { display: grid; grid-template-columns: repeat(3, minmax(130px,1fr)); gap: 10px; width: min(100%,550px); }
.fy-quick-chip { min-height: 52px; padding: 9px 10px; border: 1px solid #e6ebf2; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(21,48,78,.025); text-align: left; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.fy-quick-chip:hover { transform: translateY(-1px); border-color: #a8bff1; box-shadow: 0 6px 16px rgba(56,100,197,.1); }.fy-quick-icon { display:none; }.fy-quick-label { display:block; color:#304561; font-size:12px; font-weight:650; }.fy-quick-desc { display:block; margin-top:4px; color:#8491a3; font-size:10px; line-height:1.35; }
.fy-chat-input-area { margin: 0 16px 12px; padding: 7px; border: 1px solid #e1e7f0; border-radius: 9px; background: #fff; box-shadow: 0 4px 16px rgba(24,51,82,.04); }
.fy-chat-input-row { gap: 6px; align-items: center; }.fy-chat-input { min-height: 32px !important; padding: 6px 8px !important; font-size: 12px !important; }.fy-chat-voice-btn { width:32px;height:32px;border:0;background:transparent;color:#60728a; }.fy-chat-send-btn { width:34px;height:32px;min-width:34px;padding:0;border-radius:7px;background:#416bd1;color:#fff; }.fy-chat-send-btn span { display:none; }.fy-chat-hint { display:none; }
.fy-chat-msg { max-width: 820px; }.fy-msg-body { font-size: 12px; }.fy-msg-user .fy-msg-content { background: #e7f0ff; color:#365d9a; border-radius: 8px 8px 2px 8px; }.fy-msg-assistant .fy-msg-content { border-radius: 8px; }.fy-msg-avatar { width:24px;height:24px; }
@media (max-width: 640px) { .fy-chat-shell { height: calc(100dvh - 145px); min-height: 0; }.fy-chat-messages { padding: 12px; }.fy-chat-empty { padding-inline: 4px; }.fy-chat-quick-start { grid-template-columns: repeat(2,1fr); }.fy-chat-input-area { margin: 0 8px 8px; } }
html[data-font-scale="large"] .fy-chat-shell { height: calc(100dvh - 106px); min-height: 0; }
@media (max-width: 640px) { html[data-font-scale="large"] .fy-chat-shell { height: calc(100dvh - 145px); } }

/* Large-screen readability pass: fill the actual work area and keep only the
   messages scrolled. This prevents the recorder controller from becoming a
   visible blank panel below the composer. */
#app:has(.fy-chat-shell) > * { max-width: none; margin-inline: 0; }
.fy-chat-shell { width: 100%; height: calc(100dvh - 118px); grid-template-rows: minmax(0, 1fr) auto; border-radius: 10px; }
.fy-chat-shell:has(.fy-chat-intent-notice) { grid-template-rows: auto minmax(0, 1fr) auto; }
.fy-chat-intent-notice { display: flex; gap: 12px; align-items: flex-start; margin: 16px 24px 0; padding: 12px 14px; border: 1px solid #d8e4f6; border-radius: 10px; background: #f6f9ff; color: #39516f; }
.fy-chat-intent-notice.is-emergency { border-color: #f0c7bf; background: #fff7f5; color: #7b3529; }
.fy-chat-intent-icon { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: #e9f0ff; color: #3564c8; }
.fy-chat-intent-notice.is-emergency .fy-chat-intent-icon { background: #ffebe7; color: #b64432; }
.fy-chat-intent-notice strong { display: block; font-size: 14px; line-height: 1.35; }
.fy-chat-intent-notice p { margin: 4px 0 0; font-size: 13px; line-height: 1.55; }
.fy-chat-messages { padding: 28px 40px; }
.fy-chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; max-width: 880px; padding: 40px 20px 52px; }
.fy-chat-empty h2 { font-size: 26px; }.fy-chat-empty > p { margin: 10px 0 22px; font-size: 15px; line-height: 1.7; }
.fy-quick-start-label { margin-top: 24px !important; font-size: 14px !important; }
.fy-chat-quick-start { grid-template-columns: repeat(3, minmax(175px, 1fr)); gap: 14px; width: min(100%, 760px); }
.fy-quick-chip { min-height: 74px; padding: 13px 15px; }.fy-quick-label { font-size: 15px; }.fy-quick-desc { margin-top: 5px; font-size: 12px; line-height: 1.4; }
.fy-chat-input-area { margin: 0 24px 18px; padding: 10px; border-radius: 11px; }.fy-chat-input { min-height: 42px !important; padding: 9px 12px !important; font-size: 15px !important; }.fy-chat-voice-btn { width: 42px; height: 42px; }.fy-chat-send-btn { width: 44px; height: 42px; min-width: 44px; }
.fy-chat-recorder-host[hidden] { display: none !important; }
.fy-chat-recorder-host:not([hidden]) { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: rgba(12, 29, 52, .46); }
.fy-chat-voice-dialog { position: relative; width: min(100%, 560px); }
.fy-chat-recorder-host:not([hidden]) .fy-voice-recorder { width: 100%; margin: 0; border-radius: 18px; box-shadow: 0 24px 64px rgba(10, 29, 54, .28); }
.fy-chat-recorder-host:not([hidden]) #senior-voice-recorder { position: relative !important; width: 100% !important; height: auto !important; max-height: calc(100dvh - 48px); margin: 0 !important; overflow: visible !important; clip: auto !important; }
.fy-chat-voice-close { position: absolute; z-index: 1; top: 12px; right: 12px; display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid rgba(22, 44, 74, .16); border-radius: 50%; background: rgba(255,255,255,.86); color: #31445e; font-size: 24px; line-height: 1; cursor: pointer; }
.fy-chat-voice-close:hover,.fy-chat-voice-close:focus-visible { background: #fff; color: #153b69; box-shadow: 0 0 0 3px rgba(65,104,210,.2); outline: 0; }
.fy-chat-msg { max-width: 960px; }.fy-msg-body { font-size: 15px; }.fy-msg-avatar { width: 30px; height: 30px; }
@media (max-width: 640px) { .fy-chat-shell, html[data-font-scale="large"] .fy-chat-shell { height: calc(100dvh - 222px); }.fy-chat-intent-notice { gap: 10px; margin: 10px 12px 0; padding: 10px; }.fy-chat-intent-notice strong { font-size: 13px; }.fy-chat-intent-notice p { font-size: 12px; }.fy-chat-messages { padding: 16px; }.fy-emergency-guidance { align-self: stretch; margin-bottom: 18px; padding: 10px 12px; font-size: 12px; }.fy-chat-quick-start { grid-template-columns: repeat(2, 1fr); }.fy-chat-input-area { margin: 0 8px 8px; }.fy-chat-recorder-host:not([hidden]) { padding: 16px; align-items: end; }.fy-chat-recorder-host:not([hidden]) .fy-voice-recorder { border-radius: 16px; } }

/* Final semantic type layer: large-text preferences must reach safety copy,
   quick choices and the composer instead of stopping at the page heading. */
.fy-chat-intent-notice strong {
  font-size: var(--fs-body-s);
  line-height: var(--lh-body-s);
}

.fy-chat-intent-notice p {
  font-size: var(--fs-label);
  line-height: var(--lh-label);
}

.fy-emergency-guidance {
  font-size: var(--fs-label);
  line-height: var(--lh-label);
}

.fy-chat-empty h2 { font-size: clamp(26px, var(--fs-h1), 30px); }
.fy-chat-empty > p,
.fy-quick-start-label { font-size: var(--fs-body-s) !important; }
.fy-quick-label { font-size: clamp(15px, var(--fs-body-s), 19px); }
.fy-quick-desc { font-size: clamp(12px, var(--fs-caption), 16px); line-height: var(--lh-caption); }
.fy-quick-chip { min-height: max(74px, calc(var(--lh-body-s) * 2 + 26px)); }

.fy-chat-input {
  min-height: max(44px, calc(var(--lh-body) + 18px)) !important;
  font-size: clamp(16px, var(--fs-body), 20px) !important;
  line-height: var(--lh-body) !important;
}

.fy-chat-voice-btn,
.fy-chat-send-btn {
  width: max(44px, calc(var(--lh-body) + 18px));
  height: max(44px, calc(var(--lh-body) + 18px));
  min-width: max(44px, calc(var(--lh-body) + 18px));
}

.fy-msg-body { font-size: clamp(15px, var(--fs-body), 20px); line-height: var(--lh-body); }
.fy-chat-voice-close { width: 44px; height: 44px; }

.fy-chat-empty-contextual {
  min-height: 100%;
  margin: 0 auto;
  padding: 24px;
  justify-content: center;
  text-align: center;
}

@media (max-width: 640px) {
  .fy-chat-empty {
    min-height: 0;
    margin: 0 auto;
    padding: 16px 4px 24px;
    justify-content: flex-start;
  }

  .fy-chat-empty-contextual {
    min-height: 100%;
    padding: 20px 12px;
    justify-content: center;
  }
}

/* Keep the archive controls authoritative over the legacy conversation rail. */
.fy-chat-projects .fy-chat-create-grid { display:grid; grid-template-columns:1fr; gap:7px; }
.fy-chat-projects .fy-chat-create-grid .fy-chat-new { grid-column:1/-1; width:100%; }
.fy-chat-projects .fy-chat-project-list { padding-top:8px; }
.fy-chat-projects .fy-chat-project { grid-template-columns:minmax(0,1fr) 26px 26px; }
@media (max-width:900px) {
  .fy-chat-projects .fy-chat-create-grid { display:grid; grid-template-columns:1fr; }
  .fy-chat-projects .fy-chat-create-grid .fy-chat-new { width:100%; }
  .fy-chat-projects .fy-chat-project-list { display:flex; padding-top:0; }
}
@media (max-width:640px) {
  .fy-chat-projects { display:flex; flex-direction:column; max-height:286px; padding:7px; overflow:hidden; }
  .fy-chat-projects .fy-chat-create-grid { display:grid; grid-template-columns:1fr; width:100%; gap:5px; overflow:visible; }
  .fy-chat-projects .fy-chat-create-grid button,
  .fy-chat-projects .fy-chat-create-grid .fy-chat-new { grid-column:auto; width:100%; min-width:0; padding:0 10px; font-size:12px; white-space:nowrap; }
  .fy-chat-projects .fy-chat-create-grid .fy-chat-new span { display:inline; }
  .fy-chat-projects .fy-chat-project-list { min-height:66px; }
  .fy-chat-projects .fy-chat-archive-section { gap:3px; padding:3px 6px 3px 0; }
  .fy-chat-projects .fy-chat-archive-section:has(.fy-chat-section-empty) { display:none; }
  .fy-chat-projects .fy-chat-archive-section h3 { padding:3px; writing-mode:horizontal-tb; white-space:nowrap; }
  .fy-chat-projects .fy-workspace-project { min-width:174px; padding:6px; }
  .fy-workspace-dialog { padding:10px; align-items:end; }
  .fy-workspace-dialog form { max-height:calc(100dvh - 20px); padding:22px 18px; border-radius:15px; }
}
.fy-video-guides{margin-top:12px;padding:13px;border:1px solid #d5e1e6;border-radius:14px;background:#f8fbfc}.fy-video-guides>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:9px}.fy-video-guides>div:first-child small{color:#667e87;font-size:12px}.fy-video-guide-item{display:grid;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:9px;padding:10px 4px;border-top:1px solid #dde7ea;text-decoration:none;color:inherit}.fy-video-guide-item>span:first-child{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:#161616;color:#fff;font-size:10px}.fy-video-guide-item strong,.fy-video-guide-item small{display:block}.fy-video-guide-item strong{font-size:14px}.fy-video-guide-item small{margin-top:3px;color:#6d8087;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fy-video-guide-item em{font-style:normal;font-size:11px;color:#277064;background:#e1f2ee;border-radius:999px;padding:3px 7px}@media(max-width:640px){.fy-video-guides>div:first-child{align-items:flex-start;flex-direction:column}.fy-video-guide-item{grid-template-columns:28px minmax(0,1fr)}.fy-video-guide-item em{grid-column:2}}
.fy-resource-section{padding-top:7px}.fy-resource-section>h3{display:flex;align-items:center;justify-content:space-between;font-size:12px;font-weight:700;color:#5f7580;padding:7px 4px}.fy-resource-section>h3 span{min-width:22px;text-align:center;border-radius:999px;background:#e4edf3;color:#315768;padding:1px 6px}.fy-workspace-resource{display:flex;align-items:center;gap:3px;margin:3px 0;border:1px solid transparent;border-radius:9px}.fy-workspace-resource:hover{border-color:#d5e2e8;background:#fff}.fy-workspace-resource.is-disabled{opacity:.55}.fy-workspace-resource-main{min-width:0;flex:1;display:grid;grid-template-columns:20px minmax(0,1fr);gap:6px;align-items:center;border:0;background:transparent;text-align:left;padding:7px 5px}.fy-workspace-resource-main strong,.fy-workspace-resource-main small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fy-workspace-resource-main strong{font-size:12px}.fy-workspace-resource-main small{color:#78909a;font-size:10px;margin-top:2px}.fy-workspace-resource>button:not(.fy-workspace-resource-main){border:0;background:transparent;color:#72868f;padding:4px;font-size:11px}.fy-workspace-resource>button:hover{color:#173e51}
