:root {
  --ink: #16253a;
  --muted: #718198;
  --panel: #ffffff;
  --canvas: #f5f8fb;
  --surface: #f1f5f9;
  --surface-strong: #e8eef5;
  --line: #dce5ef;
  --mint: #14d994;
  --cyan: #16b7e5;
  --primary: #08be83;
  --primary-deep: #06956b;
  --user-bubble: #e9f8f5;
  --shadow: 0 22px 60px rgba(10, 38, 55, .20);
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, textarea { font: inherit; }

.demo-page { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 32px; text-align: center; }
.demo-page h1 { margin: 0; font: 600 clamp(4.5rem, 16vw, 11rem) /.82 "Playfair Display", serif; letter-spacing: -.065em; color: var(--ink); }
.demo-page h1 em { color: var(--primary); font-weight: 600; }
.brand-rule { width: 72px; height: 2px; margin-top: 28px; background: linear-gradient(90deg, var(--mint), var(--cyan)); }

.chat-launcher { position: fixed; right: 28px; bottom: 28px; z-index: 4; border: 0; border-radius: 999px; padding: 14px 20px; color: #fff; background: linear-gradient(130deg, var(--primary), var(--cyan)); box-shadow: 0 14px 35px rgba(7, 181, 145, .32); font-weight: 700; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(7, 181, 145, .42); }

.chat-panel { position: fixed; right: 24px; bottom: 24px; z-index: 5; width: min(390px, calc(100vw - 32px)); height: min(650px, calc(100dvh - 32px)); display: grid; grid-template-rows: auto 1fr auto auto; overflow: hidden; background: var(--panel); border: 1px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(18px) scale(.98); transition: opacity .22s ease, transform .22s ease; }
.chat-panel.open { opacity: 1; pointer-events: auto; transform: none; }

.chat-panel header { min-height: 58px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; color: #fff; background: linear-gradient(108deg, #0dd98b 0%, #13c99c 45%, #16b8e5 100%); }
.brand { width: 33px; height: 33px; display: grid; place-items: center; flex: 0 0 33px; border-radius: 50%; color: #0a9670; background: #fff; font: 700 .8rem "Playfair Display", serif; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chat-panel header strong { display: block; font-size: .78rem; line-height: 1.15; }
.chat-panel header small { display: block; margin-top: 3px; font-size: .62rem; opacity: .94; }
.chat-panel header small::first-letter { color: #d9ffeb; }
.chat-header-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.chat-panel header button { width: 28px; height: 28px; border: 0; border-radius: 50%; color: rgba(255,255,255,.86); background: transparent; font-size: 1.25rem; line-height: 1; cursor: pointer; }
#reset-chat { font-size: 1.1rem; transition: transform .25s ease; }
#reset-chat:hover { transform: rotate(-120deg); }
.chat-panel header button:hover { background: rgba(255,255,255,.15); }

.chat-messages { padding: 13px; overflow: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; background: var(--panel); }
.message { max-width: 88%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: .77rem; line-height: 1.52; white-space: pre-wrap; }
.message.bot { color: #43536b; background: var(--surface); border-bottom-left-radius: 4px; }
.message.user { align-self: flex-end; color: #0a695b; background: var(--user-bubble); border-color: #c6eee5; border-bottom-right-radius: 4px; }
.typing { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--surface); font-size: .72rem; }

.course-list { width: 100%; display: grid; gap: 8px; }
.course-card { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); text-decoration: none; transition: border-color .2s, background .2s; }
.course-card:hover { border-color: var(--cyan); background: #f5fcff; }
.course-card small, .course-card span { color: var(--primary-deep); font-weight: 700; }
.course-card small { font-size: .61rem; letter-spacing: .06em; text-transform: uppercase; }
.course-card strong { font-size: .79rem; line-height: 1.35; }
.course-card span { margin-top: 3px; font-size: .72rem; }
.whatsapp { align-self: stretch; padding: 11px; border-radius: 10px; color: #fff; background: #25c86b; text-align: center; text-decoration: none; font-size: .78rem; font-weight: 700; }

form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel); }
textarea { flex: 1; min-height: 39px; max-height: 105px; resize: none; border: 1px solid var(--line); border-radius: 10px; outline: 0; padding: 10px 11px; color: var(--ink); background: var(--surface); font-size: .76rem; line-height: 1.25; }
textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(22,183,229,.13); }
textarea::placeholder { color: #91a0b4; }
form button { width: 36px; height: 36px; flex: 0 0 36px; border: 0; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--mint), var(--cyan)); font-size: 1.1rem; cursor: pointer; }
form button:disabled { opacity: .48; cursor: wait; }
footer { padding: 0 12px 11px; color: #93a0b2; background: var(--panel); text-align: center; font-size: .6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (prefers-color-scheme: dark) {
  :root { --ink:#e7effb; --muted:#93a4bb; --panel:#070f1c; --canvas:#050b14; --surface:#101a2b; --surface-strong:#142238; --line:#233148; --user-bubble:#123d3d; --shadow:0 24px 70px rgba(0,0,0,.48); }
  .demo-page h1 { color: #f0f6ff; }
  .chat-panel { border-color: #1c2d46; }
  .chat-messages { background: #080f1a; }
  .message.bot { color: #d4dfed; background: var(--surface); }
  .message.user { color: #d7fff5; background: #104d4b; border-color: #17776e; }
  .course-card:hover { background: #12233a; }
  textarea { color: #e7effb; background: #101a2b; }
  textarea::placeholder { color: #7b8ba2; }
}

@media (max-width: 520px) {
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: min(680px, 100dvh); border-radius: 18px 18px 0 0; }
  .chat-launcher { right: 16px; bottom: 16px; }
  .demo-page h1 { font-size: clamp(4rem, 22vw, 7rem); }
}
.theme-toggle { position: fixed; top: 20px; right: 24px; z-index: 3; display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--panel); box-shadow: 0 5px 16px rgba(10,38,55,.08); font-size: .75rem; font-weight: 700; cursor: pointer; }
.theme-toggle > span:first-child { font-size: 1rem; line-height: 1; }

body[data-theme="dark"] { --ink:#e7effb; --muted:#93a4bb; --panel:#070f1c; --canvas:#050b14; --surface:#101a2b; --surface-strong:#142238; --line:#233148; --user-bubble:#123d3d; --shadow:0 24px 70px rgba(0,0,0,.48); }
body[data-theme="dark"] .demo-page h1 { color:#f0f6ff; }
body[data-theme="dark"] .chat-panel { border-color:#1c2d46; }
body[data-theme="dark"] .chat-messages { background:#080f1a; }
body[data-theme="dark"] .message.bot { color:#d4dfed; background:var(--surface); }
body[data-theme="dark"] .message.user { color:#effff9; background:#0aa879; border-color:#18d49b; }
body[data-theme="dark"] .course-card:hover { background:#12233a; }
body[data-theme="dark"] textarea { color:#e7effb; background:#101a2b; }
body[data-theme="dark"] textarea::placeholder { color:#7b8ba2; }

body[data-theme="light"] { --ink:#16253a; --muted:#718198; --panel:#ffffff; --canvas:#f5f8fb; --surface:#f1f5f9; --surface-strong:#e8eef5; --line:#dce5ef; --user-bubble:#e9f8f5; --shadow:0 22px 60px rgba(10,38,55,.20); }
body[data-theme="light"] .demo-page h1 { color:#16253a; }
body[data-theme="light"] .chat-panel { border-color:rgba(255,255,255,.85); }
body[data-theme="light"] .chat-messages { background:#ffffff; }
body[data-theme="light"] .message.bot { color:#43536b; background:#f1f5f9; }
body[data-theme="light"] .message.user { color:#0a695b; background:#e9f8f5; border-color:#c6eee5; }
body[data-theme="light"] textarea { color:#16253a; background:#f1f5f9; }
body[data-theme="light"] textarea::placeholder { color:#91a0b4; }

@media (max-width: 520px) { .theme-toggle { top: 14px; right: 14px; } .theme-toggle #theme-label { display:none; } }
body[data-theme="light"] .theme-toggle:hover {
  color: #087a5d;
  border-color: #79dcc5;
  background: #effcf8;
  box-shadow: 0 6px 18px rgba(8, 190, 131, .14);
}
html:has(body.embed), body.embed { width: 100%; height: 100%; min-height: 0; background: transparent; overflow: hidden; }
body.embed .demo-page, body.embed .theme-toggle { display: none; }
body.embed .chat-launcher { right: 0; bottom: 0; min-height: 50px; padding: 14px 20px; white-space: nowrap; }
body.embed .chat-panel { right: 0; bottom: 0; width: 100%; height: 100%; border-radius: 18px; }