:root {
  --pollie: #2b1680;
  --pollie-dark: #1f0f61;
  --pollie-soft: #efecfb;
  --link: #0f6cbf;
  --text: #1d2125;
  --muted: #6a737b;
  --line: #dee2e6;
  --bg: #ffffff;
  --panel-bg: #f7f7fa;
  --good: #1f7a3d;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid #f4b400; outline-offset: 2px; }

/* Demo ribbon */
.demo-ribbon { background: #fff8e1; color: #5c4400; font-size: 13px; text-align: center; padding: 6px 16px; border-bottom: 1px solid #f1e2a8; }

.ribbon-link { font: inherit; font-size: 13px; background: none; border: 0; color: #5c4400; text-decoration: underline; cursor: pointer; margin-left: 8px; padding: 0; }

/* ---------- Welcome (name prompt) ---------- */
.welcome { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(23, 14, 64, .55); backdrop-filter: blur(4px); }
.welcome[hidden] { display: none; }
.welcome-card { width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 28px 26px 22px; box-shadow: 0 24px 60px rgba(20, 10, 70, .35); text-align: center; }
.welcome-logo { width: 72px; height: 72px; border-radius: 16px; }
.welcome-card h1 { font-size: 24px; margin: 12px 0 6px; }
.welcome-card p { margin: 0 0 16px; color: #3b3850; }
.welcome-card label { display: block; text-align: left; font-weight: 600; margin-bottom: 6px; }
.welcome-card input { width: 100%; font: inherit; font-size: 16px; border: 1.5px solid #b9b2de; border-radius: 12px; padding: 11px 14px; }
.welcome-card input:focus { outline: none; border-color: var(--pollie); box-shadow: 0 0 0 3px rgba(43, 22, 128, .15); }
.welcome-card input[aria-invalid="true"] { border-color: #c62828; }
.welcome-err { color: #c62828; font-size: 13.5px; text-align: left; min-height: 0; margin-top: 4px; }
.welcome-err:empty { display: none; }
.welcome-go { width: 100%; margin-top: 14px; font: inherit; font-weight: 600; font-size: 16px; background: var(--pollie); color: #fff; border: 0; border-radius: 999px; padding: 12px; cursor: pointer; }
.welcome-go:hover { background: var(--pollie-dark); }
.welcome-card .welcome-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

/* ---------- Moodle-style background ---------- */
.lms { min-height: calc(100vh - 32px); }
.lms.has-image { background-repeat: no-repeat; background-position: top center; background-size: cover; }
.lms.has-image > * { visibility: hidden; }
.lms-nav { height: 58px; display: flex; align-items: center; gap: 24px; padding: 0 16px; border-bottom: 1px solid var(--line); background: #fff; }
.lms-brand { font-size: 20px; }
.lms-tabs a { display: inline-block; height: 58px; line-height: 58px; padding: 0 8px; color: var(--text); text-decoration: none; border-bottom: 3px solid transparent; }
.lms-tabs a.active { border-bottom-color: var(--link); }
.lms-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn { background: none; border: 0; padding: 4px; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; fill: #343a40; }
.avatar { border-left: 1px solid var(--line); padding-left: 16px; display: flex; align-items: center; gap: 8px; }
.avatar::before { content: none; }
.avatar { font-size: 15px; }
.lms-main { max-width: 830px; margin: 0 auto; padding: 56px 16px 120px; }
.lms-main h1 { font-size: 34px; margin: 0 0 12px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 20px; font-weight: 400; margin: 0 0 16px; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pill, .search { border: 1px solid #8f959e; border-radius: 6px; padding: 6px 12px; font-size: 15px; color: #495057; }
.pill i { font-style: normal; font-size: 11px; margin-left: 4px; }
.search { flex: 1; min-width: 140px; color: #6a737b; }
.courses { list-style: none; margin: 0; padding: 0; }
.courses li { display: flex; gap: 22px; padding: 8px 8px 10px; border-bottom: 1px solid var(--line); }
.thumb { flex: 0 0 108px; height: 84px; border-radius: 6px; }
.course-meta { flex: 1; }
.course-meta a { color: var(--link); text-decoration: none; font-size: 16px; }
.course-meta a:hover { text-decoration: underline; }
.course-meta div { font-size: 16px; }
.kebab { color: #343a40; font-size: 20px; line-height: 1; padding: 6px; }
.muted { color: var(--muted); margin: 0; }
.help-btn { position: fixed; right: 30px; bottom: 26px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #e9ecef; font-weight: 700; color: #343a40; display: none; }

/* ---------- Launcher ---------- */
.launcher { position: fixed; right: 28px; bottom: 22px; width: 74px; height: 74px; border-radius: 18px; border: 0; padding: 4px; background: #fff; box-shadow: 0 6px 22px rgba(20, 10, 70, .28); cursor: pointer; z-index: 40; transition: transform .15s ease; }
.launcher img { width: 100%; height: 100%; border-radius: 14px; display: block; }
.launcher:hover { transform: translateY(-2px); }
.launcher[aria-expanded="true"] { display: none; }

/* ---------- Panel ---------- */
.panel { position: fixed; right: 28px; bottom: 112px; width: 420px; height: min(640px, calc(100vh - 150px)); background: var(--panel-bg); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(20, 10, 70, .25); display: flex; flex-direction: column; overflow: hidden; z-index: 50; }
.panel[hidden] { display: none; }
body.panel-open .help-btn { display: block; }
.panel-head { background: var(--pollie); color: #fff; display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; }
.panel-logo { width: 38px; height: 38px; border-radius: 9px; }
.panel-head h2 { margin: 0; font-size: 19px; line-height: 1.2; }
.panel-head p { margin: 2px 0 0; font-size: 12.5px; opacity: .9; }
.head-btn { background: none; border: 0; color: #fff; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.head-btn:first-of-type { margin-left: auto; }
.head-btn svg { width: 20px; height: 20px; fill: #fff; }
.head-btn:hover { background: rgba(255, 255, 255, .14); }

.log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 14px; font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.msg.bot { background: #fff; border: 1px solid #e6e4ef; align-self: flex-start; border-top-left-radius: 4px; }
.msg.user { background: var(--pollie); color: #fff; align-self: flex-end; border-top-right-radius: 4px; }
.msg strong { font-weight: 600; }
.msg ol { margin: 6px 0 0; padding-left: 20px; white-space: normal; }
.refs { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; max-width: 92%; }
.ref { font-size: 12px; background: #fff; border: 1px solid #d8d4ea; border-radius: 999px; padding: 3px 10px; color: #3c3466; }
.ref b { color: var(--pollie); margin-right: 4px; }
.typing { align-self: flex-start; background: #fff; border: 1px solid #e6e4ef; border-radius: 14px; padding: 12px 14px; display: flex; gap: 4px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9a93c4; animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.suggestions:empty { display: none; }
.suggestions button { font: inherit; font-size: 13px; background: #fff; color: var(--pollie); border: 1px solid #c9c2ea; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.suggestions button:hover { background: var(--pollie-soft); }

.composer { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid #e3e1ec; background: #fff; }
.composer input { flex: 1; font: inherit; font-size: 15px; border: 1.5px solid #b9b2de; border-radius: 999px; padding: 10px 16px; outline: none; }
.composer input:focus { border-color: var(--pollie); box-shadow: 0 0 0 3px rgba(43, 22, 128, .15); }
.composer button { font: inherit; font-weight: 600; background: var(--pollie); color: #fff; border: 0; border-radius: 999px; padding: 0 20px; cursor: pointer; }
.composer button:hover { background: var(--pollie-dark); }

/* ---------- Cards (mirror the Adaptive Cards in the real agent) ---------- */
.acard { align-self: stretch; background: #fff; border: 1px solid #e3e1ec; border-radius: 14px; padding: 16px; font-size: 14.5px; }
.acard h3 { margin: 0 0 6px; font-size: 18px; }
.acard .sub { color: var(--muted); margin: 0 0 4px; }
.acard .facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0; }
.acard .facts dt { font-weight: 700; }
.acard .facts dd { margin: 0; overflow-wrap: anywhere; }
.acard label { display: block; font-weight: 600; margin: 12px 0 4px; }
.acard label .req { color: #c62828; }
.acard input, .acard select, .acard textarea { width: 100%; font: inherit; font-size: 14.5px; border: 1px solid #b8b6c4; border-radius: 8px; padding: 8px 10px; background: #fff; }
.acard textarea { min-height: 84px; resize: vertical; }
.acard .err { color: #c62828; font-size: 13px; margin-top: 3px; display: none; }
.acard .invalid + .err { display: block; }
.acard .invalid { border-color: #c62828; }
.acard .note { background: #f3f2f8; border-radius: 8px; padding: 10px 12px; margin-top: 12px; }
.acard .note b { display: block; }
.acard .actions { display: flex; gap: 8px; margin-top: 14px; }
.acard .actions button { font: inherit; font-weight: 600; border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.acard .primary { background: var(--pollie); color: #fff; border: 0; }
.acard .secondary { background: #fff; color: var(--text); border: 1px solid #b8b6c4; }
.acard.done { opacity: .75; }
.acard.done .actions { display: none; }
.timeline { list-style: none; margin: 14px 0 6px; padding: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding-bottom: 10px; }
.timeline .dot { font-size: 15px; line-height: 1.4; color: #8c88a8; }
.timeline .current .dot { color: var(--pollie); }
.timeline .complete .dot { color: var(--good); }
.timeline .current .label { font-weight: 700; }
.timeline .detail { color: var(--muted); display: block; }


/* ---------- Counselling booking card ---------- */
.booking fieldset { border: 0; padding: 0; margin: 12px 0 0; }
.booking legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.booking .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.booking .seg legend { width: 100%; }
.booking .seg label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; border: 1px solid #c9c2ea; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.booking .seg input { width: auto; margin: 0; accent-color: var(--pollie); }
.booking .seg label:has(input:checked) { background: var(--pollie-soft); border-color: var(--pollie); }
.booking .campus-row[hidden] { display: none; }
.booking .days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.booking .day { font: inherit; display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border: 1px solid #d4d0e6; border-radius: 10px; background: #fff; cursor: pointer; line-height: 1.2; }
.booking .day .dow { font-size: 12px; color: var(--muted); }
.booking .day .dnum { font-size: 18px; font-weight: 700; }
.booking .day .mon { font-size: 11px; color: var(--muted); }
.booking .day[aria-pressed="true"] { background: var(--pollie); border-color: var(--pollie); color: #fff; }
.booking .day[aria-pressed="true"] .dow, .booking .day[aria-pressed="true"] .mon { color: #e4defc; }
.booking .slots { display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px; }
.booking .slot { font: inherit; font-size: 14px; border: 1px solid #c9c2ea; background: #fff; color: var(--pollie); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.booking .slot[aria-pressed="true"] { background: var(--pollie); color: #fff; border-color: var(--pollie); }
.booking .hint { margin: 0; color: var(--muted); font-size: 13.5px; }
.booking #b-err { display: block; min-height: 0; }
.booking #b-err:empty { display: none; }
.acard.done .day, .acard.done .slot, .acard.done .seg label { cursor: default; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .lms-tabs, .lms-brand { font-size: 16px; }
  .lms-main { padding-top: 28px; }
  .lms-main h1 { font-size: 26px; }
  .courses li { gap: 12px; }
  .thumb { flex-basis: 72px; height: 60px; }
  .course-meta a, .course-meta div { font-size: 14px; }
  .panel { right: 0; bottom: 0; width: 100%; height: 100%; border-radius: 0; }
  .launcher { right: 16px; bottom: 16px; width: 64px; height: 64px; }
  .booking .days { gap: 4px; }
  .booking .day .dnum { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
