:root {
  /* Pink palette (variable names kept for compatibility) */
  --teal-900: #831843;
  --teal-700: #be185d;
  --teal-600: #db2777;
  --teal-500: #ec4899;
  --teal-100: #fbcfe8;
  --teal-50:  #fdf2f8;
  --ink:      #3d2230;
  --slate:    #6b4a5a;
  --muted:    #9c7d8b;
  --coral:    #f472b6;
  --amber:    #e9a94f;
  --bg:       #fdf6fa;
  --card:     #ffffff;
  --border:   #f4dbe8;
  --shadow:   0 10px 30px -12px rgba(190, 24, 93, 0.22);
  --radius:   16px;
  --maxw:     1080px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 500px at 90% -10%, var(--teal-50), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, #fbe8f3, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header / nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 66px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--ink); }
.brand .mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  box-shadow: var(--shadow);
}
.brand .mark svg { width: 24px; height: 24px; }
.brand .title { font-size: 1.05rem; line-height: 1.1; }
.brand .title small { display: block; font-weight: 500; color: var(--muted); font-size: 0.72rem; letter-spacing: .04em; text-transform: uppercase; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .08s ease, box-shadow .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--teal-700), var(--teal-500)); color: #fff; box-shadow: var(--shadow); }
.btn-ghost { background: #fff; color: var(--teal-700); border-color: var(--border); }
.btn svg { width: 18px; height: 18px; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--teal-100); color: var(--teal-900);
  padding: 6px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
}
.pill svg { width: 16px; height: 16px; }
.hero h1 { font-size: 2.8rem; line-height: 1.1; margin: 18px 0 14px; letter-spacing: -0.02em; }
.hero h1 .grad { background: linear-gradient(120deg, var(--teal-700), var(--teal-500)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.15rem; color: var(--slate); margin: 0 0 26px; max-width: 46ch; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-art {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow); padding: 26px;
  position: relative; overflow: hidden;
}
.hero-art .pulse-line { color: var(--teal-500); opacity: .9; }
.hero-art .chat-preview { display: grid; gap: 12px; margin-top: 8px; }
.bubble-mini { padding: 12px 14px; border-radius: 14px; font-size: 0.92rem; }
.bubble-mini.user { background: var(--teal-700); color: #fff; justify-self: end; border-bottom-right-radius: 4px; max-width: 80%; }
.bubble-mini.bot  { background: var(--teal-50); color: var(--ink); border: 1px solid var(--border); border-bottom-left-radius: 4px; max-width: 92%; }
.bubble-mini.bot .tag { font-size: .72rem; font-weight: 700; color: var(--teal-700); display: inline-flex; gap: 6px; align-items: center; }

.floaticon { position: absolute; opacity: .06; color: var(--teal-700); }

/* ---------- Sections ---------- */
.section { padding: 40px 0; }
.section h2 { font-size: 1.7rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.section .sub { color: var(--muted); margin: 0 0 26px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 6px 20px -14px rgba(15,118,110,.4);
  transition: transform .1s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .ic {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--teal-50); color: var(--teal-700); margin-bottom: 14px;
}
.card .ic svg { width: 26px; height: 26px; }
.card h3 { margin: 0 0 6px; font-size: 1.12rem; }
.card p { margin: 0; color: var(--slate); font-size: 0.96rem; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 22px 22px 22px; position: relative; }
.step .n {
  width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500)); color: #fff; font-weight: 700; margin-bottom: 12px;
}
.step h3 { margin: 0 0 6px; font-size: 1.05rem; }
.step p { margin: 0; color: var(--slate); font-size: 0.94rem; }

/* Example chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: #fff; border: 1px solid var(--border); color: var(--ink);
  padding: 9px 15px; border-radius: 999px; font-size: 0.9rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; transition: all .12s ease;
}
.chip:hover { border-color: var(--teal-500); background: var(--teal-50); text-decoration: none; }
.chip svg { width: 15px; height: 15px; color: var(--teal-700); }

.badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; font-size: 0.86rem; color: var(--slate); font-weight: 600;
}
.badge svg { width: 16px; height: 16px; color: var(--teal-700); }

/* Sources legend */
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.legend .li { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.legend .em { font-size: 1.5rem; line-height: 1; }
.legend h4 { margin: 0 0 3px; }
.legend p { margin: 0; color: var(--slate); font-size: 0.92rem; }

/* Footer */
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 26px 0; color: var(--muted); font-size: 0.88rem; }
.footer .container { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Chat page ---------- */
.chat-shell { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: calc(100vh - 66px); }
.sidebar { border-right: 1px solid var(--border); background: rgba(255,255,255,.6); padding: 22px; overflow-y: auto; }
.sidebar h4 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side-chips { display: grid; gap: 8px; margin-bottom: 24px; }
.side-chip { text-align: left; width: 100%; }
.side-note { font-size: .84rem; color: var(--muted); background: var(--teal-50); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }

.chat-main { display: flex; flex-direction: column; height: 100%; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding: 26px 26px 10px; }
.msg-row { display: flex; gap: 12px; margin-bottom: 22px; max-width: 820px; }
.msg-row.user { flex-direction: row-reverse; margin-left: auto; }
.avatar { width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px; display: grid; place-items: center; }
.avatar.bot { background: linear-gradient(135deg, var(--teal-700), var(--teal-500)); color: #fff; }
.avatar.user { background: #fff; border: 1px solid var(--border); color: var(--teal-700); }
.avatar svg { width: 20px; height: 20px; }
.bubble { padding: 14px 18px; border-radius: 16px; max-width: 100%; }
.msg-row.bot .bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 5px; box-shadow: 0 4px 16px -12px rgba(15,118,110,.4); }
.msg-row.user .bubble { background: linear-gradient(135deg, var(--teal-700), var(--teal-600, #0d6b64)); color: #fff; border-bottom-right-radius: 5px; }

.bubble h2 { font-size: 1.02rem; margin: 16px 0 6px; padding-top: 10px; border-top: 1px dashed var(--border); }
.bubble h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.bubble p { margin: 0 0 10px; }
.bubble ul { margin: 4px 0 12px; padding-left: 20px; }
.bubble li { margin: 3px 0; }
.bubble a { color: var(--teal-700); }
.msg-row.user .bubble a { color: #cdeee9; }

.sources { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.src-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.src-label { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }
.src-tag { font-size: .78rem; background: var(--teal-50); border: 1px solid var(--border); color: var(--teal-900); padding: 4px 10px; border-radius: 999px; }
.src-tag.web { background: #fff5ee; border-color: #f6ddc9; color: #9a5a1e; }
.src-tag.web:hover { text-decoration: none; border-color: var(--amber); }
.route-tag { font-size: .74rem; color: var(--muted); margin-top: 6px; }

.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--teal-500); animation: bounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }

.composer { border-top: 1px solid var(--border); background: rgba(255,255,255,.85); padding: 14px 26px 18px; }
.composer form { display: flex; gap: 10px; align-items: flex-end; max-width: 820px; margin: 0 auto; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; font: inherit; font-size: 0.98rem; background: #fff; color: var(--ink);
  max-height: 160px; min-height: 48px; line-height: 1.5;
}
.composer textarea:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100); }
.send-btn { width: 48px; height: 48px; border-radius: 14px; border: none; background: linear-gradient(135deg, var(--teal-700), var(--teal-500)); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); }
.send-btn:disabled { opacity: .5; cursor: default; }
.send-btn svg { width: 20px; height: 20px; }
.composer .hint { max-width: 820px; margin: 8px auto 0; font-size: .78rem; color: var(--muted); text-align: center; }

.err { background: #fff2f0; border: 1px solid #f6cfc8; color: #9a2b1e; padding: 12px 14px; border-radius: 12px; font-size: .9rem; }

/* Welcome block inside chat */
.welcome { text-align: center; max-width: 560px; margin: 40px auto; }
.welcome .mark-lg { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal-700), var(--teal-500)); box-shadow: var(--shadow); }
.welcome .mark-lg svg { width: 34px; height: 34px; }
.welcome h2 { margin: 0 0 8px; }
.welcome p { color: var(--slate); margin: 0 0 20px; }

/* ---------- Forms (contribute / professor) ---------- */
.fld-label { display:block; font-weight:600; font-size:.92rem; color:var(--ink); margin:14px 0 6px; }
.card textarea, .card input[type="password"] {
  width:100%; box-sizing:border-box; border:1px solid var(--border); border-radius:12px;
  padding:12px 14px; font:inherit; font-size:.98rem; background:#fff; color:var(--ink);
  line-height:1.5; resize:vertical;
}
.card textarea:focus, .card input:focus { outline:none; border-color:var(--teal-500); box-shadow:0 0 0 3px var(--teal-100); }
.card form .btn { margin-top:16px; }
.form-msg { margin-top:12px; font-size:.9rem; min-height:1.2em; color:var(--muted); }
.form-msg.ok-msg { color:var(--teal-700); font-weight:600; }
.form-msg.err-msg { color:#9a2b1e; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .cards, .steps, .legend { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.2rem; }
  .chat-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
