:root {
  --color-primary: #6d4cff;
  --color-primary-dark: #4f35df;
  --color-secondary: #a78bfa;
  --color-success: #22a06b;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-background: #f4f6ff;
  --color-surface: #ffffff;
  --color-surface-soft: #f7f8ff;
  --color-text: #11152a;
  --color-muted: #687086;
  --color-border: #dfe4f2;
  --color-dark: #101729;
  --color-dark-soft: #17213a;
  --color-purple-soft: #eeeaff;
  --focus-ring: rgba(109, 76, 255, 0.18);
  --shadow-soft: 0 22px 60px rgba(17, 21, 42, 0.11);
  --shadow-strong: 0 30px 90px rgba(17, 21, 42, 0.16);
  --radius-small: 10px;
  --radius-medium: 18px;
  --radius-large: 34px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(109, 76, 255, 0.12), transparent 32rem),
    var(--color-background);
  color: var(--color-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.app-shell {
  min-height: 100vh;
}

.is-hidden {
  display: none !important;
}

.welcome-screen {
  min-height: 100vh;
  padding: var(--space-3);
  background:
    radial-gradient(circle at 18% 8%, rgba(109, 76, 255, 0.16), transparent 26rem),
    radial-gradient(circle at 100% 0%, rgba(167, 139, 250, 0.16), transparent 28rem),
    var(--color-background);
}

.welcome-card {
  display: grid;
  width: min(1500px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(223, 228, 242, 0.9);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  box-shadow: var(--shadow-strong);
}

.welcome-brand-panel {
  position: relative;
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-4);
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(109, 76, 255, 0.28), transparent 9rem),
    radial-gradient(circle at 88% 18%, rgba(167, 139, 250, 0.2), transparent 8rem),
    linear-gradient(145deg, #0b1021, var(--color-dark));
  color: #ffffff;
}

.welcome-brand-panel::before,
.welcome-brand-panel::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.welcome-brand-panel::before {
  inset: auto -18% -10% -18%;
  height: 190px;
  border-top: 1px solid rgba(167, 139, 250, 0.38);
  border-radius: 50%;
  box-shadow:
    0 -24px 0 -22px rgba(109, 76, 255, 0.5),
    0 -48px 0 -45px rgba(167, 139, 250, 0.32);
}

.welcome-brand-panel::after {
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(167, 139, 250, 0.9) 0 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 255, 255, 0.42) 0 1px, transparent 1px);
  background-position: 72% 10%, 10% 22%;
  background-size: 132px 132px, 170px 170px;
  opacity: 0.5;
}

.welcome-brand {
  display: inline-flex;
  position: relative;
  z-index: 1;
  align-items: center;
  gap: var(--space-3);
  width: fit-content;
  color: #ffffff;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 900;
}

.welcome-brand strong,
.welcome-copy h1 span {
  color: var(--color-secondary);
}

.welcome-logo-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--color-primary), var(--color-secondary));
  box-shadow: 0 18px 40px rgba(109, 76, 255, 0.42);
  color: #ffffff;
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
  font-size: 0.9rem;
  font-weight: 900;
}

.welcome-copy,
.welcome-feature-list,
.student-quote {
  position: relative;
  z-index: 1;
}

.welcome-copy {
  display: grid;
  gap: var(--space-3);
}

.welcome-copy h1,
.login-panel h2 {
  margin: 0;
  line-height: 1.12;
}

.welcome-copy h1 {
  max-width: 12.5ch;
  font-size: clamp(2.05rem, 6.5vw, 3.35rem);
}

.welcome-copy p {
  max-width: 33ch;
  margin: 0;
  color: #d9def0;
  font-size: 1.03rem;
}

.welcome-feature-list {
  display: grid;
  gap: var(--space-4);
}

.welcome-feature {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: start;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-secondary);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
  font-size: 0.82rem;
  font-weight: 900;
}

.welcome-feature strong,
.welcome-feature small {
  display: block;
}

.welcome-feature strong {
  color: #ffffff;
}

.welcome-feature small {
  margin-top: var(--space-1);
  color: #c7cee5;
  font-size: 0.92rem;
}

.student-quote {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.student-quote blockquote,
.student-quote figcaption,
.login-panel p,
.login-panel label {
  margin: 0;
}

.login-panel p,
.login-note,
.signup-note,
.login-feedback {
  color: var(--color-muted);
}

.student-quote blockquote {
  color: #ffffff;
}

.student-quote blockquote::before {
  display: block;
  width: 34px;
  height: 8px;
  margin-bottom: var(--space-3);
  border-radius: 999px;
  content: "";
  background: var(--color-secondary);
}

.student-quote figcaption {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  color: #e7eaff;
  font-size: 0.9rem;
  font-weight: 800;
}

.quote-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--color-secondary);
  color: var(--color-dark);
}

.login-side {
  position: relative;
  display: grid;
  align-content: center;
  min-height: auto;
  padding: var(--space-5) var(--space-4);
  background:
    radial-gradient(circle at 60% 14%, rgba(109, 76, 255, 0.08), transparent 18rem),
    #ffffff;
}

.language-pill {
  display: inline-flex;
  justify-self: end;
  align-items: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 30px rgba(17, 21, 42, 0.08);
  color: var(--color-text);
  font-weight: 800;
}

.language-pill span {
  color: var(--color-primary);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
}

.login-panel {
  display: grid;
  gap: var(--space-3);
  width: min(520px, 100%);
  margin: 0 auto;
  border: 0;
  background: transparent;
}

.login-heading {
  margin-bottom: var(--space-2);
  text-align: center;
}

.login-panel h2 {
  margin-top: var(--space-1);
  font-size: clamp(2rem, 4vw, 2.4rem);
}

.login-panel label {
  display: grid;
  gap: var(--space-2);
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 800;
}

.login-panel input,
.login-panel select,
.social-login-button {
  min-height: 54px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 12px 26px rgba(17, 21, 42, 0.04);
}

.login-panel input:focus,
.login-panel select:focus {
  border-color: var(--color-primary);
  outline: 4px solid var(--focus-ring);
}

.social-login-list {
  display: grid;
  gap: var(--space-3);
}

.social-login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-size: 1.05rem;
  font-weight: 900;
}

.social-login-button:hover,
.social-login-button:focus-visible {
  border-color: var(--color-primary);
  outline: 4px solid var(--focus-ring);
}

.social-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.social-icon.is-apple {
  color: #11152a;
}

.login-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-3);
  align-items: center;
  color: var(--color-muted);
}

.login-divider::before,
.login-divider::after {
  height: 1px;
  content: "";
  background: var(--color-border);
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: 0 12px 26px rgba(17, 21, 42, 0.04);
}

.password-field:focus-within {
  border-color: var(--color-primary);
  outline: 4px solid var(--focus-ring);
}

.password-field input {
  border: 0;
  box-shadow: none;
}

.password-field input:focus {
  outline: 0;
}

.password-toggle {
  min-height: 44px;
  padding: 0 var(--space-3);
  background: transparent;
  color: var(--color-muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.login-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: center;
}

.remember-option {
  display: inline-flex !important;
  grid-template-columns: none !important;
  gap: var(--space-2) !important;
  align-items: center;
  color: var(--color-muted) !important;
  font-weight: 700 !important;
}

.remember-option input {
  width: 22px;
  height: 22px;
  min-height: auto;
  padding: 0;
  box-shadow: none;
  accent-color: var(--color-primary);
}

.login-row a,
.text-button {
  color: var(--color-primary-dark);
  font-weight: 900;
  text-decoration: none;
}

.login-row a:hover,
.login-row a:focus-visible,
.text-button:hover,
.text-button:focus-visible {
  text-decoration: underline;
}

.login-panel[data-mode="signup"] .login-row {
  display: none;
}

.login-feedback {
  min-height: 22px;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
}

.login-feedback:empty {
  display: none;
}

.login-feedback.is-error {
  color: var(--color-error);
}

.login-feedback.is-success {
  color: var(--color-success);
}

.text-button {
  padding: 0;
  background: transparent;
}

.primary-button,
.demo-login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 0 var(--space-4);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #ffffff;
  box-shadow: 0 18px 36px rgba(109, 76, 255, 0.32);
  font-size: 1.06rem;
  font-weight: 900;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: linear-gradient(135deg, #7c5cff, var(--color-primary-dark));
  outline: 4px solid var(--focus-ring);
}

.demo-login-button {
  flex-direction: column;
  gap: 2px;
  min-height: 64px;
  border: 1px solid rgba(109, 76, 255, 0.24);
  background: var(--color-purple-soft);
  color: var(--color-primary-dark);
  box-shadow: none;
}

.demo-login-button small {
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.demo-login-button:hover,
.demo-login-button:focus-visible {
  border-color: var(--color-primary);
  background: #e5ddff;
  outline: 4px solid var(--focus-ring);
}

.signup-note {
  text-align: center;
}

.welcome-footer {
  color: var(--color-muted);
}

.welcome-footer {
  margin: var(--space-4) 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 24% 8%, rgba(109, 76, 255, 0.22), transparent 10rem),
    linear-gradient(160deg, #0b1021, var(--color-dark));
  color: #ffffff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: inherit;
  text-decoration: none;
}

.brand-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.brand strong,
.brand small,
.session-card strong,
.session-card small {
  display: block;
}

.brand strong,
.sidebar-label,
.assistant-icon,
.active-assistant-icon {
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
}

.brand small,
.session-card small,
.eyebrow,
.sidebar-label,
.assistant-card p,
.composer-help,
.empty-state p,
.message-meta,
.message-actions {
  color: var(--color-muted);
}

.sidebar .brand small,
.sidebar .session-card small,
.sidebar .sidebar-label,
.sidebar .assistant-card p {
  color: #c5cce3;
}

.new-chat-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  width: 100%;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(244, 246, 255, 0.94);
  color: #252a35;
  font-size: 1rem;
  font-weight: 750;
  text-align: left;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.new-chat-button svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.new-chat-button:hover,
.new-chat-button:focus-visible {
  background: #ffffff;
  outline: 3px solid rgba(167, 139, 250, 0.28);
}

.session-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
  margin-top: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.session-card > span:not(.session-avatar) {
  min-width: 0;
}

.session-card strong,
.session-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-small);
  background: linear-gradient(145deg, var(--color-primary), var(--color-secondary));
  color: #ffffff;
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 800;
}

.sign-out-button {
  min-height: 32px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #c5cce3;
  font-size: 0.82rem;
  font-weight: 800;
}

.sign-out-button:hover,
.sign-out-button:focus-visible {
  border-color: rgba(167, 139, 250, 0.36);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  outline: 3px solid rgba(167, 139, 250, 0.22);
}

.sidebar-section {
  display: grid;
  gap: var(--space-2);
}

.sidebar-label,
.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.assistant-list {
  display: grid;
  gap: var(--space-2);
}

.assistant-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  position: relative;
  width: 100%;
  padding: var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: transparent;
  color: inherit;
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.assistant-card:hover,
.assistant-card:focus-visible,
.assistant-card.is-active {
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(109, 76, 255, 0.17);
  outline: 0;
}

.assistant-card:focus-visible {
  outline: 3px solid rgba(167, 139, 250, 0.28);
  outline-offset: 2px;
}

.assistant-icon,
.active-assistant-icon,
.message-avatar {
  display: grid;
  place-items: center;
  border-radius: var(--radius-small);
  background: var(--color-purple-soft);
  color: var(--color-primary-dark);
  font-weight: 800;
}

.sidebar .assistant-icon {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-secondary);
}

.assistant-icon {
  width: 40px;
  height: 40px;
  font-size: 0.85rem;
}

.assistant-card h2,
.assistant-card p {
  margin: 0;
}

.assistant-card-content {
  min-width: 0;
}

.assistant-card h2 {
  font-size: 0.95rem;
}

.assistant-card p {
  margin-top: var(--space-1);
  font-size: 0.84rem;
}

.assistant-best-for {
  display: grid;
  gap: var(--space-1);
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    max-height 180ms ease,
    margin-top 180ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.assistant-card:hover .assistant-best-for,
.assistant-card:focus-visible .assistant-best-for {
  max-height: 160px;
  margin-top: var(--space-2);
  opacity: 1;
  transform: translateY(0);
}

.assistant-best-for-label {
  color: #c5cce3;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.assistant-best-for-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.assistant-best-for-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(167, 139, 250, 0.24);
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.14);
  color: #e8e3ff;
  font-size: 0.72rem;
  font-weight: 800;
}

.sidebar-error {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid #fecaca;
  border-radius: var(--radius-small);
  background: #fef2f2;
  color: var(--color-error);
  font-size: 0.9rem;
}

.chat-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.chat-topbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
}

.active-assistant {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.active-assistant-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, var(--color-primary), var(--color-secondary));
  color: #ffffff;
}

.chat-topbar h1,
.chat-topbar p {
  margin: 0;
}

.chat-topbar h1 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  line-height: 1.1;
}

.chat-topbar p:last-child {
  max-width: 62ch;
}

.topbar-new-chat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 42px;
  width: fit-content;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 900;
}

.topbar-new-chat-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.topbar-new-chat-button:hover,
.topbar-new-chat-button:focus-visible {
  border-color: var(--color-primary);
  outline: 4px solid var(--focus-ring);
}

.chat-panel {
  display: grid;
  grid-template-rows: 1fr auto auto;
  flex: 1;
  min-height: 0;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: min(860px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  overflow-y: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 46vh;
  text-align: center;
}

.empty-state img {
  width: 72px;
  height: 72px;
  margin-bottom: var(--space-3);
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.empty-state p {
  max-width: 54ch;
  margin-top: var(--space-2);
}

.message-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  animation: message-in 180ms ease-out;
}

.message-row.is-user {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.message-row.is-user .message-avatar {
  grid-column: 2;
}

.message-row.is-user .message-content {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  max-width: min(640px, 100%);
}

.message-avatar {
  width: 36px;
  height: 36px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
  font-size: 0.78rem;
}

.is-user .message-avatar {
  background: var(--color-surface);
  border-color: rgba(109, 76, 255, 0.28);
  color: var(--color-primary-dark);
}

.message-content {
  max-width: 72ch;
  padding: 14px var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  box-shadow: 0 12px 30px rgba(17, 21, 42, 0.06);
}

.is-user .message-content {
  border-color: rgba(109, 76, 255, 0.18);
  background: #f7f4ff;
  color: var(--color-text);
  box-shadow: 0 10px 24px rgba(109, 76, 255, 0.08);
}

.is-user .message-meta,
.is-user .message-actions {
  color: var(--color-muted);
}

.is-error .message-content {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--color-error);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin: 0 0 var(--space-1);
  font-size: 0.76rem;
  font-weight: 700;
}

.message-text {
  margin: 0;
  overflow-wrap: anywhere;
}

.message-text p,
.message-text ul,
.message-text pre {
  margin: 0;
}

.message-text p + p,
.message-text p + ul,
.message-text ul + p,
.message-text pre + p,
.message-text p + pre {
  margin-top: var(--space-2);
}

.message-text ul {
  padding-left: 1.2rem;
}

.message-text code {
  padding: 0.1rem 0.28rem;
  border-radius: 5px;
  background: var(--color-surface-soft);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
  font-size: 0.9em;
}

.message-text pre {
  overflow-x: auto;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: #111827;
  color: #f8fafc;
}

.message-text pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}

.is-user .message-text code {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.is-user .message-text pre {
  border-color: rgba(255, 255, 255, 0.22);
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.message-action-button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.message-action-button:hover:not(:disabled),
.message-action-button:focus-visible:not(:disabled) {
  border-color: var(--color-primary);
  outline: 3px solid var(--focus-ring);
}

.is-user .message-action-button {
  border-color: rgba(109, 76, 255, 0.18);
  background: rgba(255, 255, 255, 0.74);
  color: var(--color-primary-dark);
}

.typing-dots {
  display: inline-flex;
  gap: 5px;
  margin-left: var(--space-1);
  vertical-align: middle;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--color-muted);
  animation: typing 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .message-row,
  .typing-dots span {
    animation: none;
  }
}

.prompt-suggestions {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: var(--space-2);
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 0 var(--space-4) var(--space-3);
}

.prompt-suggestions.is-hidden {
  display: none;
}

.prompt-chip {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-text);
  text-align: left;
}

.prompt-chip:hover,
.prompt-chip:focus-visible {
  border-color: var(--color-primary);
  outline: 3px solid var(--focus-ring);
}

.composer {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 0 var(--space-4) var(--space-4);
}

.composer-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  align-items: end;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.composer textarea {
  width: 100%;
  max-height: 160px;
  min-height: 44px;
  padding: 11px var(--space-2);
  border: 0;
  background: transparent;
  color: var(--color-text);
  line-height: 1.45;
  resize: none;
}

.composer textarea:focus {
  outline: 0;
}

.composer-box:focus-within {
  border-color: var(--color-primary);
  outline: 3px solid var(--focus-ring);
}

.send-button {
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-small);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #ffffff;
  font-weight: 800;
}

.send-button:hover:not(:disabled),
.send-button:focus-visible:not(:disabled) {
  background: linear-gradient(135deg, #7c5cff, var(--color-primary-dark));
  outline: 0;
}

.composer-help {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  font-size: 0.82rem;
  text-align: center;
}

.character-counter {
  font-weight: 800;
}

.character-counter.is-warning {
  color: var(--color-warning);
}

.new-chat-dialog {
  width: min(620px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--color-text);
}

.tutorial-dialog {
  width: min(760px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: var(--color-text);
}

.tutorial-dialog::backdrop {
  background: rgba(11, 16, 33, 0.5);
  backdrop-filter: blur(8px);
}

.tutorial-panel {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 10% 0%, rgba(109, 76, 255, 0.11), transparent 18rem),
    var(--color-surface);
  box-shadow: var(--shadow-strong);
}

.tutorial-header {
  display: grid;
  gap: var(--space-1);
}

.tutorial-header h2,
.tutorial-header p,
.tutorial-steps h3,
.tutorial-steps p {
  margin: 0;
}

.tutorial-header h2 {
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  line-height: 1.1;
}

.tutorial-header p,
.tutorial-steps p {
  color: var(--color-muted);
}

.tutorial-steps {
  display: grid;
  gap: var(--space-2);
}

.tutorial-steps article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  align-items: start;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: rgba(247, 248, 255, 0.72);
}

.tutorial-steps span {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--color-purple-soft);
  color: var(--color-primary-dark);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 900;
}

.tutorial-steps h3 {
  font-size: 1rem;
}

.tutorial-panel .primary-button {
  width: 100%;
}

.new-chat-dialog::backdrop {
  background: rgba(11, 16, 33, 0.46);
  backdrop-filter: blur(8px);
}

.new-chat-dialog-panel {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  box-shadow: var(--shadow-strong);
}

.new-chat-dialog-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: start;
}

.new-chat-dialog h2,
.new-chat-dialog p {
  margin: 0;
}

.new-chat-dialog h2 {
  margin-top: var(--space-1);
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.1;
}

.new-chat-dialog-header p:last-child {
  margin-top: var(--space-1);
  color: var(--color-muted);
}

.dialog-close-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-soft);
  color: var(--color-text);
  font-size: 1.35rem;
  line-height: 1;
}

.dialog-close-button:hover,
.dialog-close-button:focus-visible {
  border-color: var(--color-primary);
  outline: 3px solid var(--focus-ring);
}

.new-chat-agent-list {
  display: grid;
  gap: var(--space-2);
}

.new-chat-agent-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  text-align: left;
}

.new-chat-agent-card strong,
.new-chat-agent-card small {
  display: block;
}

.new-chat-agent-card small {
  margin-top: 2px;
  color: var(--color-muted);
}

.new-chat-agent-card:hover,
.new-chat-agent-card:focus-visible,
.new-chat-agent-card.is-active {
  border-color: var(--color-primary);
  background: var(--color-surface-soft);
}

.new-chat-agent-card:focus-visible {
  outline: 3px solid var(--focus-ring);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 759px) {
  .welcome-screen {
    padding: var(--space-3);
  }

  .app-shell {
    display: flex;
    flex-direction: column;
  }

  .chat-layout {
    order: 1;
    min-height: 100vh;
  }

  .sidebar {
    order: 2;
  }

  .chat-topbar {
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .welcome-brand-panel,
  .login-side {
    padding: var(--space-4);
  }

  .welcome-brand-panel {
    gap: var(--space-4);
  }

  .welcome-feature-list,
  .student-quote {
    display: none;
  }

  .welcome-brand-panel::before {
    display: none;
  }

  .welcome-copy h1 {
    font-size: clamp(2rem, 10vw, 2.75rem);
  }

  .login-panel h2 {
    font-size: 1.8rem;
  }
}

@media (min-width: 760px) and (max-height: 820px) {
  .welcome-screen {
    padding: var(--space-2);
  }

  .welcome-card {
    min-height: calc(100vh - var(--space-4));
  }

  .welcome-brand-panel {
    gap: var(--space-4);
    padding: var(--space-5);
  }

  .welcome-feature-list {
    gap: var(--space-3);
    margin-top: 0;
  }

  .student-quote {
    display: none;
  }

  .login-side {
    align-content: start;
    min-height: calc(100vh - var(--space-4));
    padding: 88px var(--space-5) var(--space-4);
  }
}

@media (min-width: 760px) {
  .welcome-card {
    grid-template-columns: minmax(360px, 0.88fr) minmax(420px, 1.12fr);
    min-height: 680px;
  }

  .welcome-brand-panel {
    padding: var(--space-6);
  }

  .login-side {
    position: relative;
    min-height: 680px;
    padding: var(--space-5);
  }

  .language-pill {
    position: absolute;
    top: var(--space-5);
    right: var(--space-5);
  }

  .welcome-feature-list {
    margin-top: var(--space-3);
  }

  .student-quote {
    align-self: end;
  }

  .welcome-feature-list,
  .student-quote {
    max-width: 420px;
  }

  .welcome-feature-list {
    gap: var(--space-4);
  }

  .login-panel {
    gap: var(--space-2);
  }

  .login-heading {
    margin-bottom: 0;
  }

  .social-login-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .social-login-button {
    min-height: 48px;
    gap: 6px;
    padding: 0 var(--space-2);
    font-size: 0.78rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .social-icon {
    width: 22px;
    height: 22px;
  }

  .login-panel input,
  .login-panel select {
    min-height: 50px;
  }

  .primary-button {
    min-height: 52px;
  }

  .demo-login-button {
    min-height: 58px;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 0;
  }

  .sidebar-section {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .assistant-list {
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
  }

  .chat-layout {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .chat-topbar {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--space-4) var(--space-5);
  }

  .topbar-new-chat-button {
    display: none;
  }

  .prompt-suggestions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
