:root {
  color-scheme: light;
  --bg: #fff8f1;
  --bg-soft: #fffdf9;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --panel-accent: rgba(255, 233, 214, 0.82);
  --line: rgba(19, 41, 70, 0.1);
  --text: #18314f;
  --muted: #62748a;
  --heading: #0f2742;
  --coral: #ff6f61;
  --teal: #19b7a5;
  --yellow: #ffd166;
  --sky: #8cd6ff;
  --navy: #17324d;
  --mint: #dff8f2;
  --shadow-lg: 0 28px 60px rgba(18, 39, 63, 0.12);
  --shadow-md: 0 16px 34px rgba(18, 39, 63, 0.08);
  --shadow-sm: 0 8px 20px rgba(18, 39, 63, 0.06);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --font-sans: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 111, 97, 0.18), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(25, 183, 165, 0.18), transparent 26%),
    linear-gradient(180deg, #fffaf4 0%, #fff4ea 52%, #fffdf8 100%);
  font-family: var(--font-sans);
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.24), transparent 72%);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
}

.site-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(16px);
  opacity: 0.75;
  animation: float 14s ease-in-out infinite;
}

.orb-a {
  top: 3rem;
  left: -4rem;
  width: 18rem;
  height: 18rem;
  background: rgba(255, 111, 97, 0.2);
}

.orb-b {
  top: 24rem;
  right: -2rem;
  width: 16rem;
  height: 16rem;
  background: rgba(140, 214, 255, 0.22);
  animation-delay: -4s;
}

.orb-c {
  bottom: -4rem;
  left: 45%;
  width: 20rem;
  height: 20rem;
  background: rgba(25, 183, 165, 0.18);
  animation-delay: -7s;
}

.grid-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.5), transparent 58%),
    linear-gradient(180deg, rgba(255, 248, 241, 0.4), rgba(255, 255, 255, 0));
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.site-header,
.site-footer,
.hero,
.section-block,
.app-shell,
.workspace-panel,
.info-card,
.route-card,
.chat-card,
.stack-card,
.auth-card,
.app-hero {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.site-header {
  position: sticky;
  top: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--coral), #ff9b72);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 12px 24px rgba(255, 111, 97, 0.28);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--heading);
}

.brand-copy span {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  transition: 160ms ease;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--heading);
  background: rgba(255, 255, 255, 0.86);
}

.header-cta,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: none;
  padding: 12px 18px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.header-cta,
.primary-button {
  background: linear-gradient(135deg, var(--coral), #ff8f6c);
  color: #fff;
  box-shadow: 0 14px 26px rgba(255, 111, 97, 0.26);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.account-shell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(23, 50, 77, 0.08);
  box-shadow: var(--shadow-sm);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(25, 183, 165, 0.18), rgba(140, 214, 255, 0.3));
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 800;
}

.account-copy {
  display: grid;
  line-height: 1.05;
}

.account-copy strong {
  color: var(--heading);
  font-size: 0.9rem;
}

.account-copy span {
  color: var(--muted);
  font-size: 0.76rem;
}

.account-logout {
  padding-inline: 14px;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.8);
  color: var(--heading);
  border: 1px solid rgba(23, 50, 77, 0.1);
}

.header-cta:hover,
.primary-button:hover,
.secondary-button:hover,
.pill-button:hover,
.workspace-card:hover,
.nav-arrow:hover {
  transform: translateY(-2px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: progress;
  opacity: 0.72;
  transform: none;
}

.page {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.hero,
.section-block,
.app-shell {
  position: relative;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.hero::after,
.section-block::after,
.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.34), transparent 40%, rgba(255, 255, 255, 0.16));
}

.hero,
.section-block,
.app-shell,
.site-footer {
  padding: 32px;
}

.hero-auth {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 28px;
  align-items: start;
}

.hero-copy,
.auth-card,
.section-heading,
.info-card,
.route-card,
.workspace-card,
.chat-card,
.sidebar-card,
.kb-card,
.quiz-card,
.analysis-card {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin-bottom: 14px;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1,
.section-heading h2,
.app-hero h1 {
  font-family: var(--font-display);
  color: var(--heading);
  line-height: 1.03;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2.8rem, 5vw, 4.7rem);
  max-width: 11ch;
}

.hero-lead,
.section-copy,
.route-card p,
.info-card p,
.workspace-card p,
.site-footer p,
.stack-copy,
.auth-card p,
.app-hero p,
.chat-subcopy,
.kb-note,
.quiz-note,
.meta-text {
  color: var(--muted);
  font-size: 1rem;
}

.hero-lead {
  max-width: 60ch;
  margin-top: 18px;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.pill-button {
  padding: 10px 14px;
  border: 1px solid rgba(23, 50, 77, 0.1);
  background: rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  color: var(--heading);
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.pill-button.is-active,
.quick-chip.is-active,
.mode-tab.is-active {
  background: rgba(25, 183, 165, 0.14);
  border-color: rgba(25, 183, 165, 0.34);
  color: var(--teal);
}

.hero-story-card,
.sidebar-card,
.kb-card,
.quiz-card,
.analysis-card,
.chat-card,
.composer-card,
.dropzone,
.doc-list,
.route-card,
.info-card,
.workspace-card,
.stack-card,
.metric-card,
.source-card,
.score-card,
.output-card {
  background: var(--panel-strong);
  border: 1px solid rgba(23, 50, 77, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.hero-story-card {
  margin-top: 24px;
  padding: 22px;
}

.story-badge,
.card-tag,
.route-kicker,
.small-label,
.status-chip,
.file-chip,
.engine-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.24);
  color: #90610d;
  font-size: 0.82rem;
  font-weight: 800;
}

.status-chip.is-live {
  background: rgba(25, 183, 165, 0.16);
  color: #158a7d;
}

.status-chip.is-demo {
  background: rgba(255, 111, 97, 0.14);
  color: #da5d50;
}

.status-chip.is-file {
  background: rgba(140, 214, 255, 0.22);
  color: #146085;
}

.hero-story-card h2 {
  margin-top: 14px;
  font-size: 1.45rem;
  color: var(--heading);
}

.hero-story-card p {
  margin-top: 10px;
}

.story-output {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.08), rgba(25, 183, 165, 0.08));
  color: var(--heading);
  font-weight: 600;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.metric-card {
  padding: 18px;
}

.metric-card strong {
  display: block;
  color: var(--heading);
  font-size: 2rem;
  font-weight: 800;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-card {
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 251, 244, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-card-head {
  display: grid;
  gap: 14px;
}

.auth-card h2,
.section-heading h2,
.app-hero h1,
.workspace-card h3,
.route-card h3,
.info-card h3,
.chat-card h2,
.sidebar-card h3,
.kb-card h3,
.quiz-card h3,
.analysis-card h3 {
  color: var(--heading);
}

.auth-card h2 {
  font-size: 1.75rem;
}

.auth-toggle {
  display: inline-flex;
  padding: 6px;
  border-radius: 999px;
  background: rgba(243, 246, 251, 0.92);
  width: fit-content;
}

.auth-toggle-button,
.quick-chip,
.mode-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.auth-toggle-button.is-active {
  background: #fff;
  color: var(--heading);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.session-summary {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(223, 248, 242, 0.92), rgba(255, 248, 241, 0.96));
  border: 1px solid rgba(25, 183, 165, 0.16);
}

.session-summary h3 {
  color: var(--heading);
  font-size: 1.4rem;
}

.session-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

label,
.field-block {
  display: grid;
  gap: 8px;
}

label span,
.field-block span {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--heading);
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(23, 50, 77, 0.1);
  background: rgba(255, 255, 255, 0.92);
  color: var(--heading);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(25, 183, 165, 0.22);
  border-color: rgba(25, 183, 165, 0.48);
}

.stack-card {
  margin-top: 18px;
  padding: 18px;
  background: linear-gradient(160deg, rgba(223, 248, 242, 0.92), rgba(255, 241, 229, 0.92));
}

.stack-title {
  color: var(--heading);
  font-weight: 800;
}

.stack-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-weight: 800;
  color: var(--heading);
}

.stack-flow span:not(.stack-arrow) {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
}

.stack-arrow {
  color: var(--coral);
}

.section-heading {
  max-width: 52rem;
}

.section-heading h2 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.section-copy {
  margin-top: 10px;
}

.pain-grid,
.route-grid,
.workspace-grid,
.kb-overview-grid,
.score-grid {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.pain-grid,
.route-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workspace-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.info-card,
.route-card,
.workspace-card {
  padding: 22px;
}

.card-tag {
  background: rgba(140, 214, 255, 0.22);
  color: #146085;
}

.route-kicker {
  background: rgba(25, 183, 165, 0.16);
  color: var(--teal);
}

.route-card code,
.mini-code {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f3f7fb;
  color: var(--navy);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
}

.workspace-card {
  display: grid;
  gap: 12px;
}

.workspace-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.14), rgba(25, 183, 165, 0.16));
  color: var(--heading);
  font-weight: 800;
}

.app-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 22px;
  padding: 32px;
  margin-top: 24px;
}

.hero-actions,
.quick-chip-row,
.mini-chip-row,
.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-actions {
  margin-top: 24px;
}

.app-shell {
  display: grid;
  gap: 24px;
}

.chat-layout,
.kb-layout,
.quiz-layout {
  display: grid;
  gap: 20px;
}

.chat-layout {
  grid-template-columns: 280px minmax(0, 1fr) 280px;
}

.kb-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
}

.quiz-layout {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.sidebar-column,
.utility-column,
.chat-main,
.kb-main,
.kb-side,
.quiz-main,
.quiz-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.sidebar-card,
.chat-card,
.kb-card,
.quiz-card,
.analysis-card,
.source-card,
.score-card,
.output-card,
.dropzone,
.doc-list,
.composer-card {
  padding: 20px;
}

.sidebar-card ul,
.analysis-list,
.doc-feed,
.source-list,
.score-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.sidebar-card li,
.doc-feed li,
.source-list li,
.score-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(243, 247, 251, 0.92);
  color: var(--heading);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.engine-chip {
  background: rgba(255, 111, 97, 0.14);
  color: var(--coral);
}

.chat-thread {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.message {
  display: grid;
  gap: 8px;
  max-width: 88%;
  padding: 16px 18px;
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}

.message.user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.9), rgba(255, 151, 119, 0.92));
  color: #fff;
  border-bottom-right-radius: 10px;
}

.message.assistant {
  background: rgba(255, 255, 255, 0.96);
  color: var(--heading);
  border-bottom-left-radius: 10px;
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.message-role {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}

.message ul {
  margin: 0;
  padding-left: 18px;
}

.composer-card {
  display: grid;
  gap: 14px;
}

.starter-list,
.deliverable-list,
#quiz-output-blocks {
  display: grid;
  gap: 12px;
}

.starter-button {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid rgba(23, 50, 77, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--heading);
  font: inherit;
  font-weight: 600;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.starter-button:hover,
.starter-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(25, 183, 165, 0.28);
  box-shadow: 0 10px 20px rgba(25, 183, 165, 0.08);
}

.deliverable-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.deliverable-card strong {
  color: var(--heading);
  font-size: 1rem;
}

.deliverable-card p {
  margin: 0;
  color: var(--muted);
}

.composer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.dropzone {
  border: 2px dashed rgba(25, 183, 165, 0.26);
  background: linear-gradient(140deg, rgba(223, 248, 242, 0.7), rgba(255, 250, 244, 0.95));
}

.dropzone.is-dragging {
  border-color: rgba(25, 183, 165, 0.62);
  background: linear-gradient(140deg, rgba(223, 248, 242, 0.98), rgba(240, 253, 250, 0.98));
  box-shadow: 0 0 0 6px rgba(25, 183, 165, 0.08);
}

.dropzone:focus-visible {
  outline: 3px solid rgba(25, 183, 165, 0.28);
  outline-offset: 4px;
}

.dropzone h3,
.kb-card h3,
.quiz-card h3,
.chat-card h2 {
  font-size: 1.3rem;
}

.drop-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.drop-panel strong {
  color: var(--heading);
  font-size: 1.05rem;
}

.upload-progress {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.upload-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(23, 50, 77, 0.08);
  overflow: hidden;
}

.upload-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--teal), var(--sky));
  transition: width 180ms ease;
}

.upload-progress-meta,
.kb-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-progress-text,
.upload-progress-detail {
  font-size: 0.86rem;
}

.drop-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.drop-actions.sample-quick-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 780px;
  width: 100%;
}

.sample-quick-list .sample-source-link {
  box-shadow: none;
  justify-content: center;
  min-height: 54px;
  padding-inline: 16px;
  text-decoration: none;
  width: 100%;
}

.sample-quick-list .sample-source-link {
  background: var(--teal-soft);
  border: 1px solid #bfe8dc;
  color: var(--teal);
  font-size: 0.92rem;
}

.sample-quick-list .sample-source-link:hover,
.sample-quick-list .sample-source-link:focus-visible {
  background: #d9f3eb;
  border-color: #9ed9c7;
}

.sample-quick-item button.is-added:disabled {
  cursor: not-allowed;
  background: var(--warm-soft);
  border-color: var(--line);
  color: var(--muted);
  opacity: 0.86;
}

@media (max-width: 700px) {
  .drop-actions.sample-quick-list {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

.source-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.source-kicker {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.library-delete-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.76rem;
}

.doc-list,
.output-card {
  min-height: 100%;
}

.upload-queue {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.upload-queue li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 50, 77, 0.08);
  color: var(--heading);
}

.upload-queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.upload-queue-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.upload-queue-copy strong {
  overflow-wrap: anywhere;
}

.upload-remove-button {
  border: 1px solid rgba(211, 92, 80, 0.2);
  border-radius: 999px;
  background: rgba(255, 111, 97, 0.1);
  color: #d35c50;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 8px 12px;
}

.upload-remove-button:hover,
.upload-remove-button:focus-visible {
  background: rgba(255, 111, 97, 0.18);
  outline: none;
}

.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.doc-feed li,
.source-list li {
  display: grid;
  gap: 4px;
}

.doc-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.doc-feed {
  gap: 16px;
}

.doc-group {
  display: grid;
  gap: 12px;
  padding: 0 !important;
  background: transparent !important;
}

.doc-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 2px;
}

.doc-group-list {
  display: grid;
  gap: 12px;
}

.doc-item {
  gap: 12px !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 255, 0.88)) !important;
}

.doc-empty-state {
  display: grid !important;
  gap: 8px;
  padding: 18px !important;
  background: rgba(255, 255, 255, 0.82) !important;
}

.doc-top,
.doc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doc-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.doc-copy strong {
  color: var(--heading);
  word-break: break-word;
}

.doc-icon {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding-inline: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.14), rgba(140, 214, 255, 0.28));
  color: var(--heading);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.doc-origin,
.doc-lock {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: capitalize;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.doc-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(25, 183, 165, 0.12);
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: lowercase;
}

.doc-action-button {
  padding: 9px 12px;
  font-size: 0.82rem;
  box-shadow: none;
}

.doc-action-button.is-danger {
  background: rgba(255, 111, 97, 0.12);
  color: #d35c50;
  border: 1px solid rgba(255, 111, 97, 0.18);
}

.file-meta,
.source-meta,
.result-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.kb-search {
  display: grid;
  gap: 12px;
}

.kb-entry-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.analysis-card h3,
.output-card h3 {
  font-size: 1.2rem;
}

.analysis-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 248, 241, 0.86);
  color: var(--heading);
}

.preset-stack {
  display: grid;
  gap: 10px;
}

.mode-switcher {
  display: inline-flex;
  width: fit-content;
  padding: 6px;
  border-radius: 999px;
  background: rgba(243, 246, 251, 0.94);
}

.quiz-workbench {
  display: grid;
  gap: 16px;
}

.prompt-box {
  padding: 18px;
  border-radius: 20px;
  background: rgba(243, 247, 251, 0.92);
  color: var(--heading);
}

.prompt-box textarea {
  width: 100%;
  margin-top: 12px;
  min-height: 150px;
  background: rgba(255, 255, 255, 0.86);
}

.prompt-box .meta-text {
  margin-top: 10px;
}

.output-card {
  display: grid;
  gap: 14px;
}

.output-block {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 50, 77, 0.07);
}

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

.score-grid-compact {
  grid-template-columns: 1fr;
  gap: 12px;
}

.score-grid-compact .score-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

.score-grid-compact .score-card strong {
  font-size: 1.45rem;
}

.score-card strong {
  display: block;
  font-size: 1.9rem;
  color: var(--heading);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.site-footer div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.reveal {
  animation: rise 680ms ease both;
}

.reveal:nth-child(2) {
  animation-delay: 80ms;
}

.reveal:nth-child(3) {
  animation-delay: 140ms;
}

.reveal:nth-child(4) {
  animation-delay: 180ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-18px);
  }
}

@media (max-width: 1100px) {
  .hero-auth,
  .app-hero,
  .chat-layout,
  .kb-layout,
  .quiz-layout {
    grid-template-columns: 1fr;
  }

  .pain-grid,
  .route-grid,
  .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  .site-header,
  .site-footer,
  .hero,
  .section-block,
  .app-shell,
  .app-hero {
    padding: 22px;
  }

  .site-header,
  .site-footer {
    border-radius: 28px;
  }

  .site-header,
  .site-footer,
  .composer-top,
  .header-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .doc-list-head,
  .kb-library-head,
  .upload-progress-meta,
  .doc-top,
  .doc-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .doc-actions {
    justify-content: flex-start;
  }

  .hero h1,
  .section-heading h2,
  .app-hero h1 {
    max-width: none;
    font-size: clamp(2.3rem, 11vw, 3.2rem);
  }

  .metric-row,
  .pain-grid,
  .route-grid,
  .workspace-grid,
  .source-grid,
  .score-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

    .message {
      max-width: 100%;
    }
  }

/* Harmonized visual system */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f9fc;
  --bg-elevated: #fbfcfe;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-accent: #effaf6;
  --line: #d8e1eb;
  --line-strong: #c7d3df;
  --text: #203043;
  --muted: #66758a;
  --heading: #142033;
  --teal: #15c39a;
  --teal-strong: #0d7d63;
  --teal-soft: #eafbf5;
  --navy: #0f172a;
  --sky-soft: #eff6ff;
  --warm-soft: #fff7ef;
  --shadow-lg: none;
  --shadow-md: none;
  --shadow-sm: none;
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-sans: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --page-max: 1180px;
  --card-padding: 24px;
  --focus-ring: 0 0 0 4px rgba(21, 195, 154, 0.12);
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
.site-bg {
  display: none;
}

.site-shell {
  width: 100%;
  max-width: none;
  padding: 0 0 56px;
}

.page {
  gap: 0;
  margin-top: 0;
}

.hero-copy,
.feature-copy,
.app-hero > div:first-child {
  display: grid;
  align-content: start;
  gap: 18px;
}

.site-header,
.hero,
.section-block,
.section-band,
.app-shell,
.app-hero,
.site-footer {
  width: min(var(--page-max), calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
  border: 0;
  border-bottom: 1px solid #e7edf3;
  border-radius: 0;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand-copy strong,
.brand-copy span,
.site-nav a,
.site-footer strong,
.site-footer span {
  font-family: var(--font-sans);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--teal);
  color: #ffffff;
  box-shadow: none;
}

.brand-copy strong {
  font-size: 1.08rem;
}

.brand-copy span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.site-nav {
  flex: 1 1 auto;
  gap: 24px;
}

.site-nav a {
  position: relative;
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.site-nav a.is-active,
.site-nav a:hover {
  color: var(--heading);
  background: transparent;
}

.site-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
}

.header-actions {
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

.account-pill {
  border-radius: 14px;
  background: #ffffff;
  border-color: var(--line);
}

.header-cta,
.primary-button,
.secondary-button,
.pill-button,
.quick-chip,
.auth-toggle-button,
.mode-tab,
.doc-action-button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: none;
  font-size: 0.95rem;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.header-cta,
.primary-button {
  background: var(--teal);
  color: #ffffff;
  border: 1px solid var(--teal);
}

.header-cta:hover,
.primary-button:hover {
  background: #11af8b;
  border-color: #11af8b;
  transform: translateY(-1px);
}

.secondary-button,
.pill-button,
.quick-chip,
.auth-toggle-button,
.mode-tab {
  background: #ffffff;
  color: var(--heading);
  border: 1px solid var(--line);
}

.secondary-button:hover,
.pill-button:hover,
.quick-chip:hover,
.auth-toggle-button:hover,
.mode-tab:hover {
  border-color: var(--line-strong);
  background: #fafcfe;
}

.pill-button.is-active,
.quick-chip.is-active,
.auth-toggle-button.is-active,
.mode-tab.is-active {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal-strong);
}

.hero,
.section-block,
.section-band,
.app-shell,
.app-hero {
  padding: 64px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.section-band {
  padding: 40px 0;
}

.hero::after,
.section-block::after,
.app-shell::after {
  display: none;
}

.hero-auth {
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, 0.96fr);
  gap: 56px;
  align-items: center;
}

.app-hero {
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
  gap: 32px;
  padding-top: 48px;
  padding-bottom: 32px;
  margin-top: 0;
}

.app-shell {
  padding-top: 12px;
}

.app-shell > .section-block {
  width: 100%;
  padding: 52px 0 0;
}

.hero h1,
.section-heading h2,
.app-hero h1,
.feature-copy h2 {
  font-family: var(--font-display);
  letter-spacing: -0.045em;
  color: var(--heading);
}

.hero h1 {
  max-width: 10ch;
  font-size: clamp(3.2rem, 6.4vw, 5.1rem);
  line-height: 0.96;
}

.app-hero h1 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 5vw, 4rem);
  line-height: 0.99;
}

.section-heading {
  max-width: 760px;
}

.section-heading h2,
.feature-copy h2 {
  font-size: clamp(2rem, 3.8vw, 3rem);
  line-height: 1.04;
}

.hero-lead,
.feature-lead,
.app-hero p,
.chat-subcopy,
.kb-note,
.quiz-note,
.meta-text,
.section-copy,
.route-card p,
.info-card p,
.workspace-card p,
.site-footer p,
.stack-copy,
.auth-card p {
  color: var(--muted);
}

.hero-lead {
  max-width: 36rem;
  margin-top: 18px;
  font-size: 1.04rem;
}

.feature-lead,
.section-copy,
.app-hero p {
  font-size: 1rem;
}

.eyebrow,
.small-label,
.route-kicker,
.card-tag {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-chip-row,
.hero-actions,
.quick-chip-row,
.mini-chip-row,
.composer-actions {
  align-items: center;
  gap: 10px;
}

.hero-chip-row {
  margin-top: 28px;
}

.hero-actions {
  margin-top: 22px;
}

.hero-story-card,
.auth-card,
.stack-card,
.info-card,
.workspace-card,
.route-card,
.chat-card,
.sidebar-card,
.analysis-card,
.composer-card,
.kb-card,
.doc-list,
.dropzone,
.quiz-card,
.output-card,
.source-card,
.score-card,
.metric-card,
.prompt-box,
.output-block,
.deliverable-card,
.drop-panel,
.upload-progress,
.upload-queue li,
.mini-file,
.session-summary {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: none;
}

.workspace-card,
.score-card,
.source-card,
.metric-card,
.deliverable-card,
.doc-item,
.output-block {
  height: 100%;
}

.hero-story-card {
  margin-top: 12px;
  padding: 28px;
  background: #f7fbff;
}

.hero-story-card h2 {
  margin-top: 14px;
  font-size: 1.5rem;
  line-height: 1.18;
}

.story-badge,
.card-tag,
.route-kicker,
.small-label,
.status-chip,
.file-chip,
.engine-chip {
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.story-badge {
  background: var(--teal-soft);
  color: var(--teal-strong);
  border-color: #bdeedd;
}

.status-chip {
  background: #f4f7fa;
  color: var(--muted);
  border-color: var(--line);
}

.status-chip.is-live {
  background: var(--teal-soft);
  color: var(--teal-strong);
  border-color: #bdeedd;
}

.status-chip.is-demo {
  background: var(--warm-soft);
  color: #be5b43;
  border-color: #ffd5c7;
}

.status-chip.is-file {
  background: #f3f7fb;
  color: #45607a;
  border-color: #d7e0ea;
}

.engine-chip {
  background: var(--sky-soft);
  color: #24507a;
  border-color: #dbe8ff;
}

.story-output {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--heading);
  font-weight: 600;
}

.metric-row,
.pain-grid,
.route-grid,
.workspace-grid,
.source-grid,
.score-grid {
  gap: 18px;
}

.metric-row {
  margin-top: 22px;
}

.metric-card {
  padding: 22px;
  background: var(--bg-elevated);
}

.metric-card strong {
  display: block;
  color: var(--heading);
  font-size: 1.22rem;
  line-height: 1.2;
}

.metric-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-card,
.composer-card,
.chat-card,
.analysis-card,
.sidebar-card,
.kb-card,
.doc-list,
.dropzone,
.quiz-card,
.output-card {
  padding: var(--card-padding);
}

.auth-card {
  padding: 30px;
}

.auth-card,
.stack-card,
.sidebar-card,
.analysis-card,
.workspace-card,
.source-card,
.doc-list,
.output-card {
  align-content: start;
}

.auth-card-head {
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid #edf1f6;
}

.auth-card h2 {
  font-size: 1.84rem;
  line-height: 1.1;
}

.auth-form,
.kb-entry-form {
  gap: 16px;
}

.session-summary {
  background: var(--panel-accent);
  border-color: #caeee2;
}

input,
select,
textarea {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--heading);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: var(--focus-ring);
}

textarea {
  min-height: 120px;
}

.stack-card {
  margin-top: 20px;
  padding: 22px;
  background: var(--panel-accent);
  border-color: #caeee2;
}

.stack-card .analysis-list {
  margin-top: 14px;
}

.stack-title {
  font-size: 0.98rem;
}

.stack-flow {
  gap: 10px;
}

.stack-flow span:not(.stack-arrow) {
  background: #ffffff;
}

.stack-arrow {
  color: var(--teal-strong);
}

.trust-strip {
  padding: 36px 0;
  border-top: 1px solid #edf1f6;
  border-bottom: 1px solid #edf1f6;
}

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
}

.logo-pill {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--heading);
  font-size: 0.92rem;
  font-weight: 700;
}

.feature-split {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 56px;
  align-items: center;
}

.feature-split.is-reverse {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}

.feature-copy {
  display: grid;
  gap: 18px;
}

.feature-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.feature-list li {
  position: relative;
  padding-left: 22px;
  color: var(--text);
  font-weight: 600;
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
}

.feature-visual {
  display: grid;
}

.ui-shot {
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff;
}

.ui-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid #edf1f6;
  background: #f8fafc;
}

.ui-toolbar span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d7e0ea;
}

.ui-window {
  padding: 24px;
}

.ui-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.ui-pill-row span {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.ui-bubble {
  max-width: 88%;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--bg-soft);
  color: var(--heading);
  font-weight: 600;
}

.ui-bubble.is-user {
  margin-left: auto;
  background: linear-gradient(135deg, #1ab392, #0f8066);
  color: #ffffff;
}

.ui-lines {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.ui-lines span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: #e8edf3;
}

.ui-lines span:nth-child(1) {
  width: 88%;
}

.ui-lines span:nth-child(2) {
  width: 72%;
}

.ui-lines span:nth-child(3) {
  width: 60%;
}

.mini-library {
  display: grid;
  gap: 14px;
}

.mini-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--bg-elevated);
}

.mini-file strong {
  color: var(--heading);
  font-size: 1rem;
}

.mini-file span {
  color: var(--muted);
  font-size: 0.92rem;
}

.workspace-block {
  padding-top: 56px;
}

.workspace-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workspace-card,
.info-card,
.route-card {
  padding: 24px;
}

.workspace-card {
  min-height: 176px;
  gap: 14px;
  background: var(--bg-elevated);
}

.workspace-card p {
  font-size: 0.95rem;
}

.workspace-card:hover,
.info-card:hover,
.route-card:hover {
  border-color: #bcd7cf;
}

.workspace-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal-strong);
}

.pain-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.final-cta {
  padding-top: 48px;
  text-align: center;
}

.cta-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}

.chat-layout,
.kb-layout,
.quiz-layout {
  gap: 22px;
}

.chat-layout > *,
.kb-layout > *,
.quiz-layout > *,
.doc-copy,
.feature-visual,
.feature-copy {
  min-width: 0;
}

.sidebar-card h3,
.analysis-card h3,
.kb-card h3,
.quiz-card h3,
.dropzone h3,
.source-card h3,
.output-card h3,
.chat-card h2 {
  font-size: 1.28rem;
  line-height: 1.2;
}

.sidebar-card ul,
.analysis-list,
.doc-feed,
.source-list,
.score-list,
.upload-queue {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.sidebar-card li,
.analysis-list > li,
.analysis-list > div {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--heading);
  font-weight: 600;
}

.stack-card .analysis-list > li,
.stack-card .analysis-list > div {
  background: #ffffff;
}

.starter-button,
.quick-chip,
.mode-tab,
.pill-button {
  white-space: nowrap;
}

.chat-thread {
  gap: 14px;
}

.message {
  max-width: 88%;
  padding: 16px 18px;
  border-radius: 20px;
  box-shadow: none;
  font-size: 0.96rem;
  line-height: 1.55;
}

.message.user {
  background: linear-gradient(135deg, #1ab392, #0f8066);
  color: #ffffff;
}

.message.assistant {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--heading);
}

.composer-top {
  align-items: flex-start;
}

.deliverable-list,
#quiz-output-blocks {
  gap: 14px;
}

.deliverable-card {
  gap: 8px;
  padding: 18px;
  background: var(--bg-elevated);
}

.deliverable-card p,
.source-card p,
.score-card span,
.doc-copy strong,
.doc-item .source-meta {
  line-height: 1.5;
}

.deliverable-card strong {
  font-size: 1rem;
}

.dropzone {
  border: 2px dashed rgba(21, 195, 154, 0.26);
  background: linear-gradient(180deg, #f8fefb 0%, #ffffff 100%);
}

.dropzone.is-dragging {
  border-color: rgba(21, 195, 154, 0.62);
  background: linear-gradient(180deg, #f2fff9 0%, #ffffff 100%);
  box-shadow: 0 0 0 6px rgba(21, 195, 154, 0.08);
}

.dropzone:focus-visible {
  outline: 3px solid rgba(21, 195, 154, 0.2);
  outline-offset: 4px;
}

.drop-panel {
  margin-top: 18px;
  padding: 18px;
  background: #ffffff;
}

.drop-actions,
.inline-actions,
.session-links,
.filter-chip-row {
  align-items: center;
}

.upload-progress {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--bg-elevated);
}

.upload-progress-bar {
  background: rgba(20, 32, 51, 0.08);
}

.upload-progress-bar span {
  background: linear-gradient(135deg, var(--teal), #69d9bc);
}

.upload-queue li {
  padding: 12px 14px;
  background: #ffffff;
}

.doc-list,
.output-card {
  min-height: 100%;
}

.doc-feed {
  gap: 16px;
}

.doc-group {
  gap: 12px !important;
  padding: 0 !important;
  background: transparent !important;
}

.doc-group-head {
  padding-bottom: 2px;
}

.doc-group-head strong {
  color: var(--heading);
}

.doc-group-list {
  gap: 12px;
}

.doc-item {
  gap: 12px !important;
  padding: 18px !important;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-elevated) !important;
}

.doc-empty-state {
  display: grid !important;
  gap: 8px;
  padding: 18px !important;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-elevated) !important;
}

.doc-copy strong {
  font-size: 1rem;
  line-height: 1.35;
}

.doc-icon {
  border-radius: 14px;
  background: var(--teal-soft);
  color: var(--teal-strong);
}

.doc-origin,
.doc-lock,
.file-meta,
.source-meta,
.result-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.doc-tag {
  background: var(--teal-soft);
  color: var(--teal-strong);
}

.doc-action-button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.doc-action-button.is-danger {
  background: var(--warm-soft);
  color: #d35c50;
  border-color: #ffd5c7;
}

.kb-search input {
  min-height: 48px;
}

.source-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.source-card {
  padding: 20px;
  background: var(--bg-elevated);
}

.source-card h3 {
  margin-bottom: 8px;
}

.analysis-list li,
.analysis-list > li {
  line-height: 1.45;
}

.analysis-list li::marker {
  display: none;
}

.prompt-box {
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: 18px;
}

.prompt-box textarea {
  min-height: 150px;
  margin-top: 12px;
}

.mode-switcher {
  padding: 0;
  gap: 10px;
  background: transparent;
}

.output-card {
  gap: 14px;
}

.output-block,
.score-grid-compact .score-card,
.source-card {
  background: var(--bg-elevated);
}

.output-block {
  padding: 18px;
  border-radius: 18px;
}

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

.score-grid-compact {
  gap: 12px;
}

.score-card {
  padding: 20px;
  min-height: 126px;
}

.score-card strong {
  display: block;
  font-size: 1.95rem;
  line-height: 1.08;
  color: var(--heading);
}

.score-card span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.94rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 0 0;
  margin-top: 12px;
  border-top: 1px solid #edf1f6;
  background: transparent;
  border-radius: 0;
}

.section-band + .section-block,
.section-block + .section-block,
.app-shell > .section-block {
  border-top: 1px solid #edf1f6;
}

.site-footer div:last-child {
  gap: 18px;
}

@media (max-width: 1100px) {
  .hero-auth,
  .feature-split,
  .feature-split.is-reverse,
  .app-hero,
  .chat-layout,
  .kb-layout,
  .quiz-layout {
    grid-template-columns: 1fr;
  }

  .pain-grid,
  .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-header {
    flex-wrap: wrap;
    align-items: center;
  }

  .site-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .site-header,
  .hero,
  .section-block,
  .section-band,
  .app-shell,
  .app-hero,
  .site-footer {
    width: min(calc(100% - 24px), var(--page-max));
  }

  .site-header {
    padding: 14px 0;
  }

  .site-nav a.is-active::after {
    bottom: -6px;
  }

  .hero,
  .section-block,
  .section-band,
  .app-hero {
    padding: 44px 0;
  }

  .hero h1,
  .app-hero h1,
  .section-heading h2,
  .feature-copy h2 {
    max-width: none;
    font-size: clamp(2.2rem, 12vw, 3.3rem);
  }

  .site-header,
  .header-actions,
  .site-footer,
  .cta-row,
  .composer-top,
  .doc-list-head,
  .kb-library-head,
  .upload-progress-meta,
  .doc-top,
  .doc-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    gap: 12px;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    padding-bottom: 4px;
    justify-content: flex-start;
  }

  .site-nav a {
    flex: 0 0 auto;
  }

  .header-actions,
  .account-shell {
    width: 100%;
  }

  .quick-chip-row,
  .hero-chip-row,
  .mini-chip-row,
  .filter-chip-row,
  .session-links {
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    padding-bottom: 4px;
  }

  .quick-chip-row > *,
  .hero-chip-row > *,
  .mini-chip-row > *,
  .filter-chip-row > *,
  .session-links > * {
    flex: 0 0 auto;
  }

  .hero-auth {
    gap: 30px;
  }

  .auth-card,
  .stack-card,
  .chat-card,
  .composer-card,
  .analysis-card,
  .sidebar-card,
  .kb-card,
  .doc-list,
  .dropzone,
  .quiz-card,
  .output-card {
    padding: 20px;
    border-radius: 18px;
  }

  .metric-row,
  .pain-grid,
  .route-grid,
  .workspace-grid,
  .score-grid,
  .source-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }

  .workspace-card,
  .score-card {
    min-height: 0;
  }

  .cta-row {
    width: 100%;
  }

  .cta-row .primary-button,
  .cta-row .secondary-button,
  .header-cta {
    width: 100%;
    justify-content: center;
  }
}

/* Grammarly-inspired reconstruction */
:root {
  --page-max: 1200px;
}

.header-cta,
.primary-button,
.secondary-button,
.pill-button,
.quick-chip,
.auth-toggle-button,
.mode-tab,
.doc-action-button {
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 8px;
}

.site-header {
  gap: 28px;
}

.site-nav a {
  font-size: 0.94rem;
}

.hero,
.section-block,
.section-band,
.app-hero,
.app-shell {
  padding-top: 76px;
  padding-bottom: 76px;
}

.hero-student {
  align-items: start;
}

.hero-copy {
  gap: 20px;
}

.hero-student .hero-lead {
  max-width: 38rem;
  font-size: 1.08rem;
}

.hero-benefits {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.hero-benefits li {
  position: relative;
  padding-left: 18px;
  color: var(--text);
  font-weight: 600;
}

.hero-benefits li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--teal);
}

.hero-student .hero-chip-row {
  margin-top: 4px;
  gap: 20px;
}

.hero-student .pill-button {
  min-height: auto;
  padding: 6px 0;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.hero-student .pill-button.is-active,
.hero-student .pill-button:hover {
  background: transparent;
  border-bottom-color: var(--teal);
  color: var(--heading);
}

.hero-story-inline {
  margin-top: 0;
  padding: 18px 0 0 18px;
  background: transparent;
  border: 0;
  border-left: 3px solid var(--teal);
  border-radius: 0;
}

.hero-story-inline h2 {
  max-width: 12ch;
}

.hero-story-inline .story-output {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  padding-top: 22px;
  border-top: 1px solid #edf1f6;
}

.hero-metrics > div {
  display: grid;
  gap: 6px;
}

.hero-metrics strong {
  color: var(--heading);
  font-size: 0.98rem;
}

.hero-metrics span {
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-card {
  padding: 32px;
  border-radius: 10px;
  align-self: start;
}

.auth-card-head {
  gap: 12px;
}

.auth-card h2 {
  font-size: 2rem;
}

.auth-toggle {
  padding: 4px;
  border-radius: 8px;
}

.auth-toggle-button {
  min-height: 40px;
  padding: 8px 14px;
}

.hero-side-list {
  margin-top: 18px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.hero-side-list .stack-title {
  padding-bottom: 10px;
  border-bottom: 1px solid #edf1f6;
}

.hero-side-list .analysis-list {
  margin-top: 0;
}

.hero-side-list .analysis-list > li,
.hero-side-list .analysis-list > div {
  padding: 16px 0;
  border: 0;
  border-bottom: 1px solid #edf1f6;
  border-radius: 0;
  background: transparent;
}

.trust-strip {
  padding-top: 34px;
  padding-bottom: 34px;
}

.trust-badges {
  gap: 12px;
}

.logo-pill {
  padding: 9px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
}

.feature-split {
  gap: 72px;
}

.feature-copy {
  gap: 20px;
}

.feature-copy .secondary-button,
.feature-copy .primary-button {
  width: fit-content;
}

.ui-shot {
  border-radius: 10px;
}

.ui-window {
  padding: 28px;
}

.workspace-block {
  padding-top: 60px;
}

.product-overview {
  border-top: 1px solid #edf1f6;
}

.product-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px;
  margin-top: 28px;
}

.product-column {
  display: grid;
  gap: 16px;
  align-content: start;
  padding-top: 18px;
  border-top: 1px solid #edf1f6;
}

.product-column h3 {
  color: var(--heading);
  font-size: 1.32rem;
  line-height: 1.15;
}

.product-column p {
  color: var(--muted);
  font-size: 0.97rem;
}

.feature-list-plain li {
  font-weight: 500;
}

.feature-list-plain li::before {
  top: 9px;
  width: 6px;
  height: 6px;
}

.text-link {
  width: fit-content;
  color: var(--teal-strong);
  font-weight: 700;
}

.text-link:hover {
  text-decoration: underline;
}

.final-cta {
  border-top: 1px solid #edf1f6;
}

.app-hero-flat {
  align-items: start;
  padding-bottom: 40px;
}

.app-hero-flat .hero-lead {
  max-width: 36rem;
}

.workspace-shell {
  padding-top: 0;
  padding-bottom: 0;
}

.workspace-layout {
  gap: 0;
  border-top: 1px solid #edf1f6;
  border-bottom: 1px solid #edf1f6;
}

.chat-layout.workspace-layout {
  grid-template-columns: 250px minmax(0, 1fr) 250px;
}

.kb-layout.workspace-layout,
.quiz-layout.workspace-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.sidebar-column,
.utility-column,
.chat-main,
.kb-main,
.kb-side,
.quiz-main,
.quiz-side {
  padding-top: 28px;
  padding-bottom: 28px;
}

.sidebar-column {
  padding-right: 28px;
}

.utility-column {
  padding-left: 28px;
}

.chat-main {
  padding-left: 32px;
  padding-right: 32px;
  border-left: 1px solid #edf1f6;
  border-right: 1px solid #edf1f6;
}

.kb-main,
.quiz-main {
  padding-right: 32px;
}

.kb-side,
.quiz-side {
  padding-left: 32px;
  border-left: 1px solid #edf1f6;
}

.workspace-shell .sidebar-card,
.workspace-shell .analysis-card,
.workspace-shell .chat-card,
.workspace-shell .composer-card,
.workspace-shell .kb-card,
.workspace-shell .doc-list,
.workspace-shell .dropzone,
.workspace-shell .quiz-card,
.workspace-shell .output-card {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.workspace-shell .sidebar-column > *,
.workspace-shell .utility-column > *,
.workspace-shell .chat-main > *,
.workspace-shell .kb-main > *,
.workspace-shell .kb-side > *,
.workspace-shell .quiz-main > *,
.workspace-shell .quiz-side > * {
  padding-top: 24px;
  border-top: 1px solid #edf1f6;
}

.workspace-shell .sidebar-column > *:first-child,
.workspace-shell .utility-column > *:first-child,
.workspace-shell .chat-main > *:first-child,
.workspace-shell .kb-main > *:first-child,
.workspace-shell .kb-side > *:first-child,
.workspace-shell .quiz-main > *:first-child,
.workspace-shell .quiz-side > *:first-child {
  padding-top: 0;
  border-top: 0;
}

.workspace-shell .analysis-list > li,
.workspace-shell .sidebar-card li {
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid #edf1f6;
  border-radius: 0;
  background: transparent;
}

.workspace-shell .analysis-list > li:last-child,
.workspace-shell .sidebar-card li:last-child {
  border-bottom: 0;
}

.workspace-shell .analysis-list,
.workspace-shell .sidebar-card ul {
  gap: 0;
}

.workspace-shell .deliverable-list,
.workspace-shell #quiz-output-blocks,
.workspace-shell .doc-group-list,
.workspace-shell .doc-feed,
.workspace-shell .upload-queue,
.workspace-shell .source-grid,
.workspace-shell .score-grid-compact {
  gap: 0;
}

.workspace-shell .quick-chip,
.workspace-shell .mode-tab {
  border-radius: 6px;
}

.workspace-shell .deliverable-card,
.workspace-shell .source-card,
.workspace-shell .doc-item,
.workspace-shell .doc-empty-state,
.workspace-shell .output-block,
.workspace-shell .score-card,
.workspace-shell .upload-queue li {
  padding: 16px 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid #edf1f6 !important;
  border-radius: 0 !important;
}

.workspace-shell .deliverable-card:first-child,
.workspace-shell .source-card:first-child,
.workspace-shell .doc-item:first-child,
.workspace-shell .output-block:first-child,
.workspace-shell .score-card:first-child,
.workspace-shell .upload-queue li:first-child {
  padding-top: 0 !important;
}

.workspace-shell .deliverable-card:last-child,
.workspace-shell .source-card:last-child,
.workspace-shell .doc-item:last-child,
.workspace-shell .doc-empty-state:last-child,
.workspace-shell .output-block:last-child,
.workspace-shell .score-card:last-child,
.workspace-shell .upload-queue li:last-child {
  border-bottom: 0 !important;
}

.workspace-shell .deliverable-card strong,
.workspace-shell .source-card h3,
.workspace-shell .output-block h3 {
  font-size: 1rem;
}

.workspace-shell .source-card h3 {
  margin-bottom: 6px;
}

.workspace-shell .score-grid {
  gap: 24px;
}

.workspace-shell .score-card {
  min-height: 0;
}

.workspace-shell .score-card strong {
  font-size: 1.7rem;
}

.workspace-shell .doc-group-head {
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid #edf1f6;
}

.workspace-shell .doc-group-list {
  gap: 0;
}

.workspace-shell .doc-top,
.workspace-shell .doc-footer {
  gap: 10px;
}

.workspace-shell .doc-icon {
  min-width: 34px;
  height: 34px;
  border-radius: 6px;
}

.workspace-shell .doc-tag-row {
  margin-top: 2px;
}

.workspace-shell .doc-tag {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
}

.workspace-shell .dropzone {
  border-width: 1px;
  border-radius: 0;
}

.workspace-shell .drop-panel,
.workspace-shell .upload-progress,
.workspace-shell .prompt-box {
  padding: 18px 0;
  background: transparent;
  border: 0;
  border-top: 1px solid #edf1f6;
  border-radius: 0;
}

.workspace-shell .prompt-box {
  margin-top: 8px;
}

.workspace-shell .prompt-box textarea,
.workspace-shell .kb-search input,
.workspace-shell input,
.workspace-shell select,
.workspace-shell textarea {
  border-radius: 6px;
}

.workspace-shell .drop-actions,
.workspace-shell .inline-actions,
.workspace-shell .filter-chip-row {
  margin-top: 16px;
}

.workspace-shell .upload-progress {
  margin-top: 12px;
}

.workspace-shell .upload-queue {
  margin-top: 14px;
}

.workspace-shell .source-grid {
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.workspace-shell .chat-card h2,
.workspace-shell .kb-card h3,
.workspace-shell .quiz-card h3,
.workspace-shell .analysis-card h3,
.workspace-shell .sidebar-card h3,
.workspace-shell .dropzone h3,
.workspace-shell .output-card h3 {
  font-size: 1.18rem;
}

.workspace-shell .small-label {
  color: var(--muted);
}

.message {
  border-radius: 10px;
}

.message.user {
  background: #0f7e64;
}

.deliverable-card,
.source-card,
.doc-item,
.doc-empty-state,
.output-block,
.upload-queue li,
.upload-progress,
.drop-panel,
.prompt-box {
  border-radius: 8px;
}

.doc-item,
.output-block,
.source-card,
.deliverable-card {
  border-color: #e5ebf2;
}

.mode-switcher {
  gap: 8px;
}

.site-footer {
  padding-top: 26px;
}

@media (max-width: 1100px) {
  .hero,
  .section-block,
  .section-band,
  .app-hero,
  .app-shell {
    padding-top: 60px;
    padding-bottom: 60px;
  }

  .hero-metrics,
  .product-columns {
    grid-template-columns: 1fr;
  }

  .workspace-layout,
  .chat-layout.workspace-layout,
  .kb-layout.workspace-layout,
  .quiz-layout.workspace-layout {
    grid-template-columns: 1fr;
  }

  .chat-main,
  .kb-side,
  .quiz-side {
    border-left: 0;
  }

  .chat-main {
    border-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .sidebar-column,
  .utility-column,
  .kb-main,
  .kb-side,
  .quiz-main,
  .quiz-side {
    padding-left: 0;
    padding-right: 0;
  }

  .workspace-shell .score-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 760px) {
  .hero,
  .section-block,
  .section-band,
  .app-hero,
  .app-shell {
    padding-top: 44px;
    padding-bottom: 44px;
  }

  .hero-student .hero-chip-row {
    gap: 14px;
  }

  .hero-metrics {
    gap: 16px;
    padding-top: 18px;
  }

  .auth-card {
    padding: 24px;
  }

  .product-columns {
    gap: 26px;
  }

  .workspace-shell .sidebar-column > *,
  .workspace-shell .utility-column > *,
  .workspace-shell .chat-main > *,
  .workspace-shell .kb-main > *,
  .workspace-shell .kb-side > *,
  .workspace-shell .quiz-main > *,
  .workspace-shell .quiz-side > * {
    padding-top: 20px;
  }
}

/* Final layout lock: flatter header, no desktop wrap, linear workspace rails */
.site-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 28px;
}

.brand,
.header-actions,
.account-shell,
.site-nav {
  min-width: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 28px;
  overflow: hidden;
}

.site-nav a,
.header-cta,
.account-pill,
.account-logout {
  white-space: nowrap;
}

.header-actions,
.account-shell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.account-pill {
  max-width: 230px;
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-hero-flat {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.app-hero-compact {
  grid-template-columns: 1fr;
  padding-bottom: 24px;
}

.chat-layout.workspace-layout {
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: start;
}

.kb-layout.workspace-layout,
.quiz-layout.workspace-layout {
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: start;
}

.sidebar-column,
.utility-column,
.chat-main,
.kb-main,
.kb-side,
.quiz-main,
.quiz-side {
  width: 100%;
}

.workspace-shell .sidebar-column > *,
.workspace-shell .utility-column > *,
.workspace-shell .chat-main > *,
.workspace-shell .kb-main > *,
.workspace-shell .kb-side > *,
.workspace-shell .quiz-main > *,
.workspace-shell .quiz-side > * {
  width: 100%;
}

.chat-topline {
  display: grid;
  gap: 18px;
}

.workspace-shell .chat-topline .quick-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 0;
}

.workspace-shell .chat-topline .quick-chip {
  justify-content: flex-start;
  min-height: 0;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
}

.workspace-shell .chat-topline .quick-chip.is-active,
.workspace-shell .chat-topline .quick-chip:hover {
  background: transparent;
  color: var(--heading);
  box-shadow: none;
  border-color: var(--teal);
}

.workspace-shell .starter-list {
  display: grid;
  gap: 0;
  margin-top: 2px;
}

.workspace-shell .starter-button {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 15px 0;
  border: 0;
  border-bottom: 1px solid #edf1f6;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  white-space: normal;
}

.workspace-shell .starter-button:last-child {
  border-bottom: 0;
}

.workspace-shell .starter-button:hover,
.workspace-shell .starter-button:focus-visible {
  transform: none;
  border-color: #edf1f6;
  color: var(--teal-strong);
  box-shadow: none;
}

.workspace-shell .composer-actions,
.workspace-shell .mini-chip-row,
.workspace-shell .filter-chip-row,
.workspace-shell .drop-actions,
.workspace-shell .inline-actions {
  flex-wrap: wrap;
}

.workspace-shell .mini-chip-row,
.workspace-shell .composer-actions {
  margin-top: 14px;
}

.workspace-shell textarea,
.workspace-shell input,
.workspace-shell select {
  width: 100%;
}

.rail-summary {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #edf1f6;
}

.hero-rail-list {
  padding-top: 6px;
}

.hero-rail-list .analysis-list > li {
  font-size: 0.95rem;
}

@media (max-width: 1200px) {
  .site-header {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 16px;
  }

  .header-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .chat-topline {
    gap: 20px;
  }
}

@media (max-width: 760px) {
  .site-header {
    display: flex;
  }

  .site-nav {
    overflow-x: auto;
  }

  .header-actions,
  .account-shell {
    flex-wrap: wrap;
  }

  .account-pill {
    max-width: none;
  }
}

/* Final refinement: stricter Grammarly-like spacing */
.site-header {
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand-copy span {
  max-width: 160px;
  line-height: 1.05;
}

.header-cta {
  min-width: 132px;
}

.hero-side-list {
  margin-top: 0;
}

.hero-side-list .stack-title {
  font-size: 0.92rem;
}

.hero-side-list .analysis-list > li {
  color: var(--text);
}

.workspace-shell .chat-main {
  padding-left: 0;
  padding-right: 36px;
  border-left: 0;
}

.workspace-shell .utility-column {
  padding-left: 32px;
  border-left: 1px solid #edf1f6;
}

.workspace-shell .chat-main > .chat-topline {
  padding-top: 0;
  border-top: 0;
}

.workspace-shell .chat-card h2 {
  max-width: 15ch;
}

.workspace-shell .chat-thread {
  margin-top: 20px;
}

.workspace-shell .message {
  max-width: min(92%, 740px);
}

.workspace-shell .composer-card .primary-button {
  width: fit-content;
  min-width: 140px;
}

.workspace-shell #chat-composer .composer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.workspace-shell #chat-composer .primary-button {
  flex: 0 0 auto;
}

.workspace-shell .score-grid.score-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.workspace-shell .score-grid.score-grid-compact .score-card {
  padding: 0 0 14px !important;
}

.workspace-shell .kb-main,
.workspace-shell .quiz-main {
  padding-right: 36px;
}

.workspace-shell .kb-side,
.workspace-shell .quiz-side {
  padding-left: 28px;
}

.workspace-shell .doc-list-head,
.workspace-shell .kb-library-head,
.workspace-shell .composer-top {
  align-items: baseline;
}

.workspace-shell .filter-chip-row,
.workspace-shell .drop-actions,
.workspace-shell .inline-actions,
.workspace-shell .composer-actions,
.workspace-shell .mini-chip-row {
  gap: 12px 14px;
}

.workspace-shell .kb-side .analysis-card,
.workspace-shell .utility-column .analysis-card,
.workspace-shell .quiz-side .analysis-card {
  padding-top: 0;
}

.workspace-shell .chat-topline h3,
.workspace-shell .composer-top h3,
.workspace-shell .analysis-card h3,
.workspace-shell .output-card h3 {
  margin: 0;
}

@media (max-width: 1100px) {
  .workspace-shell .chat-main,
  .workspace-shell .kb-main,
  .workspace-shell .quiz-main,
  .workspace-shell .utility-column,
  .workspace-shell .kb-side,
  .workspace-shell .quiz-side {
    padding-left: 0;
    padding-right: 0;
    border-left: 0;
  }

  .workspace-shell .score-grid.score-grid-compact {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Final polish: larger work areas, quieter rails, three-tone system */
:root {
  --page-max: 1264px;
  --bg: #fbfaf6;
  --bg-soft: #f2ede2;
  --bg-elevated: #f7f3ea;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-accent: #eaf5f0;
  --line: #d8ded6;
  --line-strong: #c4cfc4;
  --text: #243746;
  --muted: #677482;
  --heading: #182a37;
  --teal: #168765;
  --teal-soft: #e8f4ef;
  --teal-strong: #11684e;
  --warm-soft: #f2ede2;
  --focus-ring: 0 0 0 4px rgba(22, 135, 101, 0.12);
}

body {
  background: var(--bg);
  color: var(--text);
}

body::before,
.site-bg {
  display: none;
}

.site-header,
.app-hero,
.site-footer {
  width: min(var(--page-max), calc(100% - 56px));
}

.page {
  gap: 84px;
}

.site-header {
  padding-top: 18px;
  padding-bottom: 18px;
}

.header-cta,
.primary-button,
.secondary-button,
.pill-button,
.quick-chip,
.auth-toggle-button,
.mode-tab,
.doc-action-button {
  border-radius: 10px;
  box-shadow: none;
}

.header-cta,
.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.header-cta:hover,
.primary-button:hover {
  background: var(--teal-strong);
  border-color: var(--teal-strong);
  box-shadow: none;
}

.secondary-button,
.pill-button,
.quick-chip,
.auth-toggle-button,
.mode-tab,
.doc-action-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--heading);
}

.secondary-button:hover,
.pill-button:hover,
.quick-chip:hover,
.auth-toggle-button:hover,
.mode-tab:hover,
.doc-action-button:hover {
  background: var(--warm-soft);
  border-color: var(--line-strong);
  box-shadow: none;
}

.pill-button.is-active,
.quick-chip.is-active,
.auth-toggle-button.is-active,
.mode-tab.is-active {
  background: var(--teal-soft);
  border-color: #c7e4d8;
  color: var(--teal-strong);
}

.status-chip,
.file-chip,
.engine-chip,
.small-label {
  border-radius: 999px;
  letter-spacing: 0.08em;
}

.status-chip {
  background: var(--warm-soft);
  border-color: transparent;
  color: var(--muted);
}

.status-chip.is-live {
  background: var(--teal-soft);
  border-color: transparent;
  color: var(--teal-strong);
}

.status-chip.is-demo,
.status-chip.is-file {
  background: var(--warm-soft);
  border-color: transparent;
  color: var(--muted);
}

.hero.hero-auth {
  position: relative;
  gap: 44px;
  padding-top: 42px;
}

.hero.hero-auth::before {
  content: "";
  position: absolute;
  inset: 0 auto 10px 0;
  width: min(70%, 760px);
  border-radius: 30px;
  background: var(--warm-soft);
  z-index: -1;
}

.hero-story-inline,
.feature-visual,
.trust-strip,
.final-cta,
.dropzone,
.auth-card {
  background: var(--warm-soft);
  border: 1px solid var(--line);
  box-shadow: none;
}

.feature-visual {
  background: var(--teal-soft);
}

.trust-strip,
.final-cta {
  border-radius: 28px;
  padding-left: 32px;
  padding-right: 32px;
}

.product-columns {
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.product-column {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 28px 24px;
}

.product-column:last-child {
  border-right: 0;
}

.workspace-shell {
  margin-top: 6px;
}

.workspace-layout {
  border-top-color: var(--line);
  border-bottom-color: var(--line);
}

.chat-layout.workspace-layout {
  grid-template-columns: minmax(0, 1fr) 216px;
}

.kb-layout.workspace-layout,
.quiz-layout.workspace-layout {
  grid-template-columns: minmax(0, 1fr) 272px;
}

.workspace-shell .chat-main,
.workspace-shell .kb-main,
.workspace-shell .quiz-main {
  padding-right: 48px;
}

.workspace-shell .utility-column,
.workspace-shell .kb-side,
.workspace-shell .quiz-side {
  padding-left: 34px;
  background: linear-gradient(180deg, rgba(242, 237, 226, 0.92), rgba(242, 237, 226, 0.64));
}

.workspace-shell .chat-card,
.workspace-shell .composer-card,
.workspace-shell .analysis-card,
.workspace-shell .kb-card,
.workspace-shell .quiz-card,
.workspace-shell .output-card,
.workspace-shell .doc-list {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}

.workspace-shell .dropzone {
  border-radius: 24px;
  padding: 30px;
}

.workspace-shell .kb-library-head,
.workspace-shell .doc-list-head,
.workspace-shell .composer-top {
  display: grid;
  gap: 8px;
  align-items: start;
}

.workspace-shell .kb-library-head h3,
.workspace-shell .doc-list-head h3 {
  margin: 0;
}

.workspace-shell .kb-search {
  margin-top: 18px;
}

.workspace-shell .source-grid {
  margin-top: 20px;
}

.workspace-shell .source-card,
.workspace-shell .output-block {
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: none;
}

.workspace-shell .source-card {
  background: #ffffff;
}

.workspace-shell .score-grid.score-grid-compact {
  grid-template-columns: 1fr;
  gap: 0;
}

.workspace-shell .score-grid.score-grid-compact .score-card {
  padding: 14px 0 !important;
  min-height: 0;
  background: transparent;
  border-radius: 0;
  border-top: 1px solid var(--line);
}

.workspace-shell .score-grid.score-grid-compact .score-card:first-child {
  border-top: 0;
}

.workspace-shell .score-grid.score-grid-compact .score-card span {
  margin-top: 6px;
}

.kb-side .doc-list-head {
  gap: 6px;
}

.kb-side .doc-feed {
  gap: 20px;
}

.kb-side .doc-group {
  gap: 10px;
}

.kb-side .doc-group-head {
  display: grid;
  gap: 6px;
  justify-content: start;
  padding-bottom: 2px;
}

.kb-side .doc-group-head .source-meta,
.kb-side .doc-copy strong,
.kb-side .source-meta,
.kb-side .file-meta,
.kb-side .doc-origin,
.kb-side .doc-lock {
  overflow-wrap: anywhere;
}

.kb-side .doc-group-list {
  gap: 0;
}

.kb-side .doc-item {
  gap: 10px !important;
  padding: 14px 0 !important;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent !important;
}

.kb-side .doc-group-list .doc-item:first-child {
  border-top: 0;
}

.kb-side .doc-top {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  justify-content: start;
}

.kb-side .doc-icon {
  grid-row: 1 / span 2;
}

.kb-side .doc-copy {
  grid-column: 2;
}

.kb-side .doc-top > .status-chip {
  grid-column: 2;
  width: fit-content;
}

.kb-side .doc-footer {
  display: grid;
  gap: 10px;
  justify-content: start;
}

.kb-side .doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kb-side .doc-action-button {
  min-height: 38px;
  padding: 0 12px;
}

.ui-shot,
.ui-window,
.mini-file,
.ui-bubble {
  box-shadow: none;
}

.ui-window,
.mini-file,
.ui-pill-row span,
.ui-bubble:not(.is-user) {
  background: #ffffff;
  border-color: var(--line);
}

.ui-bubble.is-user {
  background: var(--teal);
  border-color: var(--teal);
}

@media (max-width: 1100px) {
  .site-header,
  .app-hero,
  .site-footer {
    width: min(var(--page-max), calc(100% - 32px));
  }

  .hero.hero-auth::before {
    display: none;
  }

  .product-columns {
    border-bottom: 0;
  }

  .product-column {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-shell .utility-column,
  .workspace-shell .kb-side,
  .workspace-shell .quiz-side {
    background: transparent;
    padding-left: 0;
  }
}

/* Final tightening: stronger hierarchy and less repetition */
.hero,
.section-block,
.section-band {
  padding-top: 68px;
  padding-bottom: 68px;
}

.app-hero {
  padding-top: 34px;
  padding-bottom: 28px;
}

.hero.hero-auth {
  gap: 56px;
  padding-top: 52px;
}

.hero-copy h1,
.app-hero h1 {
  max-width: 11.5ch;
  font-size: clamp(2.9rem, 5vw, 4.35rem);
  line-height: 0.98;
}

.section-heading {
  gap: 12px;
}

.section-heading h2,
.feature-copy h2 {
  max-width: 15ch;
  font-size: clamp(2.15rem, 3.8vw, 3.2rem);
  line-height: 1.02;
}

.hero-lead,
.feature-lead,
.app-hero .hero-lead {
  max-width: 34rem;
  font-size: 1.04rem;
  line-height: 1.6;
}

.hero-actions,
.cta-row {
  gap: 12px;
}

.hero-actions .primary-button,
.hero-actions .secondary-button,
.cta-row .primary-button,
.cta-row .secondary-button,
.feature-copy .primary-button,
.feature-copy .secondary-button {
  min-height: 50px;
  padding-inline: 22px;
}

.hero-story-inline {
  margin-top: 4px;
  padding: 24px 26px;
}

.trust-strip {
  gap: 20px;
}

.trust-badges {
  gap: 12px;
}

.logo-pill {
  background: #ffffff;
  border-color: var(--line);
}

.feature-split {
  gap: 72px;
  align-items: center;
}

.feature-copy {
  gap: 18px;
}

.feature-copy .feature-lead + .primary-button,
.feature-copy .feature-lead + .secondary-button {
  margin-top: 6px;
}

.product-overview {
  background: var(--warm-soft);
  border-radius: 28px;
  padding: 34px 32px 0;
}

.product-columns {
  margin-top: 26px;
}

.product-column h3 {
  font-size: 1.3rem;
  line-height: 1.08;
}

.product-column p {
  max-width: 26ch;
}

.text-link {
  margin-top: 18px;
  color: var(--teal-strong);
  font-weight: 700;
}

.site-footer {
  padding-top: 18px;
  border-top-color: var(--line);
}

.site-footer strong {
  font-size: 0.98rem;
}

.site-footer div:last-child {
  gap: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.app-hero-flat .hero-actions {
  margin-top: 14px;
}

.workspace-shell .chat-topline h3,
.workspace-shell .analysis-card h3,
.workspace-shell .output-card h3,
.workspace-shell .composer-top h3,
.workspace-shell .kb-library-head h3,
.workspace-shell .doc-list-head h3 {
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.workspace-shell .chat-main > *,
.workspace-shell .kb-main > *,
.workspace-shell .quiz-main > *,
.workspace-shell .utility-column > *,
.workspace-shell .kb-side > *,
.workspace-shell .quiz-side > * {
  padding-top: 28px;
}

.workspace-shell .analysis-list {
  gap: 0;
}

.workspace-shell .analysis-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.workspace-shell .analysis-list li:last-child {
  border-bottom: 0;
}

.workspace-shell .rail-summary {
  margin-top: 18px;
  padding-top: 18px;
}

.workspace-shell .prompt-box,
.workspace-shell .drop-panel,
.workspace-shell .upload-progress,
.workspace-shell .field-row,
.workspace-shell .inline-actions {
  margin-top: 18px;
}

.workspace-shell textarea,
.workspace-shell input,
.workspace-shell select {
  border-radius: 12px;
}

@media (max-width: 1100px) {
  .hero,
  .section-block,
  .section-band {
    padding-top: 52px;
    padding-bottom: 52px;
  }

  .app-hero {
    padding-top: 30px;
    padding-bottom: 24px;
  }

  .feature-split {
    gap: 40px;
  }

  .product-overview {
    padding: 28px 24px 0;
  }
}

/* Typography and spacing pass: closer to Grammarly Students */
:root {
  --font-sans: "Inter", "Segoe UI", sans-serif;
  --font-display: "Inter", "Segoe UI", sans-serif;
}

.hero.hero-auth {
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 64px;
  align-items: start;
}

.hero.hero-auth::before {
  display: none;
}

.hero.hero-auth .hero-copy {
  position: relative;
  padding: 18px 22px 18px 0;
}

.hero.hero-auth .hero-copy::before {
  content: "";
  position: absolute;
  inset: -18px 26px -18px -24px;
  border-radius: 28px;
  background: var(--warm-soft);
  z-index: -1;
}

html {
  font-size: 16px;
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-sans);
  font-feature-settings: "cv11" 1, "ss01" 1;
}

body {
  font-size: 1rem;
  line-height: 1.6;
}

.site-nav a,
.header-cta,
.primary-button,
.secondary-button,
.pill-button,
.quick-chip,
.mode-tab,
.auth-toggle-button,
.doc-action-button {
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.eyebrow,
.small-label,
.status-chip {
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-copy h1 {
  max-width: 10.8ch;
  font-size: clamp(2.9rem, 4.9vw, 4.05rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
}

.app-hero h1 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 4.2vw, 3.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
}

.section-heading h2,
.feature-copy h2 {
  max-width: 14ch;
  font-size: clamp(2.55rem, 4.1vw, 3.35rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.auth-card h2 {
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.hero-lead,
.feature-lead,
.app-hero .hero-lead,
.meta-text,
.auth-card p,
.chat-subcopy,
.source-meta,
.file-meta,
.doc-origin,
.doc-lock,
.output-block p,
.source-card p {
  font-size: 1.08rem;
  line-height: 1.62;
}

.feature-copy p,
.section-heading p,
.app-hero p,
.product-column p {
  max-width: 34rem;
}

.product-column h3,
.workspace-shell .chat-card h2,
.workspace-shell .kb-card h3,
.workspace-shell .quiz-card h3,
.workspace-shell .analysis-card h3,
.workspace-shell .output-card h3,
.workspace-shell .doc-list-head h3,
.workspace-shell .dropzone h3 {
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.03em;
}

.workspace-shell .chat-topline h3,
.workspace-shell .composer-top h3,
.workspace-shell .kb-library-head h3 {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.hero-actions .primary-button,
.hero-actions .secondary-button,
.cta-row .primary-button,
.cta-row .secondary-button,
.feature-copy .primary-button,
.feature-copy .secondary-button,
.workspace-shell .composer-card .primary-button,
.workspace-shell #quiz-run-button {
  min-height: 52px;
  padding-inline: 24px;
}

.hero-story-inline,
.auth-card,
.feature-visual,
.trust-strip,
.final-cta,
.product-overview,
.workspace-shell .dropzone {
  padding: 28px 30px;
}

.workspace-shell .source-card,
.workspace-shell .output-block,
.workspace-shell .deliverable-card,
.workspace-shell .doc-empty-state,
.workspace-shell .upload-queue li,
.workspace-shell .drop-panel,
.workspace-shell .upload-progress,
.workspace-shell .prompt-box {
  padding: 20px 22px !important;
  border-radius: 18px;
}

.workspace-shell .source-card + .source-card,
.workspace-shell .output-block + .output-block,
.workspace-shell .deliverable-card + .deliverable-card,
.workspace-shell .upload-queue li + li {
  margin-top: 6px;
}

.workspace-shell .chat-main,
.workspace-shell .kb-main,
.workspace-shell .quiz-main,
.workspace-shell .utility-column,
.workspace-shell .kb-side,
.workspace-shell .quiz-side {
  gap: 26px;
}

.workspace-shell .chat-main > *,
.workspace-shell .kb-main > *,
.workspace-shell .quiz-main > *,
.workspace-shell .utility-column > *,
.workspace-shell .kb-side > *,
.workspace-shell .quiz-side > * {
  padding-top: 32px;
}

.workspace-shell .field-row {
  gap: 18px;
}

.workspace-shell .drop-actions,
.workspace-shell .inline-actions,
.workspace-shell .quick-chip-row,
.workspace-shell .filter-chip-row {
  gap: 12px;
}

.workspace-shell .source-grid,
.workspace-shell #quiz-output-blocks,
.workspace-shell .deliverable-list {
  gap: 18px;
}

.workspace-shell textarea {
  min-height: 240px;
}

.workspace-shell .prompt-box textarea,
#quiz-prompt-input {
  min-height: 320px;
}

#chat-input,
#kb-entry-text {
  min-height: 240px;
}

#chat-input.is-file-dragging {
  border-color: var(--teal-strong);
  background: var(--teal-soft);
  box-shadow: 0 0 0 6px rgba(24, 130, 95, 0.14);
}

.workspace-shell .analysis-list li {
  padding: 16px 0;
}

.workspace-shell .doc-feed {
  gap: 24px;
}

.kb-side .doc-group {
  gap: 12px;
}

.kb-side .doc-item {
  padding: 16px 0 !important;
}

.site-footer {
  padding-top: 16px;
}

.site-footer strong,
.site-footer span {
  font-size: 0.95rem;
}

@media (max-width: 1100px) {
  .hero.hero-auth {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero.hero-auth .hero-copy {
    padding: 0;
  }

  .hero.hero-auth .hero-copy::before {
    display: none;
  }

  .hero-copy h1 {
    font-size: clamp(2.55rem, 9vw, 3.45rem);
  }

  .app-hero h1,
  .section-heading h2,
  .feature-copy h2 {
    max-width: none;
    font-size: clamp(2.3rem, 8vw, 3rem);
  }

  .hero-story-inline,
  .auth-card,
  .feature-visual,
  .trust-strip,
  .final-cta,
    .product-overview,
    .workspace-shell .dropzone {
    padding: 24px;
  }

  .workspace-shell textarea,
  .workspace-shell .prompt-box textarea,
  #quiz-prompt-input,
  #chat-input,
  #kb-entry-text {
    min-height: 220px;
  }
}

/* 2026-04 workspace polish */
:root {
  --font-sans: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Manrope", sans-serif;
  --page-max: 1248px;
  --bg: #f7f5ef;
  --bg-soft: #efeade;
  --bg-elevated: #fcfbf7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --panel-accent: #eaf4ef;
  --line: #d7ddd6;
  --line-strong: #bbc7bc;
  --text: #21313b;
  --muted: #62717c;
  --heading: #17262f;
  --teal: #197a59;
  --teal-soft: #e5f3ed;
  --teal-strong: #0f5a41;
  --warm-soft: #f1ecdf;
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-sans);
}

.hero h1,
.app-hero h1,
.section-heading h2,
.feature-copy h2,
.auth-card h2 {
  font-family: var(--font-display);
}

.site-header,
.hero,
.section-block,
.section-band,
.app-hero,
.app-shell,
.site-footer,
.workspace-brief {
  width: min(var(--page-max), calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
}

.site-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px 22px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.site-nav {
  gap: 18px;
}

.site-nav a {
  font-size: 0.95rem;
  font-weight: 700;
}

.header-actions,
.account-shell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-cta {
  min-width: 120px;
}

.account-pill {
  max-width: 248px;
  background: rgba(255, 255, 255, 0.92);
}

.hero.hero-auth {
  gap: 40px;
  padding-top: 40px;
  padding-bottom: 60px;
}

.hero-copy h1 {
  max-width: 10.2ch;
  font-size: clamp(2.8rem, 4.8vw, 4.2rem);
}

.hero-lead,
.app-hero .hero-lead {
  max-width: 32rem;
  font-size: 1rem;
}

.hero-benefits {
  margin-top: 4px;
}

.hero-benefits li {
  color: var(--text);
}

.hero-metrics {
  gap: 16px;
  padding-top: 18px;
}

.hero-metrics strong {
  font-size: 1rem;
}

.hero-story-inline {
  gap: 14px;
}

.hero-story-inline p {
  max-width: 32rem;
}

.app-hero {
  padding-top: 24px;
  padding-bottom: 18px;
}

.app-hero h1 {
  max-width: 12ch;
  font-size: clamp(2.3rem, 4vw, 3.3rem);
}

.workspace-brief {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 0 0 26px;
}

.workspace-brief-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
}

.workspace-brief-card strong {
  color: var(--heading);
  font-size: 1.08rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.workspace-brief-card p {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.workspace-brief-card .status-chip {
  width: fit-content;
}

.workspace-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-link-row .secondary-button {
  min-height: 42px;
}

.workspace-shell {
  margin-top: 0;
}

.workspace-layout {
  margin-top: 0;
}

.workspace-shell .chat-main,
.workspace-shell .kb-main,
.workspace-shell .quiz-main {
  padding-right: 40px;
}

.workspace-shell .utility-column,
.workspace-shell .kb-side,
.workspace-shell .quiz-side {
  padding-left: 28px;
}

.kb-layout.workspace-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.kb-side .doc-top {
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 8px;
}

.kb-side .doc-icon {
  min-width: 42px;
  padding-inline: 8px;
  justify-self: start;
}

.kb-side .doc-copy strong {
  display: block;
  line-height: 1.35;
}

.kb-side .doc-top > .status-chip {
  max-width: 100%;
  white-space: normal;
  line-height: 1.3;
  justify-self: start;
}

@media (max-width: 1100px) {
  .site-header,
  .hero,
  .section-block,
  .section-band,
  .app-hero,
  .app-shell,
  .site-footer,
  .workspace-brief {
    width: min(var(--page-max), calc(100% - 32px));
  }

  .workspace-brief {
    grid-template-columns: 1fr;
  }

  .workspace-shell .chat-main,
  .workspace-shell .kb-main,
  .workspace-shell .quiz-main,
  .workspace-shell .utility-column,
  .workspace-shell .kb-side,
  .workspace-shell .quiz-side {
    padding-left: 0;
    padding-right: 0;
  }

  .kb-layout.workspace-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header,
  .hero,
  .section-block,
  .section-band,
  .app-hero,
  .app-shell,
  .site-footer,
  .workspace-brief {
    width: min(calc(100% - 24px), var(--page-max));
  }

  .site-header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .brand {
    justify-content: flex-start;
  }

  .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    width: 100%;
  }

  .header-actions > .header-cta {
    justify-self: end;
    width: auto;
    min-width: 112px;
  }

  .account-shell {
    width: 100%;
  }

  .site-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    white-space: normal;
  }

  .site-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    white-space: normal;
    text-align: center;
  }

  .site-nav a.is-active::after {
    display: none;
  }

  .site-nav a.is-active,
  .site-nav a:hover {
    background: var(--teal-soft);
    border-color: #c7e4d8;
    color: var(--teal-strong);
  }

  .hero.hero-auth {
    gap: 28px;
    padding-top: 24px;
    padding-bottom: 44px;
  }

  .app-hero {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .hero-copy h1,
  .app-hero h1 {
    max-width: none;
    font-size: clamp(2.05rem, 10vw, 2.9rem);
  }

  .hero-lead,
  .app-hero .hero-lead,
  .workspace-brief-card p {
    font-size: 0.96rem;
  }

  .hero-actions {
    gap: 10px;
  }

  .hero-actions .primary-button,
  .hero-actions .secondary-button,
  .workspace-link-row .secondary-button {
    width: 100%;
    justify-content: center;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .workspace-brief {
    padding-bottom: 18px;
  }

  .workspace-brief-card {
    padding: 18px;
    border-radius: 16px;
  }
}

@media (max-width: 560px) {
  .header-actions {
    grid-template-columns: 1fr;
  }

  .header-actions > .header-cta {
    justify-self: stretch;
    width: 100%;
  }
}

/* Flow verification lock: keep live AI output complete and usable across pages. */
.quiz-layout.workspace-layout {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.78fr);
  align-items: start;
  gap: clamp(24px, 4vw, 56px);
}

.workspace-shell .quiz-main,
.workspace-shell .quiz-side,
.workspace-shell .quiz-card,
.workspace-shell .output-card,
.workspace-shell .output-block,
.workspace-shell .rich-output {
  min-width: 0;
}

.workspace-shell .quiz-main {
  padding-right: clamp(16px, 3vw, 36px);
}

.workspace-shell .quiz-side {
  padding-left: clamp(16px, 2.6vw, 30px);
  border-left: 1px solid var(--line);
}

.workspace-shell .output-card {
  position: sticky;
  top: 96px;
}

.workspace-shell .quiz-workbench {
  gap: 18px;
}

.workspace-shell .inline-actions {
  align-items: center;
}

.workspace-shell #quiz-run-button {
  position: static;
  width: fit-content;
  white-space: nowrap;
}

.workspace-shell .action-hint {
  max-width: 28rem;
  margin: 0;
  line-height: 1.45;
}

.workspace-shell #quiz-prompt-input {
  min-height: 220px;
  resize: vertical;
}

.workspace-shell .rich-output {
  display: grid;
  gap: 10px;
}

.workspace-shell .rich-output p,
.workspace-shell .rich-output blockquote,
.workspace-shell .rich-output ul {
  max-width: 100%;
}

.workspace-shell .rich-output strong {
  color: var(--heading);
}

.practice-window-page {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(24, 130, 95, 0.12), transparent 28%),
    linear-gradient(135deg, #f7f4ec 0%, #fffdf7 55%, #f2efe6 100%);
}

.practice-window-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto;
  padding: 0;
}

.practice-window-card {
  padding: clamp(18px, 2.4vw, 30px);
  border-radius: 24px;
}

.practice-window-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.practice-window-heading h1 {
  margin: 0;
  color: var(--heading);
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.4vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.practice-window-card .practice-exam-layout {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 290px);
}

.practice-window-card .practice-question-stage,
.practice-window-card .practice-question-card {
  min-height: 520px;
}

.practice-exam {
  display: grid;
  gap: 14px;
}

.practice-exam-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.practice-exam-header strong {
  display: block;
  margin-top: 4px;
  color: var(--heading);
  font-family: var(--font-display);
  font-size: 1.24rem;
  letter-spacing: -0.03em;
}

.practice-exam-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.practice-exam-meta > span,
.practice-meta-control,
.practice-timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-strong);
}

.practice-meta-control input,
.practice-score-control input {
  width: 52px;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--heading);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
}

.practice-score-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
}

.practice-score-control input {
  width: 42px;
}

.practice-exam-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 230px);
  gap: 14px;
  align-items: stretch;
}

.practice-question-area,
.practice-answer-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 36px rgba(22, 41, 63, 0.06);
}

.practice-question-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f4f4f0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.practice-question-toolbar div {
  display: flex;
  gap: 8px;
}

.practice-nav-button {
  border: 0;
  background: transparent;
  color: var(--teal-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.practice-nav-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.5;
}

.practice-question-stage {
  min-height: 430px;
  background: #ffffff;
}

.practice-question-card {
  display: none;
  gap: 18px;
  min-height: 430px;
  padding: 22px;
  background: #ffffff;
}

.practice-question-card.is-active {
  display: grid;
  align-content: start;
}

.practice-question-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.practice-focus {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.practice-question-card h4 {
  margin: 0;
  color: var(--heading);
  font-size: 1.04rem;
  line-height: 1.55;
}

.practice-options {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.practice-choice-option {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 30px;
  color: var(--heading);
  cursor: pointer;
}

.practice-choice-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #45a6ff;
}

.practice-choice-dot {
  display: none;
}

.practice-choice-key {
  color: var(--muted);
  font-weight: 800;
}

.practice-choice-option:has(input:checked) .practice-choice-key,
.practice-choice-option:has(input:checked) .practice-choice-text {
  color: #45a6ff;
}

.practice-answer-box {
  display: grid;
  gap: 8px;
  color: var(--heading);
  font-weight: 700;
}

.practice-answer-box textarea {
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.practice-answer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.practice-answer summary {
  cursor: pointer;
  color: var(--teal-strong);
  font-weight: 800;
}

.practice-answer div {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.practice-answer p {
  margin: 0;
  overflow-wrap: anywhere;
}

.practice-answer-card {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 16px;
  background: #fbfaf5;
}

.practice-answer-card-top {
  display: grid;
  gap: 5px;
}

.practice-answer-card-top strong {
  color: var(--heading);
  font-family: var(--font-display);
  font-size: 1.12rem;
}

.practice-answer-card-top span,
.practice-answer-group-title small,
.practice-submit-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.practice-score-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #c7e4d8;
  border-radius: 14px;
  background: var(--teal-soft);
  color: var(--teal-strong);
}

.practice-score-summary strong,
.practice-score-summary span {
  color: inherit;
  font-size: 0.9rem;
  font-weight: 900;
}

.practice-question-results {
  display: grid;
  gap: 7px;
}

.practice-result-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--heading);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.practice-result-row strong {
  color: inherit;
}

.practice-result-row em {
  color: var(--muted);
  font-style: normal;
}

.practice-result-row.is-correct {
  border-color: #b7dfae;
  background: #f0faec;
  color: #237a2b;
}

.practice-result-row.is-wrong {
  border-color: #f1b6aa;
  background: #fff1ee;
  color: #b73525;
}

.practice-answer-group {
  display: grid;
  gap: 10px;
}

.practice-answer-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: 800;
}

.practice-answer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-answer-dot {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #c9d0d5;
  border-radius: 999px;
  background: #ffffff;
  color: var(--heading);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.practice-answer-dot.is-active {
  border-color: #86d45f;
  background: #95df6d;
  color: #ffffff;
}

.practice-answer-dot.is-answered:not(.is-active) {
  border-color: var(--teal-strong);
  color: var(--teal-strong);
  background: var(--teal-soft);
}

.practice-answer-dot.is-correct {
  border-color: #59b84f;
  background: #59b84f;
  color: #ffffff;
}

.practice-answer-dot.is-wrong {
  border-color: #e36a55;
  background: #fff1ee;
  color: #b73525;
}

.practice-submit-bar {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f5f2e8;
}

.practice-start-button,
.practice-export-button,
.practice-submit-button {
  min-width: 120px;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-weight: 900;
  padding: 13px 20px;
  cursor: pointer;
}

.practice-start-button,
.practice-export-button {
  min-width: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--heading);
}

.practice-start-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.practice-submit-button {
  background: #08aa16;
  color: #ffffff;
}

.message-heading {
  margin: 14px 0 2px;
  color: var(--heading);
  font-family: var(--font-display);
  font-size: 1.06rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.message-heading:first-child {
  margin-top: 0;
}

.message-list-ordered {
  padding-left: 24px;
}

.workspace-shell .output-block p,
.workspace-shell .output-block li,
.workspace-shell .output-block blockquote {
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 1100px) {
  .quiz-layout.workspace-layout {
    grid-template-columns: 1fr !important;
    gap: 28px;
  }

  .workspace-shell .quiz-main,
  .workspace-shell .quiz-side {
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-left: 0 !important;
  }

  .workspace-shell .quiz-side {
    padding-top: 24px !important;
    border-top: 1px solid var(--line) !important;
    background: transparent !important;
  }

  .workspace-shell .output-card {
    position: static;
  }

  .workspace-shell #quiz-run-button {
    width: 100%;
    justify-content: center;
  }

  .practice-exam-layout {
    grid-template-columns: 1fr;
  }

  .practice-window-card .practice-exam-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .workspace-shell .mode-switcher,
  .workspace-shell .quick-chip-row,
  .workspace-shell .field-row {
    width: 100%;
  }

  .workspace-shell .mode-switcher,
  .workspace-shell .quick-chip-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace-shell .field-row {
    grid-template-columns: 1fr;
  }

  .workspace-shell .mode-tab,
  .workspace-shell .quick-chip {
    justify-content: center;
    width: 100%;
  }

  .workspace-shell #quiz-prompt-input {
    min-height: 180px !important;
  }

  .practice-exam-header,
  .practice-question-toolbar,
  .practice-submit-bar {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .practice-exam-meta,
  .practice-question-toolbar div {
    justify-content: flex-start;
  }

  .practice-submit-button {
    width: 100%;
  }

  .practice-window-shell {
    width: min(100% - 20px, 720px);
    margin: 10px auto;
  }

  .practice-window-card {
    padding: 14px;
    border-radius: 18px;
  }

  .practice-window-card .practice-question-stage,
  .practice-window-card .practice-question-card {
    min-height: 360px;
  }
}

/* Runtime polish: keep generated content and document controls fully readable. */
.workspace-shell .chat-thread {
  align-items: start;
  max-height: min(62vh, 680px);
  overflow-y: auto;
  padding-right: 6px;
  overscroll-behavior: auto;
}

.workspace-shell .chat-card {
  max-height: min(78vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-shell .message {
  max-width: min(100%, 920px) !important;
  width: fit-content;
  min-width: min(100%, 280px);
  overflow-wrap: anywhere;
  word-break: normal;
}

.workspace-shell .message.assistant {
  width: min(100%, 920px);
}

.message-line,
.message blockquote,
.message-list {
  margin: 0;
}

.message-line + .message-line,
.message-line + blockquote,
.message-line + .message-list,
.message blockquote + .message-line,
.message-list + .message-line {
  margin-top: 10px;
}

.message blockquote {
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  background: rgba(19, 139, 111, 0.06);
  border-radius: 8px;
}

.message-list {
  padding-left: 20px;
}

.message strong {
  color: var(--heading);
}

.doc-item,
.source-card,
.output-block {
  min-width: 0;
}

.doc-top,
.doc-footer,
.doc-actions {
  gap: 10px 12px;
}

.doc-copy,
.doc-copy strong,
.file-meta,
.source-meta,
.doc-origin {
  min-width: 0;
  overflow-wrap: anywhere;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.doc-action-button {
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}

.status-chip {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.site-header,
.header-actions,
.account-shell,
.account-pill {
  min-width: 0;
}

.account-pill {
  max-width: min(100%, 280px);
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .workspace-shell .message,
  .workspace-shell .message.assistant {
    width: 100%;
    max-width: 100% !important;
  }

  .workspace-shell #chat-composer .composer-top {
    align-items: stretch;
  }

  .workspace-shell #chat-composer .primary-button {
    width: 100%;
  }

  .doc-footer,
  .doc-actions {
    justify-content: flex-start;
  }
}

/* Frame-free pass */
.hero-story-inline,
.feature-visual,
.trust-strip,
.final-cta,
.product-overview,
.workspace-shell .dropzone,
.workspace-shell .source-card,
.workspace-shell .output-block,
.workspace-shell .deliverable-card,
.workspace-shell .doc-empty-state,
.workspace-shell .upload-queue li,
.workspace-shell .drop-panel,
.workspace-shell .upload-progress,
.workspace-shell .prompt-box {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.auth-card {
  background: transparent !important;
  border: 0 !important;
  border-left: 1px solid var(--line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 0 0 36px !important;
}

.hero-story-inline,
.trust-strip,
.final-cta,
.product-overview {
  padding-left: 0;
  padding-right: 0;
}

.feature-visual {
  padding: 0;
}

.workspace-shell .dropzone {
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line) !important;
}

.workspace-shell .source-card,
.workspace-shell .output-block,
.workspace-shell .deliverable-card,
.workspace-shell .doc-empty-state,
.workspace-shell .upload-queue li,
.workspace-shell .drop-panel,
.workspace-shell .upload-progress,
.workspace-shell .prompt-box {
  padding: 18px 0 !important;
  border-top: 1px solid var(--line) !important;
}

.workspace-shell .source-card:first-child,
.workspace-shell .output-block:first-child,
.workspace-shell .deliverable-card:first-child,
.workspace-shell .upload-queue li:first-child {
  border-top: 0 !important;
  padding-top: 0 !important;
}

.workspace-shell .source-card + .source-card,
.workspace-shell .output-block + .output-block,
.workspace-shell .deliverable-card + .deliverable-card,
.workspace-shell .upload-queue li + li {
  margin-top: 0;
}

.workspace-shell .source-card h3,
.workspace-shell .output-block h3,
.workspace-shell .deliverable-card strong {
  margin-bottom: 6px;
}

.product-overview {
  padding-top: 0;
}

.product-columns {
  margin-top: 18px;
}

@media (max-width: 1100px) {
  .auth-card {
    border-left: 0 !important;
    padding-left: 0 !important;
  }
}

/* Product polish lock: keep the latest workspace UX above historical overrides */
:root {
  --font-sans: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Manrope", sans-serif;
  --page-max: 1248px;
  --bg: #f7f5ef;
  --bg-soft: #efeade;
  --bg-elevated: #fcfbf7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --panel-accent: #eaf4ef;
  --line: #d7ddd6;
  --line-strong: #bbc7bc;
  --text: #21313b;
  --muted: #62717c;
  --heading: #17262f;
  --teal: #197a59;
  --teal-soft: #e5f3ed;
  --teal-strong: #0f5a41;
  --warm-soft: #f1ecdf;
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-sans);
}

.hero h1,
.app-hero h1,
.section-heading h2,
.feature-copy h2,
.auth-card h2 {
  font-family: var(--font-display);
}

.site-header,
.hero,
.section-block,
.section-band,
.app-hero,
.app-shell,
.site-footer,
.workspace-brief {
  width: min(var(--page-max), calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
}

.site-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px 22px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.site-nav {
  gap: 18px;
}

.site-nav a {
  font-size: 0.95rem;
  font-weight: 700;
}

.header-actions,
.account-shell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-cta {
  min-width: 120px;
}

.account-pill {
  max-width: 248px;
  background: rgba(255, 255, 255, 0.92);
}

.hero.hero-auth {
  gap: 40px;
  padding-top: 40px;
  padding-bottom: 60px;
}

.hero-copy h1 {
  max-width: 10.2ch;
  font-size: clamp(2.8rem, 4.8vw, 4.2rem);
}

.hero-lead,
.app-hero .hero-lead {
  max-width: 32rem;
  font-size: 1rem;
}

.hero-benefits {
  margin-top: 4px;
}

.hero-benefits li {
  color: var(--text);
}

.hero-metrics {
  gap: 16px;
  padding-top: 18px;
}

.hero-metrics strong {
  font-size: 1rem;
}

.hero-story-inline {
  gap: 14px;
}

.hero-story-inline p {
  max-width: 32rem;
}

.app-hero {
  padding-top: 24px;
  padding-bottom: 18px;
}

.app-hero h1 {
  max-width: 12ch;
  font-size: clamp(2.3rem, 4vw, 3.3rem);
}

.workspace-brief {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 0 0 26px;
}

.workspace-brief-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
}

.workspace-brief-card strong {
  color: var(--heading);
  font-size: 1.08rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.workspace-brief-card p {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.workspace-brief-card .status-chip {
  width: fit-content;
}

.workspace-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-link-row .secondary-button {
  min-height: 42px;
}

.workspace-shell {
  margin-top: 0;
}

.workspace-layout {
  margin-top: 0;
}

.workspace-shell .chat-main,
.workspace-shell .kb-main,
.workspace-shell .quiz-main {
  padding-right: 40px;
}

.workspace-shell .utility-column,
.workspace-shell .kb-side,
.workspace-shell .quiz-side {
  padding-left: 28px;
}

@media (max-width: 1100px) {
  .site-header,
  .hero,
  .section-block,
  .section-band,
  .app-hero,
  .app-shell,
  .site-footer,
  .workspace-brief {
    width: min(var(--page-max), calc(100% - 32px));
  }

  .workspace-brief {
    grid-template-columns: 1fr;
  }

  .workspace-shell .chat-main,
  .workspace-shell .kb-main,
  .workspace-shell .quiz-main,
  .workspace-shell .utility-column,
  .workspace-shell .kb-side,
  .workspace-shell .quiz-side {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 760px) {
  .site-header,
  .hero,
  .section-block,
  .section-band,
  .app-hero,
  .app-shell,
  .site-footer,
  .workspace-brief {
    width: min(calc(100% - 24px), var(--page-max));
  }

  .site-header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .brand {
    justify-content: flex-start;
  }

  .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    width: 100%;
  }

  .header-actions > .header-cta {
    justify-self: end;
    width: auto;
    min-width: 112px;
  }

  .account-shell {
    width: 100%;
  }

  .site-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    white-space: normal;
  }

  .site-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    white-space: normal;
    text-align: center;
  }

  .site-nav a.is-active::after {
    display: none;
  }

  .site-nav a.is-active,
  .site-nav a:hover {
    background: var(--teal-soft);
    border-color: #c7e4d8;
    color: var(--teal-strong);
  }

  .hero.hero-auth {
    gap: 28px;
    padding-top: 24px;
    padding-bottom: 44px;
  }

  .app-hero {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .hero-copy h1,
  .app-hero h1 {
    max-width: none;
    font-size: clamp(2.05rem, 10vw, 2.9rem);
  }

  .hero-lead,
  .app-hero .hero-lead,
  .workspace-brief-card p {
    font-size: 0.96rem;
  }

  .hero-actions {
    gap: 10px;
  }

  .hero-actions .primary-button,
  .hero-actions .secondary-button,
  .workspace-link-row .secondary-button {
    width: 100%;
    justify-content: center;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .workspace-brief {
    padding-bottom: 18px;
  }

  .workspace-brief-card {
    padding: 18px;
    border-radius: 16px;
  }
}

@media (max-width: 560px) {
  .header-actions {
    grid-template-columns: 1fr;
  }

  .header-actions > .header-cta {
    justify-self: stretch;
    width: 100%;
  }
}

/* Workspace density pass: keep desktop controls and first results in the same viewport. */
@media (min-width: 1101px) {
  .workspace-shell .chat-main,
  .workspace-shell .kb-main,
  .workspace-shell .quiz-main,
  .workspace-shell .utility-column,
  .workspace-shell .kb-side,
  .workspace-shell .quiz-side {
    gap: 20px;
  }

  .workspace-shell .chat-main > *,
  .workspace-shell .kb-main > *,
  .workspace-shell .quiz-main > *,
  .workspace-shell .utility-column > *,
  .workspace-shell .kb-side > *,
  .workspace-shell .quiz-side > * {
    padding-top: 24px;
  }

  .workspace-shell .kb-card {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
    grid-template-areas:
      "head search"
      "filters search"
      "results results";
    align-items: start;
    column-gap: 24px;
    row-gap: 14px;
  }

  .workspace-shell .kb-library-head {
    grid-area: head;
  }

  .workspace-shell .kb-card > .filter-chip-row {
    grid-area: filters;
    margin-top: 0;
    align-self: start;
  }

  .workspace-shell .kb-card > .kb-search {
    grid-area: search;
    margin-top: 0;
    align-self: end;
  }

  .workspace-shell .kb-card > .source-grid {
    grid-area: results;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 20px;
    margin-top: 0;
  }

  .workspace-shell .kb-card .quick-chip,
  .workspace-shell .quiz-workbench .quick-chip,
  .workspace-shell .quiz-workbench .mode-tab {
    min-height: 42px;
    padding-inline: 16px;
  }

  .workspace-shell .chat-topline {
    grid-template-columns: minmax(0, 1.06fr) minmax(280px, 0.94fr);
    grid-template-areas:
      "title starters"
      "modes starters";
    column-gap: 28px;
    row-gap: 12px;
    align-items: start;
  }

  .workspace-shell .chat-topline > h3 {
    grid-area: title;
    margin: 0;
  }

  .workspace-shell .chat-topline > .quick-chip-row {
    grid-area: modes;
    margin-top: 0;
  }

  .workspace-shell .chat-topline > .starter-list {
    grid-area: starters;
    margin-top: 0;
    padding-left: 24px;
    border-left: 1px solid var(--line);
  }

  .workspace-shell .starter-button {
    padding: 12px 0;
  }

  .workspace-shell .quiz-workbench {
    grid-template-columns: minmax(0, 1.08fr) minmax(260px, 0.92fr);
    column-gap: 24px;
    row-gap: 14px;
    align-items: start;
  }

  .workspace-shell .quiz-workbench > .mode-switcher {
    grid-column: 1;
    grid-row: 1;
  }

  .workspace-shell .quiz-workbench > .preset-stack {
    grid-column: 1;
    grid-row: 2;
  }

  .workspace-shell .quiz-workbench > :nth-child(3) {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .workspace-shell #quiz-title {
    margin: 0;
    max-width: 16ch;
  }

  .workspace-shell .quiz-workbench > .prompt-box {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 0;
  }

  .workspace-shell .quiz-workbench > .field-row {
    grid-column: 1;
    grid-row: 4;
  }

  .workspace-shell .quiz-workbench > .inline-actions {
    grid-column: 2;
    grid-row: 4;
    align-self: end;
    justify-content: flex-end;
    margin-top: 0;
  }
}

@media (max-width: 1100px) {
  .workspace-shell .kb-card > .source-grid {
    grid-template-columns: 1fr;
  }
}

/* Workspace hero and priority ordering: show the interactive surface earlier on desktop. */
@media (min-width: 1101px) {
  body[data-page="chat"] .app-hero,
  body[data-page="kb"] .app-hero,
  body[data-page="quiz"] .app-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding-top: 10px;
    padding-bottom: 8px;
  }

  body[data-page="chat"] .app-hero h1,
  body[data-page="kb"] .app-hero h1,
  body[data-page="quiz"] .app-hero h1 {
    max-width: 13ch;
    font-size: clamp(2.15rem, 3.5vw, 3.3rem);
  }

  body[data-page="chat"] .app-hero .hero-lead,
  body[data-page="kb"] .app-hero .hero-lead,
  body[data-page="quiz"] .app-hero .hero-lead {
    max-width: 34rem;
  }

  body[data-page="chat"] .workspace-brief,
  body[data-page="kb"] .workspace-brief,
  body[data-page="quiz"] .workspace-brief {
    gap: 14px;
    padding-bottom: 18px;
  }

  body[data-page="chat"] .workspace-brief-card,
  body[data-page="kb"] .workspace-brief-card,
  body[data-page="quiz"] .workspace-brief-card {
    gap: 8px;
    padding: 18px;
  }

  body[data-page="kb"] .workspace-shell .kb-main > .kb-card:last-of-type {
    order: 1;
  }

  body[data-page="kb"] .workspace-shell .kb-main > .dropzone {
    order: 2;
  }

  body[data-page="kb"] .workspace-shell .kb-main > .kb-card:not(:last-of-type) {
    order: 3;
  }
}

/* Lean copy pass: keep top workspace panels compact after removing helper text. */
.hero-story-inline {
  padding: 18px 22px;
}

.hero-story-inline h2 {
  margin-top: 10px;
}

body[data-page="chat"] .workspace-brief,
body[data-page="kb"] .workspace-brief,
body[data-page="quiz"] .workspace-brief {
  padding-bottom: 14px;
}

body[data-page="chat"] .workspace-brief-card,
body[data-page="kb"] .workspace-brief-card,
body[data-page="quiz"] .workspace-brief-card {
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 16px 18px;
}

body[data-page="chat"] .workspace-link-row,
body[data-page="kb"] .workspace-link-row,
body[data-page="quiz"] .workspace-link-row {
  gap: 10px;
}

/* Keep the homepage scenario summary tidy without overflowing its card. */
.hero-story-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  max-width: 100%;
  overflow: hidden;
}

.hero-story-inline .story-badge {
  flex: 0 0 auto;
}

.hero-story-inline h2 {
  flex: 1 1 18rem;
  max-width: none;
  min-width: 0;
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 2rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

body[data-page="kb"] .kb-library-summary {
  display: grid;
  gap: 4px;
  min-width: 0;
}

body[data-page="kb"] .kb-library-context {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
  max-width: 44ch;
}

body[data-page="kb"] .library-filter-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.54);
}

body[data-page="kb"] .library-filter-group {
  display: grid;
  gap: 7px;
}

body[data-page="kb"] .library-filter-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

body[data-page="kb"] .library-filter-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

body[data-page="kb"] .library-filter-group--source .library-filter-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-page="kb"] .library-filter-groups .quick-chip {
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 12px;
  font-size: 0.84rem;
}

body[data-page="kb"] .workspace-shell .source-card--empty {
  grid-column: 1 / -1;
}

body[data-page="kb"] .workspace-shell .source-card h3,
body[data-page="kb"] .workspace-shell .doc-body h4 {
  overflow-wrap: anywhere;
}

/* Final workspace density pass: tighter first screens, scoped KB layouts, and sticky info rails. */
@media (min-width: 1101px) {
  body[data-page="chat"] .page,
  body[data-page="kb"] .page,
  body[data-page="quiz"] .page {
    gap: 48px;
  }

  body[data-page="chat"] .app-hero,
  body[data-page="kb"] .app-hero,
  body[data-page="quiz"] .app-hero {
    gap: 8px;
    padding-top: 0;
    padding-bottom: 2px;
  }

  body[data-page="chat"] .app-hero h1,
  body[data-page="kb"] .app-hero h1,
  body[data-page="quiz"] .app-hero h1 {
    max-width: 16ch;
    font-size: clamp(1.95rem, 3vw, 2.85rem);
    line-height: 0.98;
  }

  body[data-page="chat"] .app-hero .hero-lead,
  body[data-page="kb"] .app-hero .hero-lead,
  body[data-page="quiz"] .app-hero .hero-lead {
    max-width: 28rem;
    margin-top: 2px;
    font-size: 0.98rem;
  }

  body[data-page="chat"] .workspace-shell .chat-main,
  body[data-page="kb"] .workspace-shell .kb-main,
  body[data-page="quiz"] .workspace-shell .quiz-main,
  body[data-page="chat"] .workspace-shell .utility-column,
  body[data-page="kb"] .workspace-shell .kb-side,
  body[data-page="quiz"] .workspace-shell .quiz-side {
    gap: 16px;
  }

  body[data-page="chat"] .workspace-shell .chat-main > *,
  body[data-page="kb"] .workspace-shell .kb-main > *,
  body[data-page="quiz"] .workspace-shell .quiz-main > *,
  body[data-page="chat"] .workspace-shell .utility-column > *,
  body[data-page="kb"] .workspace-shell .kb-side > *,
  body[data-page="quiz"] .workspace-shell .quiz-side > * {
    padding-top: 20px;
  }

  body[data-page="chat"] .workspace-shell .chat-main,
  body[data-page="kb"] .workspace-shell .kb-main,
  body[data-page="quiz"] .workspace-shell .quiz-main {
    padding-right: 30px;
  }

  body[data-page="chat"] .workspace-shell .utility-column,
  body[data-page="kb"] .workspace-shell .kb-side,
  body[data-page="quiz"] .workspace-shell .quiz-side {
    padding-left: 22px;
  }

  body[data-page="chat"] .workspace-brief,
  body[data-page="kb"] .workspace-brief,
  body[data-page="quiz"] .workspace-brief {
    gap: 12px;
    padding-top: 4px;
    padding-bottom: 12px;
  }

  body[data-page="kb"] .workspace-shell .kb-main > .kb-card--library {
    order: 1;
  }

  body[data-page="kb"] .workspace-shell .kb-main > .dropzone {
    order: 2;
  }

  body[data-page="kb"] .workspace-shell .kb-main > .kb-card--entry {
    order: 3;
    display: block;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    margin-top: 14px;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form > .field-row,
  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form > .field-block:last-of-type,
  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form > .inline-actions {
    grid-column: 1 / -1;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form > .field-row,
  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form > .inline-actions {
    margin-top: 0;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry .field-row {
    gap: 16px;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry input,
  body[data-page="kb"] .workspace-shell .kb-card--entry select,
  body[data-page="kb"] .workspace-shell .kb-card--entry textarea {
    padding: 14px 16px;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry #kb-entry-text {
    min-height: 184px;
  }

  body[data-page="kb"] .workspace-shell .kb-card--library {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
    grid-template-areas:
      "head search"
      "filters search"
      "results results";
    align-items: start;
    column-gap: 22px;
    row-gap: 12px;
  }

  body[data-page="kb"] .workspace-shell .kb-card--library .kb-library-head {
    grid-area: head;
    align-items: flex-start;
    gap: 10px 16px;
  }

  body[data-page="kb"] .workspace-shell .kb-card--library > .filter-chip-row {
    grid-area: filters;
    margin-top: 0;
    align-self: start;
  }

  body[data-page="kb"] .workspace-shell .kb-card--library > .kb-search {
    grid-area: search;
    margin-top: 0;
    align-self: end;
  }

  body[data-page="kb"] .workspace-shell .kb-card--library > .source-grid {
    grid-area: results;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    margin-top: 0;
  }

  body[data-page="chat"] .workspace-shell .utility-column .analysis-card,
  body[data-page="kb"] .workspace-shell .kb-side .doc-list,
  body[data-page="quiz"] .workspace-shell .quiz-side .output-card {
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 6px;
  }

  body[data-page="chat"] .workspace-shell #chat-input {
    min-height: 196px;
  }

  body[data-page="quiz"] .workspace-shell #quiz-prompt-input {
    min-height: 260px;
  }
}

@media (max-width: 1100px) {
  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form {
    grid-template-columns: 1fr;
  }

  body[data-page="kb"] .workspace-shell .kb-card--library .kb-library-head {
    align-items: flex-start;
  }

  body[data-page="kb"] .workspace-shell .kb-card--library > .source-grid {
    grid-template-columns: 1fr;
  }
}

/* Knowledge base rail rebalance: keep uploads in the main flow and move Library into the right rail. */
@media (min-width: 1101px) {
  body[data-page="kb"] .kb-layout.workspace-layout {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.78fr);
    gap: clamp(24px, 4vw, 56px);
  }

  body[data-page="kb"] .workspace-shell .kb-main > .dropzone {
    order: 1;
  }

  body[data-page="kb"] .workspace-shell .kb-main > .kb-card--entry {
    order: 2;
    display: block;
    grid-template-columns: none;
    grid-template-areas: none;
  }

  body[data-page="kb"] .workspace-shell .kb-side {
    position: static;
    top: auto;
    align-self: start;
    align-content: start;
    gap: 18px;
    max-height: none;
    overflow: visible;
    padding-left: clamp(16px, 2.6vw, 30px);
    padding-right: 0;
    border-left: 1px solid var(--line);
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library,
  body[data-page="kb"] .workspace-shell .kb-side > .doc-list {
    padding-top: 0;
    border-top: 0;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "filters"
      "search"
      "results";
    row-gap: 14px;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .kb-library-head {
    grid-area: head;
    display: grid;
    gap: 8px;
    align-items: start;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .kb-library-context {
    max-width: none;
    font-size: 0.88rem;
    line-height: 1.4;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library > .filter-chip-row {
    grid-area: filters;
    margin-top: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .quick-chip {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.88rem;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library > .kb-search {
    grid-area: search;
    margin-top: 0;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .kb-search input {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library > .source-grid {
    grid-area: results;
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 0;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .source-card {
    padding: 12px 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    border-radius: 0 !important;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .source-card h3 {
    margin: 0 0 4px;
    font-size: 0.98rem;
    line-height: 1.24;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .source-card .source-meta {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.42;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .source-card-tags {
    margin-top: 8px;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .doc-tag {
    padding: 4px 8px;
    font-size: 0.68rem;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library .source-card:first-child {
    padding-top: 0 !important;
  }

  body[data-page="kb"] .workspace-shell .kb-side > .doc-list {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  body[data-page="kb"] .workspace-shell .kb-side.is-height-bound {
    max-height: var(--kb-main-height);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
    padding-right: 8px;
    scrollbar-gutter: stable;
  }

  body[data-page="kb"] .workspace-shell .kb-side.is-height-bound > .kb-card--library > .source-grid,
  body[data-page="kb"] .workspace-shell .kb-side.is-height-bound > .doc-list {
    max-height: none;
    overflow: visible;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form > .field-row,
  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form > .field-block,
  body[data-page="kb"] .workspace-shell .kb-card--entry .kb-entry-form > .inline-actions {
    grid-column: 1 / -1;
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry .field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="kb"] .workspace-shell .kb-card--entry #kb-entry-text {
    min-height: 208px;
  }
}

/* Quiz compact controls: keep the selected title and preset choices on one desktop line. */
@media (min-width: 1101px) {
  body[data-page="quiz"] .workspace-shell #quiz-title {
    max-width: none;
    white-space: nowrap;
  }

  body[data-page="quiz"] .workspace-shell #quiz-preset-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    overflow: visible;
  }

  body[data-page="quiz"] .workspace-shell #quiz-preset-row .quick-chip {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding-inline: 10px;
    white-space: nowrap;
  }
}

/* Study Chat voice controls. */
.workspace-shell #chat-composer .composer-top {
  align-items: center;
}

.composer-control-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.speech-tool-button,
.message-speak-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--heading);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.composer-control-row .primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.composer-control-row .speech-tool-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
}

.button-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.speech-tool-button:hover,
.message-speak-button:hover {
  background: var(--warm-soft);
  border-color: var(--line-strong);
}

.speech-tool-button[aria-pressed="true"] {
  background: var(--teal-soft);
  border-color: #c7e4d8;
  color: var(--teal-strong);
}

.speech-tool-button:disabled,
.message-speak-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.chat-input-shell {
  position: relative;
  display: block;
}

.chat-input-shell #chat-input {
  padding-right: 64px;
}

.chat-input-shell .chat-voice-button {
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
}

.composer-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.workspace-shell #chat-composer .composer-send-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-width: 156px;
}

.workspace-shell #chat-speech-status {
  width: fit-content;
}

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

.voice-input-shell {
  position: relative;
  display: block;
  width: 100%;
  color: inherit;
  font: inherit;
}

label .voice-input-shell,
.field-block .voice-input-shell {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.voice-input-shell > input,
.voice-input-shell > textarea {
  padding-right: 54px !important;
}

.field-voice-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  box-shadow: 0 8px 18px rgba(18, 39, 63, 0.08);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.field-voice-button:hover {
  color: var(--teal-strong);
  border-color: #c7e4d8;
  background: var(--teal-soft);
  transform: translateY(-1px);
}

.field-voice-button.is-listening,
.field-voice-button[aria-pressed="true"] {
  color: #ffffff;
  border-color: var(--teal-strong);
  background: var(--teal-strong);
  box-shadow: 0 12px 24px rgba(22, 128, 99, 0.18);
}

.field-voice-button:disabled,
.field-voice-button.is-unavailable {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.message-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 2px;
}

.message-speak-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

@media (max-width: 760px) {
  .composer-control-row {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .composer-bottom-row {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-shell #chat-composer .composer-send-button {
    width: 100%;
  }
}

/* Homepage auth column: keep proof points directly under the login card. */
.auth-column {
  display: grid;
  align-self: start;
  gap: 18px;
}

.auth-column .trust-strip {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--warm-soft);
}

.auth-column .trust-strip .section-heading {
  gap: 8px;
}

.auth-column .trust-strip h2 {
  max-width: none;
  font-size: clamp(1.35rem, 2.1vw, 1.75rem);
  line-height: 1.14;
}

.auth-column .trust-badges {
  gap: 8px;
  margin-top: 16px;
}

.auth-column .logo-pill {
  padding: 8px 10px;
  font-size: 0.86rem;
}

@media (max-width: 1100px) {
  .auth-column {
    gap: 16px;
  }
}

/* Homepage section density: use separators instead of large blank gaps. */
body[data-page="auth"] .page {
  gap: 0;
}

body[data-page="auth"] .hero.hero-auth {
  padding-bottom: 36px;
}

body[data-page="auth"] .section-block {
  padding-top: 38px;
  padding-bottom: 42px;
  border-top: 1px solid var(--line) !important;
}

body[data-page="auth"] .feature-split {
  gap: clamp(32px, 5vw, 64px);
}

body[data-page="auth"] .feature-copy {
  gap: 14px;
}

body[data-page="auth"] .feature-lead {
  margin-top: -2px;
}

body[data-page="auth"] .workspace-block,
body[data-page="auth"] .final-cta {
  padding-top: 34px;
}

@media (max-width: 760px) {
  body[data-page="auth"] .hero.hero-auth {
    padding-bottom: 28px;
  }

  body[data-page="auth"] .section-block {
    padding-top: 28px;
    padding-bottom: 32px;
  }
}

/* Practice local bank tools. */
.quiz-bank-card {
  display: grid;
  gap: 16px;
  margin-top: clamp(18px, 3vw, 32px);
  padding-top: clamp(18px, 2.6vw, 28px);
  border-top: 0;
}

.quiz-bank-card::before {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 8%, var(--line-strong) 92%, transparent);
}

.quiz-bank-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.quiz-bank-head > div {
  display: grid;
  gap: 8px;
}

.question-bank-drop {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--heading);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.question-bank-drop:hover {
  border-color: var(--teal-strong);
  background: var(--teal-soft);
  transform: translateY(-1px);
}

.question-bank-drop input {
  display: none;
}

.question-bank-drop span {
  color: var(--heading);
  font-weight: 800;
}

.question-bank-drop small {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.quiz-bank-preview {
  margin: 0;
}

.quiz-bank-preview li {
  align-items: start;
}

.quiz-bank-preview strong {
  display: block;
  color: var(--heading);
  line-height: 1.35;
}

.quiz-bank-actions {
  gap: 10px;
}

.quiz-bank-actions .action-hint {
  flex: 1 1 220px;
}

.practice-source-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.practice-source-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.practice-source-head > div {
  display: grid;
  gap: 6px;
}

.practice-source-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.practice-source-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.practice-source-option input {
  margin-top: 3px;
  accent-color: var(--teal-strong);
}

.practice-source-option strong,
.practice-source-option span {
  display: block;
}

.practice-source-option strong {
  color: var(--heading);
  line-height: 1.25;
}

.practice-source-option span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.practice-source-actions {
  margin-top: 0 !important;
  gap: 10px;
}

@media (max-width: 760px) {
  .quiz-bank-head,
  .practice-source-head {
    display: grid;
  }
}

.workflow-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.workflow-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.workflow-card h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--heading);
  font-size: 1rem;
  line-height: 1.2;
}

.workflow-card h3 span {
  display: inline-grid;
  min-width: 34px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.workflow-card ol {
  counter-reset: flow-step;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-card li {
  counter-increment: flow-step;
  position: relative;
  min-height: 24px;
  padding-left: 30px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.workflow-card li::before {
  content: counter(flow-step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--warm-soft);
  color: var(--teal-strong);
  font-size: 0.76rem;
  font-weight: 900;
}

@media (max-width: 980px) {
  .workflow-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .workflow-map {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1101px) {
  body[data-page="kb"] .workspace-shell .kb-side > .kb-card--library > .library-filter-groups {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 760px) {
  body[data-page="kb"] .library-filter-groups {
    overflow: visible;
    white-space: normal;
    padding-bottom: 10px;
  }

  body[data-page="kb"] .library-filter-groups > * {
    min-width: 0;
  }
}

/* Scroll safety: keep page-level wheel and touch scrolling available on every viewport. */
html,
body {
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  min-height: 100dvh;
}

.workspace-shell,
.workspace-layout {
  min-width: 0;
}

@media (max-width: 760px) {
  .workspace-shell,
  .workspace-layout {
    overflow: visible;
  }

  .workspace-shell .utility-column,
  .workspace-shell .kb-side,
  .workspace-shell .quiz-side,
  .workspace-shell .chat-card,
  .workspace-shell .chat-thread,
  .workspace-shell .utility-column .analysis-card,
  .workspace-shell .kb-side.is-height-bound,
  .workspace-shell .kb-side .doc-list,
  .workspace-shell .quiz-side .output-card {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }

  .workspace-shell .utility-column,
  .workspace-shell .kb-side,
  .workspace-shell .quiz-side {
    border-left: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .chat-input-shell #chat-input {
    padding-right: 58px;
  }

  .chat-input-shell .chat-voice-button {
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
  }
}
