:root {
  --bg: #0f1729;
  --surface: #1a2744;
  --surface2: #243352;
  --accent: #5eead4;
  --accent2: #38bdf8;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --user: #2563eb;
  --bot: #334155;
  --danger: #f87171;
  --radius: 14px;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1e3a5f 0%, var(--bg) 55%);
  color: var(--text);
}
.page { max-width: 720px; margin: 0 auto; padding: 20px 16px 32px; }
.header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.title {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dash { opacity: 0.85; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; }
.health-badge {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  white-space: nowrap;
}
.health-badge.ok { color: var(--accent); border: 1px solid rgba(94,234,212,.35); }
.health-badge.warn { color: var(--danger); border: 1px solid rgba(248,113,113,.35); }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--surface2);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
}
.tab.active { border-color: var(--accent); background: var(--surface2); color: var(--accent); }
.panel { background: var(--surface); border-radius: var(--radius); padding: 16px; border: 1px solid var(--surface2); }
.panel[hidden] { display: none !important; }
.hints { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.hint-btn {
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--surface2);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.hint-btn:hover { color: var(--accent); border-color: var(--accent); }
.chat-log {
  min-height: 320px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.55;
  font-size: 0.95rem;
}
.bubble.user { align-self: flex-end; background: var(--user); }
.bubble.assistant { align-self: flex-start; background: var(--bot); }
.bubble.system { align-self: center; color: var(--muted); font-size: 0.8rem; background: transparent; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}
.chat-form button {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0f1729;
  font-weight: 700;
  cursor: pointer;
}
.chat-form button:disabled { opacity: 0.5; cursor: not-allowed; }
.voice-status {
  text-align: center;
  font-weight: 600;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--accent);
}
.voice-text-block label { font-size: 0.8rem; color: var(--muted); }
.voice-text {
  margin: 4px 0 12px;
  padding: 10px;
  background: var(--bg);
  border-radius: 10px;
  min-height: 48px;
  line-height: 1.5;
}
.voice-controls { display: flex; justify-content: center; margin: 20px 0 8px; }
.voice-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--surface2);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.voice-btn:hover { transform: scale(1.03); box-shadow: 0 0 24px rgba(94,234,212,.25); }
.voice-btn.recording { border-color: var(--danger); animation: pulse 1.2s infinite; }
.voice-btn.processing { border-color: var(--accent2); opacity: 0.85; }
.voice-btn-inner { font-size: 1rem; font-weight: 700; color: var(--text); }
.voice-tip { text-align: center; color: var(--muted); font-size: 0.82rem; }
.footer { margin-top: 20px; text-align: center; color: var(--muted); font-size: 0.75rem; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: flex-end; }
.whoami { font-size: 0.78rem; color: var(--muted); }
.logout-btn {
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--surface2);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
}
.logout-btn:hover { border-color: var(--accent); color: var(--accent); }
.login-page { max-width: 440px; }
.login-heading { margin: 0 0 16px; font-size: 1.15rem; }
.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form label { font-size: 0.82rem; color: var(--muted); }
.login-form input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}
.login-form button {
  margin-top: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0f1729;
  font-weight: 700;
  cursor: pointer;
}
.login-form button:disabled { opacity: 0.5; cursor: not-allowed; }
.login-error { color: var(--danger); font-size: 0.85rem; margin: 4px 0 0; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,113,113,.35); }
  50% { box-shadow: 0 0 0 14px rgba(248,113,113,0); }
}
