/* =========================================================
   Life OS — chat.css
   AI Chat panel and Setup Center screens.
   ========================================================= */
#chat-root.open .settings-backdrop { opacity: 1; }
#chat-root.open .settings-panel { opacity: 1; transform: none; }
.chat-panel { width: min(440px, 100vw); }

/* Status pills (also used in Setup Center) */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.7rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap; flex: 0 0 auto;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.tone-ok { color: #1f8a57; background: color-mix(in srgb, #22a06b 15%, transparent); }
.status-pill.tone-warn { color: #b8650f; background: color-mix(in srgb, #e8833a 16%, transparent); }
.status-pill.tone-off { color: var(--text-muted); background: var(--hover); }
:root[data-theme="dark"] .status-pill.tone-ok { color: #5fd49a; }
:root[data-theme="dark"] .status-pill.tone-warn { color: #f3a568; }

/* ---------- Chat ---------- */
.chat-panel .set-header { gap: 10px; }
.chat-status { flex: 1; }
.chat-head-actions { display: flex; align-items: center; gap: 6px; }
.chat-clear { font-size: 0.8rem; color: var(--text-muted); }
.chat-list { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-notice {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--hover);
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.chat-notice-title { font-weight: 600; font-size: 0.92rem; }
.chat-notice-text { font-size: 0.85rem; color: var(--text-muted); }
.chat-notice .btn-small { margin: 4px 0 0; }
.chat-empty { color: var(--text-muted); font-size: 0.88rem; text-align: center; margin: auto 0; display: flex; flex-direction: column; gap: 10px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chat-chip {
  border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 5px 11px;
  font-size: 0.8rem; cursor: pointer; color: var(--text);
}
.chat-chip:hover { background: var(--hover); }
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble {
  max-width: 85%; padding: 8px 12px; border-radius: 14px; font-size: 0.9rem; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word; animation: pageIn 0.2s var(--ease) both;
}
.chat-msg.user .chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant .chat-bubble { background: var(--hover); color: var(--text); border-bottom-left-radius: 4px; }
.chat-msg.failed .chat-bubble { opacity: 0.55; }
.chat-note { font-size: 0.75rem; color: var(--text-faint); text-align: center; }
.chat-error { font-size: 0.82rem; color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); border-radius: 8px; padding: 8px 10px; }
.chat-confirm { border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; background: var(--accent-soft); }
.chat-confirm-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.chat-confirm-item { font-weight: 600; margin-top: 4px; }
.chat-confirm-meta { font-size: 0.8rem; color: var(--text-muted); }
.chat-confirm .set-confirm-actions .btn-small { margin: 0; }
.chat-typing { display: flex; gap: 4px; padding: 10px 12px; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); animation: typing 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 80%, 100% { opacity: 0.25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 14px; border-top: 1px solid var(--border); }
.chat-input {
  flex: 1; resize: none; font: inherit; font-size: 0.92rem; line-height: 1.4; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); max-height: 160px;
}
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-input:disabled { opacity: 0.6; cursor: not-allowed; }
.chat-send { border-radius: 10px; }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Setup Center ---------- */
.sc-intro { margin-bottom: 6px; }
.sc-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); padding: 9px 10px; margin: 6px 0; color: var(--text);
}
.sc-item:hover { background: var(--hover); }
.sc-icon { font-size: 1.2rem; width: 26px; text-align: center; flex: 0 0 auto; }
.sc-icon.big { font-size: 1.6rem; width: auto; }
.sc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sc-title { font-size: 0.9rem; font-weight: 600; }
.sc-sub { font-size: 0.75rem; color: var(--text-muted); }
.sc-arrow { color: var(--text-faint); font-size: 1.2rem; }
.sc-back { font-size: 0.88rem; text-decoration: none; }
.sc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 8px; }
.sc-head h2 { margin: 0; font-size: 1.15rem; flex: 1; }
.sc-p { font-size: 0.88rem; color: var(--text); margin: 8px 0; line-height: 1.5; }
.sc-h { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin: 18px 0 6px; }
.sc-warn {
  font-size: 0.84rem; line-height: 1.45; padding: 9px 11px; border-radius: 8px; margin: 8px 0;
  background: color-mix(in srgb, #e8833a 12%, transparent); color: var(--text);
}
.sc-warn.danger { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.sc-warn.ok { background: color-mix(in srgb, #22a06b 12%, transparent); }
.sc-steps { margin: 4px 0; padding-left: 22px; font-size: 0.87rem; }
.sc-steps li { margin: 6px 0; line-height: 1.45; }
.sc-list-plain { margin: 4px 0; padding-left: 20px; font-size: 0.87rem; }
.sc-copybox { display: flex; align-items: center; gap: 6px; margin: 6px 0; min-width: 0; }
.sc-code {
  flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; padding: 6px 8px;
  border-radius: 6px; background: var(--hover); overflow-x: auto; white-space: nowrap; user-select: all;
}
.sc-copy { margin: 0; flex: 0 0 auto; }
.sc-input { width: 100%; margin: 4px 0 8px; }
.sc-screen .set-confirm-actions .btn-small { margin: 0; }

@media (max-width: 420px) {
  .header-right .icon-btn { width: 26px; }
}
