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

:root {
  --primary: #1a4d8f;
  --primary-dark: #123662;
  --primary-light: #e8f0fa;
  --bg: #f5f7fa;
  --user-bubble: #1a4d8f;
  --user-text: #fff;
  --ai-bubble: #fff;
  --ai-text: #333;
  --border: #e3e8ef;
  --muted: #8a94a6;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: #222;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 760px; margin: 0 auto; height: 100vh; display: flex; flex-direction: column; }

/* ---------- header ---------- */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  position: sticky; top: 0; z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 42px; height: 42px;
  background: rgba(255,255,255,.15);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}

.brand-text h1 { font-size: 18px; font-weight: 600; }
.brand-text p { font-size: 12px; opacity: .8; margin-top: 2px; }

.btn-new {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}
.btn-new:active { background: rgba(255,255,255,.3); }

/* ---------- chat ---------- */
#chat-area { flex: 1; overflow-y: auto; padding: 16px 14px 8px; }

.welcome {
  text-align: center;
  padding: 40px 20px 20px;
  color: var(--muted);
}
.welcome-icon { font-size: 56px; margin-bottom: 12px; }
.welcome h2 { color: #333; font-size: 20px; margin-bottom: 8px; }
.welcome p { font-size: 14px; line-height: 1.7; }
.disclaimer { font-size: 12px !important; color: #b08a3e; margin-top: 6px; }

.quick-questions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.quick {
  width: 100%; max-width: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.quick:active { background: var(--primary-light); transform: scale(.98); }

/* messages */
.msg { display: flex; margin-bottom: 14px; }
.msg.user { justify-content: flex-end; }
.msg.ai { justify-content: flex-start; }

.bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg.user .bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-bottom-right-radius: 4px;
}

.msg.ai .bubble {
  background: var(--ai-bubble);
  color: var(--ai-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.msg.ai .bubble.error { border: 1px solid #f5c6c6; background: #fef5f5; color: #a33; }

/* ---------- footer ---------- */
footer {
  padding: 8px 14px 14px;
  background: var(--bg);
}

.typing { color: var(--muted); font-size: 13px; padding: 4px 6px 8px; }
.typing .dots span { animation: blink 1.2s infinite; }
.typing .dots span:nth-child(2) { animation-delay: .2s; }
.typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,100% { opacity: .2; } 50% { opacity: 1; } }

.input-row { display: flex; gap: 10px; align-items: flex-end; }

#input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  background: #fff;
  max-height: 140px;
  line-height: 1.5;
}
#input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,77,143,.12); }

.btn-send {
  width: 64px; height: 44px;
  border: none;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
}
.btn-send:disabled { opacity: .4; cursor: not-allowed; }
.btn-send:not(:disabled):active { background: var(--primary-dark); }

.hidden { display: none; }
