/* Shared reset + generic widgets (avatars, hint chips, role switch, toasts). */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
[v-cloak] { display: none !important; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
textarea, input, select { font: inherit; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { opacity: 0.7; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  border-radius: 50%; color: #fff; font-weight: 600; letter-spacing: 0.02em; line-height: 1; overflow: hidden;
}
.avatar-agent { background: linear-gradient(135deg, #d97706, #f59e0b); color: #1a1a1a; }
.avatar-system { background: #6b778c; color: #fff; }
.avatar-icon { display: inline-flex; font-size: 1.15em; }
.avatar-icon svg { width: 1.2em; height: 1.2em; }

/* Demo hint line under inputs */
.hint-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--hint-fg, #6b778c);
}
.hint-label { font-weight: 600; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em; opacity: 0.8; }
.hint-chip-wrap { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.hint-text { font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.hint-chip {
  border: 1px solid var(--hint-chip-border, #c1c7d0); background: var(--hint-chip-bg, #f4f5f7); color: var(--hint-chip-fg, #172b4d);
  border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 600; line-height: 18px;
}
.hint-chip:hover { filter: brightness(0.95); }

/* Role switch */
.role-switch { position: relative; }
.role-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: inherit;
  padding: 3px 8px 3px 3px; border-radius: 999px;
}
.role-btn:hover { background: rgba(127, 127, 127, 0.18); }
.role-name { font-size: 13px; font-weight: 500; }
.role-caret { font-size: 10px; opacity: 0.8; }
.role-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 240px;
  background: #fff; color: #172b4d; border-radius: 8px; box-shadow: 0 8px 24px rgba(9, 30, 66, 0.25), 0 0 0 1px rgba(9, 30, 66, 0.08);
  padding: 6px; text-align: left;
}
.role-menu-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #6b778c; padding: 6px 10px 4px; font-weight: 600; }
.role-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 10px; border-radius: 6px; color: inherit; font-size: 13px; line-height: 1.25;
}
.role-item small { color: #6b778c; }
.role-item:hover { background: #f4f5f7; }
.role-item.active { background: #e9f2ff; }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: #172b4d; color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: toast-in 0.18s ease-out; max-width: 560px;
}
.toast-error { background: #de350b; }
.toast-success { background: #00875a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Live dot */
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; opacity: 0.85; }
.live-dot i { width: 8px; height: 8px; border-radius: 50%; background: #97a0af; display: inline-block; }
.live-dot.on i { background: #36b37e; box-shadow: 0 0 0 3px rgba(54, 179, 126, 0.25); }

/* Markdown bodies */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 0.75em; }
.md ul, .md ol { padding-left: 1.4em; margin: 0 0 0.75em; }
.md li { margin: 0.15em 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1em 0 0.4em; line-height: 1.25; }
.md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.08em; } .md h4 { font-size: 1em; }
.md pre { overflow: auto; padding: 10px 12px; border-radius: 6px; background: rgba(127,127,127,0.12); font-size: 12px; line-height: 1.5; }
.md code { background: rgba(127,127,127,0.14); padding: 1px 4px; border-radius: 3px; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 0.75em; padding: 2px 12px; border-left: 3px solid rgba(127,127,127,0.4); opacity: 0.9; }
.md table { border-collapse: collapse; margin: 0 0 0.75em; font-size: 0.95em; }
.md th, .md td { border: 1px solid rgba(127,127,127,0.35); padding: 4px 8px; text-align: left; }
.md a { color: var(--link, #0052cc); }
.md input[type=checkbox] { margin-right: 6px; }

/* Log stream */
.log-stream {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.log-line { display: flex; gap: 10px; }
.log-ts { flex: 0 0 auto; opacity: 0.55; user-select: none; }
.log-cursor { display: inline-block; width: 7px; height: 13px; background: currentColor; opacity: 0.6; animation: blink 1s steps(2) infinite; vertical-align: text-bottom; margin-left: 2px; }
@keyframes blink { to { visibility: hidden; } }

/* Spinner */
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Preview frame */
.preview-frame { width: 100%; border: 1px solid rgba(127,127,127,0.35); border-radius: 6px; background: #fff; min-height: 420px; }
