@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #17312e;
  --muted: #70817e;
  --primary: #087b70;
  --primary-dark: #056158;
  --cream: #f5f4ee;
  --card: rgba(255, 255, 255, .88);
  --line: #dfe7e4;
  --shadow: 0 24px 70px rgba(19, 62, 57, .13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(145deg, #eff6f2 0%, var(--cream) 48%, #eef2eb 100%);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  overflow: hidden;
}

.ambient { position: fixed; border-radius: 999px; filter: blur(4px); opacity: .5; pointer-events: none; }
.ambient-one { width: 420px; height: 420px; background: #b9e1d8; top: -230px; right: -120px; }
.ambient-two { width: 360px; height: 360px; background: #e9d9b6; bottom: -230px; left: -100px; }

.app-shell { width: min(980px, calc(100% - 32px)); height: 100vh; margin: auto; padding: 22px 0; display: flex; flex-direction: column; position: relative; }

.topbar { min-height: 76px; display: flex; align-items: center; gap: 14px; padding: 0 20px 16px; }
.brand-mark { width: 48px; height: 48px; border-radius: 16px; background: var(--primary); display: grid; place-items: center; box-shadow: 0 10px 26px rgba(8,123,112,.22); }
.brand-mark svg { width: 28px; fill: white; }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 800; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.header-actions { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.reset-button { display: flex; align-items: center; gap: 6px; border: 1px solid #cdded9; border-radius: 24px; background: rgba(255,255,255,.72); color: #47635f; padding: 7px 11px; font: inherit; font-size: 11px; cursor: pointer; transition: .2s; }
.reset-button:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.reset-button svg { width: 15px; fill: currentColor; }
.status { display: flex; gap: 7px; align-items: center; padding: 7px 11px; border-radius: 30px; color: var(--muted); background: rgba(255,255,255,.6); font-size: 11px; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #b3bdbb; }
.status.ready span { background: #28a57e; box-shadow: 0 0 0 4px rgba(40,165,126,.12); }
.status.ready b { color: #19775e; }

.chat-card { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid rgba(255,255,255,.8); border-radius: 28px; background: var(--card); box-shadow: var(--shadow); backdrop-filter: blur(18px); overflow: hidden; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 34px clamp(20px, 5vw, 54px) 20px; scroll-behavior: smooth; }
.message { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 20px; animation: rise .3s ease-out; }
.message.user { flex-direction: row-reverse; }
.avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: #d8ebe6; color: var(--primary-dark); font-weight: 800; font-size: 13px; }
.bubble { max-width: min(680px, 82%); padding: 15px 18px; border-radius: 7px 20px 20px 20px; background: #f0f6f3; line-height: 2; font-size: 14px; }
.bubble p { margin: 0; white-space: pre-wrap; }
.assistant .eyebrow { display: block; margin-bottom: 4px; color: var(--primary); font-size: 11px; font-weight: 700; }
.user .bubble { background: var(--primary); color: #fff; border-radius: 20px 7px 20px 20px; }
.source-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(8,123,112,.12); }
.source-tags span { padding: 3px 8px; border-radius: 20px; background: #fff; color: var(--muted); font-size: 10px; }

.follow-up-suggestions { margin-top: -10px; animation: rise .3s ease-out; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 46px 26px 0; }
.suggestions button { border: 1px solid #cdded9; border-radius: 18px; background: rgba(255,255,255,.75); color: #47635f; padding: 8px 13px; font: inherit; font-size: 11px; cursor: pointer; transition: .2s ease; }
.suggestions button:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }

.composer { margin: 0 clamp(16px, 4vw, 42px); border: 1px solid var(--line); border-radius: 19px; background: #fff; padding: 9px 10px 9px 9px; display: flex; align-items: flex-end; gap: 10px; box-shadow: 0 10px 30px rgba(28,65,60,.07); transition: .2s; }
.composer:focus-within { border-color: rgba(8,123,112,.55); box-shadow: 0 10px 34px rgba(8,123,112,.11); }
textarea { flex: 1; min-height: 42px; max-height: 128px; resize: none; border: 0; outline: 0; background: transparent; padding: 9px 8px; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.7; }
textarea::placeholder { color: #97a6a3; }
.send-button { flex: 0 0 42px; width: 42px; height: 42px; border: 0; border-radius: 13px; background: var(--primary); display: grid; place-items: center; cursor: pointer; transition: .2s; }
.send-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.send-button:disabled { opacity: .55; cursor: wait; transform: none; }
.send-button svg { width: 21px; fill: white; transform: rotate(180deg); }
.disclaimer { margin: 10px 0 12px; text-align: center; color: #8b9997; font-size: 10px; }
.typing { display: flex; gap: 5px; padding: 8px 3px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #74aaa2; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }.typing i:nth-child(3) { animation-delay: .3s; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 620px) {
  .app-shell { width: 100%; padding: 0; }
  .topbar { min-height: 72px; padding: 10px 16px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
  .topbar p { display: none; }
  .reset-button span { display: none; }
  .status { display: none; }
  .chat-card { border-radius: 22px 22px 0 0; }
  .messages { padding: 24px 16px 16px; }
  .bubble { max-width: 88%; }
  .suggestions { margin-right: 46px; flex-direction: column; align-items: flex-start; }
  .composer { margin: 0 12px; }
}
