/* Advisi UI: bright, vibrant, app-shell. Careers People teal, accessible contrast. */
:root {
  --bg: #e9efee; /* tinted backdrop behind the app */
  --surface: #ffffff;
  --panel: #f2f7f6; /* soft filled surface (assistant bubbles, chips) */
  --ink: #0c1f22;
  --muted: #5b6b6c;
  --accent: #0b8578; /* vibrant teal */
  --accent-press: #085f56;
  --accent-bright: #24d3bd; /* bright pop: nav, dot, glows (not behind body text) */
  --accent-grad: linear-gradient(135deg, #17b8a6, #0b8578);
  --accent-ink: #ffffff;
  --accent-soft: #d9f2ee;
  --accent-strong: #096a5f; /* teal text on light */
  --border: #e5ecea;
  --radius: 18px;
  --maxw: 640px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

:root { color-scheme: light dark; }

/* Dark mode: follows the device setting. Brand teal and gradients stay identical;
   only surfaces, ink and soft tints swap, so contrast on filled elements holds. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1315;
    --surface: #101c1e;
    --panel: #182a2d;
    --ink: #e9f2f1;
    --muted: #97aaa8;
    --accent-soft: rgba(36, 211, 189, 0.14);
    --accent-strong: #4fd4c4;
    --border: #24393c;
  }
  .adviser-cta:hover { background: rgba(36, 211, 189, 0.24); }
  .chip:hover { background: rgba(36, 211, 189, 0.24); }
  .msg--error { background: #3a1d1d; border-color: #5c2b2b; color: #f2b8b8; }
  .config-note.warn { color: #f2b8b8; }
  .safety-note { color: #7d908e; }
  .composer__input::placeholder { color: #7d908e; }
  .genz__track { background: #2c4246; }
  .navitem.is-active { color: var(--accent-bright); }
  .lock-card { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App shell (full width on all sizes; content is centred within) */
.app {
  width: 100%;
  min-height: 100dvh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
}

.body { flex: 1; display: flex; min-height: 0; }
.chatcol { flex: 1; display: flex; min-width: 0; min-height: 0; }
.chatinner {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Session notes side panel (wide screens only) */
.notes { display: none; }
.notes__head { padding: 16px 16px 6px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.notes__toggle {
  flex: none;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.notes__toggle svg { width: 15px; height: 15px; }
.notes__toggle:hover { color: var(--accent-strong); }
.notes__rail { display: none; }
.notes.is-collapsed { width: 46px; overflow: hidden; }
.notes.is-collapsed .notes__head { padding: 12px 0 0; justify-content: center; }
.notes.is-collapsed .notes__headtext, .notes.is-collapsed .notes__body, .notes.is-collapsed #notes-pdf { display: none; }
.notes.is-collapsed .notes__toggle svg { transform: rotate(180deg); }
.notes.is-collapsed .notes__rail {
  display: block;
  writing-mode: vertical-rl;
  margin: 14px auto 0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.notes__title { margin: 0; font-size: 1rem; font-weight: 800; color: var(--ink); }
.notes__sub { margin: 3px 0 0; font-size: 0.76rem; color: var(--muted); }
.notes__body { padding: 6px 16px 24px; }
.notes__empty { color: var(--muted); font-size: 0.85rem; padding: 8px 0; line-height: 1.5; }
.notes__section { margin-top: 16px; }
.notes__label { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-strong); margin: 0 0 7px; }
.notes__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.notes__item { background: var(--surface); border-radius: 10px; padding: 8px 11px; font-size: 0.85rem; color: var(--ink); animation: msgIn 0.25s ease both; }
.notes__item a { color: var(--accent-strong); text-decoration: none; font-weight: 600; word-break: break-word; }
.notes__item a:hover { text-decoration: underline; }

@media (min-width: 900px) {
  .notes {
    display: flex;
    flex-direction: column;
    width: 340px;
    flex: none;
    border-left: 1px solid var(--border);
    background: var(--panel);
    overflow-y: auto;
  }
}

/* Top app bar */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { margin: 0; display: flex; flex-direction: column; gap: 1px; }
.brand__name { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1; }
.brand__dot { color: var(--accent-bright); }
.brand__product { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; color: var(--accent-strong); }
.adviser-cta {
  flex: none;
  text-decoration: none;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}
.adviser-cta:hover { background: #cdeee8; }

/* Mode switch + supervised chip */
.subbar { padding: 10px 16px 0; display: flex; flex-direction: column; gap: 8px; }
.modes {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border-radius: 999px;
  padding: 4px;
}
.mode {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 8px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s;
}
@media (max-width: 430px) {
  .mode { font-size: 0.78rem; padding: 9px 2px; }
}
.mode.is-active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(10, 115, 104, 0.3); }
.mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pillsrow { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }

.supervised-note {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 12px;
}

/* Gen-Z mode toggle (students only) */
.genz {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 12px 4px 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.genz[hidden] { display: none; }
.genz:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.genz__track {
  width: 28px;
  height: 17px;
  border-radius: 999px;
  background: #c3d2cf;
  position: relative;
  transition: background 0.15s;
}
.genz__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(12, 31, 34, 0.3);
  transition: transform 0.18s;
}
.genz[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); }
.genz[aria-pressed="true"] .genz__track { background: var(--accent-grad); }
.genz[aria-pressed="true"] .genz__knob { transform: translateX(11px); }

/* Start-again pill */
.restart {
  border: 0;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.restart:hover { color: var(--accent-strong); }
.restart[data-armed] { background: #fdecec; color: #8a2b2b; }
.restart--accent { background: var(--accent-soft); color: var(--accent-strong); }

/* Action plan overlay */
.plan-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  overflow-y: auto;
  padding: 20px 16px 40px;
}
.plan-overlay[hidden] { display: none; }
.plan-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 40px rgba(12, 31, 34, 0.12);
}
.plan-head { margin-bottom: 6px; }
.plan-title { margin: 4px 0 0; font-size: 1.35rem; color: var(--ink); letter-spacing: -0.01em; }
.plan-date { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.plan-body { margin-top: 8px; }
.plan-sec { margin-top: 16px; }
.plan-sec h3 {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.plan-sec ul, .plan-sec ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.plan-sec li { font-size: 0.95rem; color: var(--ink); }
.plan-sec a { color: var(--accent-strong); word-break: break-all; }
.plan-sec--adviser { background: var(--panel); border-radius: 12px; padding: 12px 14px; }
.plan-sec--adviser h3 { margin-top: 0; }
.plan-sec--adviser p { margin: 0; font-size: 0.9rem; color: var(--ink); }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.planbtn {
  flex: 1;
  min-width: 130px;
  border: 0;
  background: var(--accent-grad);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
}
.planbtn--ghost { background: var(--panel); color: var(--accent-strong); }
.plan-foot { margin: 14px 0 0; font-size: 0.72rem; color: var(--muted); }

@media print {
  body > *:not(.plan-overlay) { display: none !important; }
  .plan-overlay { position: static; background: #fff; padding: 0; overflow: visible; }
  .plan-overlay[hidden] { display: none !important; }
  .plan-card { box-shadow: none; max-width: none; padding: 0; }
  .plan-actions { display: none !important; }
}

/* Chat */
.chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}
/* Anchor a short conversation to the bottom, like a real messaging app. */
.chat > :first-child { margin-top: auto; }

.row { display: flex; align-items: flex-end; gap: 8px; animation: msgIn 0.28s ease both; }
.row--user { justify-content: flex-end; }
.row--assistant, .row--error { justify-content: flex-start; }

.avatar {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(10, 115, 104, 0.28);
}
.avatar svg { width: 22px; height: 22px; }
.avatar--lg { width: 48px; height: 48px; margin: 0 auto 6px; }
.avatar--lg svg { width: 34px; height: 34px; }
.face-eyes { transform-origin: 12px 10.2px; animation: advisiBlink 4.6s infinite; }
@keyframes advisiBlink {
  0%, 93%, 100% { transform: scaleY(1); }
  95.5% { transform: scaleY(0.12); }
}
@media (prefers-reduced-motion: reduce) {
  .face-eyes { animation: none; }
}

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 20px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.45;
}
.msg--user { background: var(--accent-grad); color: #fff; border-bottom-right-radius: 6px; }
.msg--assistant { background: var(--panel); color: var(--ink); border-bottom-left-radius: 6px; }
.msg--error { background: #fdecec; border: 1px solid #f3c6c6; color: #8a2b2b; font-size: 0.9rem; border-radius: 16px; }
.msg--assistant a { color: var(--accent-strong); font-weight: 700; }
.safety-note a { color: inherit; font-weight: 700; }
.retry {
  display: block;
  margin-top: 8px;
  border: 0;
  background: #8a2b2b;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

/* Helpful / not-helpful votes */
.fb { display: flex; gap: 2px; justify-content: flex-end; margin: 6px -6px -4px 0; }
.fb__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  opacity: 0.55;
  width: 26px; height: 24px;
  padding: 2px;
  border-radius: 8px;
  cursor: pointer;
}
.fb__btn svg { width: 15px; height: 15px; }
.fb__btn:hover { opacity: 1; }
.fb__btn.is-voted { color: var(--accent-strong); opacity: 1; }
.fb__btn:disabled:not(.is-voted) { opacity: 0.25; cursor: default; }

.typing { display: inline-flex; gap: 5px; align-items: center; padding: 3px 0; }
.typing__label { font-size: 0.78rem; color: var(--muted); margin-left: 6px; }
.typing__label:empty { display: none; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.empty { margin: auto; text-align: center; color: var(--muted); max-width: 30ch; padding: 20px; }
.empty__title { font-weight: 800; color: var(--ink); font-size: 1.3rem; margin: 0 0 8px; }

/* Suggestion chips */
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 8px; }
.suggestions .chip:last-child:nth-child(odd) { grid-column: 1 / -1; }
.chip {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 10px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.08s;
}
.chip:hover { background: #cdeee8; }
.chip:active { transform: scale(0.97); }

/* Composer */
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--panel);
  border-radius: 26px;
  padding: 6px 6px 6px 14px;
  margin: 0 16px 8px;
}
.composer__input {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  font: inherit;
  color: var(--ink);
  max-height: 160px;
  padding: 8px 0;
}
.composer__input:focus { outline: none; }
.composer__input::placeholder { color: #8a9899; }
.composer__mic {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 34px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.composer__mic svg { width: 20px; height: 20px; }
.composer__mic:hover { color: var(--accent-strong); }
.composer__mic.is-listening { color: var(--accent); animation: micPulse 1.2s infinite; }
.composer__mic[hidden] { display: none; }
@keyframes micPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.65; }
}

.composer__send {
  flex: none;
  border: 0;
  background: var(--accent-grad);
  color: #fff;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(10, 115, 104, 0.3);
}
.composer__send svg { width: 19px; height: 19px; }
.composer__send:disabled { opacity: 0.4; cursor: default; box-shadow: none; }

/* Footnote (config + safety) */
.footnote { padding: 0 16px 8px; text-align: center; }
.config-note { margin: 0 0 4px; font-size: 0.72rem; color: var(--muted); }
.config-note.warn { color: #8a2b2b; }
.config-note a { color: var(--accent-strong); font-weight: 700; }

/* End-of-demo card actions */
.paywall-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.paywall-btn {
  background: var(--accent-grad);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 9px 14px;
  border-radius: 999px;
}
.paywall-btn--ghost { background: var(--accent-soft); color: var(--accent-strong); }
.safety-note { margin: 0; font-size: 0.68rem; color: #8a9899; line-height: 1.4; }

/* Bottom navigation */
.bottomnav {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.navitem {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px calc(9px + env(safe-area-inset-bottom, 0px));
  text-decoration: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.navitem svg { width: 22px; height: 22px; }
.navitem.is-active { color: var(--accent); }
.navitem.is-active svg { filter: drop-shadow(0 2px 6px rgba(34, 205, 185, 0.45)); }

/* Access gate overlay */
.lock-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.lock-overlay[hidden] { display: none; }
.lock-card {
  width: 100%; max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 10px 40px rgba(12, 31, 34, 0.12);
}
.lock-brand { margin: 0; }
.lock-title { margin: 4px 0 0; font-size: 1.05rem; color: var(--ink); }
.lock-text { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); }
.lock-input {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  font: inherit; color: var(--ink); text-align: center;
}
.lock-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.lock-btn {
  border: 0; background: var(--accent-grad); color: #fff; font: inherit; font-weight: 700;
  padding: 12px 18px; border-radius: 12px; cursor: pointer;
}
.lock-error { margin: 0; font-size: 0.8rem; color: #8a2b2b; }
.lock-error[hidden] { display: none; }

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

@media (prefers-reduced-motion: reduce) {
  .row { animation: none; }
  .typing i { animation: none; }
  .composer__mic.is-listening { animation: none; }
}

/* --- Accessibility (SEND) options: set from the chat page's Aa panel, saved on
       this device, applied on every page by theme.js ---------------------------- */

/* Easy-read: British Dyslexia Association style guidance, a plainer face with
   wider letter, word and line spacing. */
html.easy-read body { font-family: Verdana, Tahoma, "Trebuchet MS", system-ui, sans-serif; letter-spacing: 0.012em; word-spacing: 0.08em; }
html.easy-read .msg__content, html.easy-read .t-msg { line-height: 1.75; }
html.easy-read p, html.easy-read li { line-height: 1.7; }

/* Higher contrast: stronger ink and visible edges, in both themes. */
html.high-contrast { --ink: #06100f; --muted: #26332f; --border: #4a625d; }
@media (prefers-color-scheme: dark) {
  html.high-contrast { --ink: #ffffff; --muted: #d9e4e2; --border: #83968f; }
}
html.high-contrast a { text-decoration: underline; }

/* Reduce motion: the manual version of the OS setting, for anyone who finds
   movement distracting but has no control over the device settings. */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; }
html.reduce-motion { scroll-behavior: auto !important; }

/* The Aa panel itself. */
.a11y-pop { position: fixed; top: 60px; right: 12px; z-index: 60; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px; width: min(330px, calc(100vw - 24px)); box-shadow: 0 14px 40px rgba(12, 31, 34, 0.22); }
.a11y-pop[hidden] { display: none; }
.a11y-title { font-size: 0.95rem; font-weight: 800; color: var(--ink); margin: 0 0 8px; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 9px 0; flex-wrap: wrap; }
.a11y-label { font-size: 0.84rem; font-weight: 700; color: var(--ink); }
.a11y-set { display: flex; gap: 6px; }
.a11y-opt { border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; font-size: 0.76rem; font-weight: 700; padding: 6px 11px; border-radius: 999px; cursor: pointer; }
.a11y-opt[aria-pressed="true"] { background: var(--accent-grad); color: #fff; border-color: transparent; }
.a11y-note { font-size: 0.72rem; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
