:root {
  --sa-green-900: #004b2b;
  --sa-green-800: #006c35;
  --sa-green-700: #007f3f;
  --sa-green-600: #0f8e4a;
  --sa-gold-500: #c8a45d;
  --ink: #123329;
  --muted: #46675c;
  --paper: #ffffff;
  --line: #d4e3dc;
  --bg-a: #f5f9f6;
  --bg-b: #e6f1eb;
  --user-bubble: #d8f0e1;
  --bot-bubble: #eff8f3;
  --shadow: 0 16px 38px rgba(0, 75, 43, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Tajawal", "Cairo", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -12%, rgba(15, 142, 74, 0.2) 0%, transparent 48%),
    radial-gradient(circle at 94% 0%, rgba(200, 164, 93, 0.13) 0%, transparent 40%),
    linear-gradient(165deg, var(--bg-a) 0%, var(--bg-b) 100%);
  overflow-x: hidden;
}

.scene-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 999px;
  filter: blur(40px);
}

.scene-glow-a {
  width: 300px;
  height: 300px;
  background: rgba(15, 142, 74, 0.2);
  top: -90px;
  right: -80px;
}

.scene-glow-b {
  width: 260px;
  height: 260px;
  background: rgba(200, 164, 93, 0.2);
  bottom: -90px;
  left: -70px;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 18px 20px;
}

.hero-card {
  background: linear-gradient(132deg, var(--sa-green-900), var(--sa-green-700));
  border-radius: 24px;
  color: #f2fff8;
  padding: 20px;
  box-shadow: var(--shadow);
  animation: rise 460ms ease-out;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.hero-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-family: "Cairo", sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.lang-switch {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: rgba(240, 255, 246, 0.92);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.lang-btn.active {
  background: #f6fff9;
  color: var(--sa-green-800);
  font-weight: 700;
}

.hero-overline {
  margin: 0 0 4px;
  opacity: 0.85;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

.hero-card h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2.1rem);
  font-family: "Cairo", sans-serif;
  line-height: 1.2;
}

.hero-subtitle {
  margin: 6px 0 0;
  opacity: 0.93;
  font-size: 0.96rem;
}

.layout-grid {
  margin-top: 16px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.info-panel {
  display: grid;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
  gap: 12px;
}

.info-card {
  background: var(--paper);
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px;
  height: fit-content;
  box-shadow: 0 8px 22px rgba(0, 75, 43, 0.08);
}

.info-card h2 {
  margin: 0;
  font-size: 1rem;
  font-family: "Cairo", sans-serif;
}

.info-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.93rem;
}

.ghost-btn {
  margin-top: 10px;
  border: 1px solid #b4d1c3;
  border-radius: 11px;
  background: #f5fbf7;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 9px 12px;
}

.quick-prompts {
  display: grid;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
  gap: 8px;
}

.chip {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c6ddcf;
  border-radius: 999px;
  background: #fbfffd;
  color: #1d4937;
  font: inherit;
  font-size: 0.9rem;
  text-align: start;
  cursor: pointer;
  padding: 10px 14px;
  transition: transform 140ms ease, border-color 140ms ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: #90b7a4;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 68vh;
  background: rgba(255, 255, 255, 0.84);
  border-radius: 22px;
  border: 1px solid #d0e0d8;
  box-shadow: var(--shadow);
  backdrop-filter: blur(5px);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid #d9e8df;
}

.chat-head h2 {
  margin: 0;
  font-size: 1.08rem;
  font-family: "Cairo", sans-serif;
}

.chat-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.status-pill {
  border-radius: 999px;
  border: 1px solid #badfca;
  background: #e5f6ec;
  color: #195f3f;
  font-size: 0.78rem;
  padding: 6px 10px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  width: fit-content;
  max-width: min(88%, 760px);
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.56;
  font-size: 0.95rem;
  white-space: pre-wrap;
  animation: rise 220ms ease-out;
}

.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border: 1px solid #b8deca;
}

.message.bot {
  align-self: flex-start;
  background: var(--bot-bubble);
  border: 1px solid #cbe7d8;
}

.message.system {
  align-self: center;
  max-width: min(72%, 560px);
  background: #fff8e8;
  border: 1px solid #ecd8aa;
}

.message .stamp {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: #6c887c;
}

.composer {
  border-top: 1px solid #d7e7de;
  padding: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

.composer textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #b2d0c0;
  background: #fcfffd;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
  min-height: 54px;
  max-height: 180px;
  resize: vertical;
}

.composer textarea:focus {
  outline: 2px solid rgba(15, 142, 74, 0.2);
  border-color: #7fba9c;
}

.composer button {
  min-width: 110px;
  border: none;
  border-radius: 12px;
  color: #f6fff9;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0 15px;
  background: linear-gradient(135deg, var(--sa-green-700), var(--sa-green-900));
}

.composer button:disabled {
  cursor: wait;
  opacity: 0.74;
}

.footnote {
  margin-top: 12px;
  text-align: center;
  font-size: 0.8rem;
  color: #517062;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 72vh;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 16px 10px 12px;
  }

  .hero-card {
    border-radius: 18px;
    padding: 14px;
  }

  .hero-mark {
    width: 42px;
    height: 42px;
  }

  .chat-panel {
    border-radius: 16px;
    min-height: 76vh;
  }

  .chat-head {
    padding: 12px;
  }

  .messages {
    padding: 10px;
  }

  .message,
  .message.system {
    max-width: 92%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer button {
    min-height: 44px;
  }
}
