.paia-simulator {
  margin-top: 62px;
  scroll-margin-top: 88px;
}

/* The standalone demo behaves like a tool page, not a second landing page. */
.demo-page-hero {
  padding-top: 58px;
  padding-bottom: 58px;
}
.demo-page-hero .eyebrow { margin-bottom: 14px; }
.demo-page-hero h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1.03;
}
.demo-page-lead {
  max-width: 760px;
  margin: 0 0 15px;
  color: #535d52;
  font-size: clamp(16px, 1.65vw, 19px);
  line-height: 1.62;
}
.demo-page-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  color: #687267;
  font-size: 12.5px;
  line-height: 1.5;
}
.demo-page-meta .text-link { font-size: 12.5px; }
.demo-page-hero .paia-simulator { margin-top: 28px; }
.demo-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 11px;
}
.demo-exit {
  padding-top: 64px;
  padding-bottom: 70px;
}
.demo-exit-copy { max-width: 760px; }
.demo-exit h2 {
  margin-bottom: 24px;
  font-size: clamp(28px, 3vw, 40px);
}

.demo-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  color: #687267;
  font-size: 12.5px;
  line-height: 1.5;
}
.demo-intro-copy { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.demo-intro-copy strong { color: #394438; font-weight: 650; }
.demo-intro-copy span + span::before { content: '·'; margin-right: 14px; color: #9aa398; }
.demo-reset { padding: 0; border: 0; background: transparent; color: #647b58; font: inherit; font-weight: 600; cursor: pointer; }
.demo-reset:hover { color: #3d4e38; }

.paia-demo-window {
  position: relative;
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  height: 650px;
  overflow: hidden;
  border: 1px solid #d6ddd2;
  border-radius: 18px;
  background: #fbfcf9;
  box-shadow: 0 16px 46px rgba(36,45,34,.065);
}
.demo-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 22px 14px 14px;
  border-right: 1px solid #e1e6de;
  background: #f5f7f3;
}
.demo-brand { padding: 0 10px 24px; }
.demo-brand strong { display: block; color: #232923; font-size: 18px; font-weight: 700; letter-spacing: .055em; line-height: 1; }
.demo-brand small { display: block; margin-top: 7px; color: #788277; font-size: 8.5px; letter-spacing: .14em; }
.demo-nav { display: grid; gap: 3px; }
.demo-nav-button {
  display: flex;
  align-items: center;
  min-height: 40px;
  width: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #677166;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.demo-nav-button:hover { background: #edf1ea; color: #394438; }
.demo-nav-button.is-active { background: #e7ece3; color: #30402c; font-weight: 650; }
.demo-sidebar-settings { margin-top: auto; padding-top: 12px; border-top: 1px solid #e1e6de; }

.demo-main { display: grid; min-width: 0; min-height: 0; grid-template-rows: 52px minmax(0, 1fr); background: #fbfcf9; }
.demo-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid #e4e8e1; background: rgba(251,252,249,.96); }
.demo-topbar strong { color: #2f372e; font-size: 13px; font-weight: 650; }
.demo-local-badge { color: #70806d; font-size: 9.5px; font-weight: 700; letter-spacing: .14em; }
.demo-stage {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 30px 34px 38px;
  scrollbar-width: thin;
  scrollbar-color: #d4dbd1 transparent;
}
.demo-stage::-webkit-scrollbar { width: 8px; }
.demo-stage::-webkit-scrollbar-thumb { background: #d4dbd1; border: 2px solid transparent; border-radius: 999px; background-clip: padding-box; }

.demo-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 26px; }
.demo-page-head > div:first-child { max-width: 640px; min-width: 0; }
.demo-page-head h3 { margin: 0 0 8px; color: #242a23; font-size: clamp(24px, 2.3vw, 31px); line-height: 1.16; letter-spacing: -.025em; font-weight: 610; }
.demo-page-head p { max-width: 620px; margin: 0; color: #687267; font-size: 13.5px; line-height: 1.65; }
.demo-page-head-compact { margin-bottom: 19px; }
.demo-kicker { display: block; margin-bottom: 9px; color: #758472; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.demo-secondary, .demo-primary, .demo-back { font: inherit; cursor: pointer; }
.demo-secondary { flex: 0 0 auto; min-height: 35px; padding: 0 12px; border: 1px solid #d6ddd2; border-radius: 9px; background: #f9faf7; color: #52614e; font-size: 12px; font-weight: 620; }
.demo-secondary:hover { border-color: #c3cec0; background: #f3f6f0; }
.demo-back { margin: 0 0 12px; padding: 0; border: 0; background: transparent; color: #647b58; font-size: 12px; font-weight: 620; }

.demo-stat-line, .demo-inline-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 15px; color: #737e71; font-size: 11.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.demo-stat-line { padding: 10px 0; border-top: 1px solid #e3e7e0; border-bottom: 1px solid #e3e7e0; }
.demo-stat-line span + span::before, .demo-inline-meta > span:not(.demo-state) + span:not(.demo-state)::before { content: '·'; margin-right: 15px; color: #a8b0a6; }

.demo-conversation-grid { margin-top: 7px; border-bottom: 1px solid #e3e7e0; }
.demo-conversation-card {
  display: grid;
  grid-template-columns: minmax(160px,.8fr) minmax(260px,1.35fr) minmax(170px,.8fr);
  gap: 20px;
  align-items: center;
  width: 100%;
  min-height: 92px;
  padding: 18px 8px;
  border: 0;
  border-top: 1px solid #e3e7e0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.demo-conversation-grid .demo-conversation-card:first-child { border-top: 0; }
.demo-conversation-card:hover { background: #f7f9f5; }
.demo-card-title { color: #2b332a; font-size: 14.5px; font-weight: 640; line-height: 1.4; }
.demo-card-summary { color: #687267; font-size: 12.5px; line-height: 1.58; }
.demo-card-meta { color: #778176; font-size: 11px; line-height: 1.55; }
.demo-card-meta b { display: block; margin-top: 4px; color: #647b58; font-weight: 620; }

.demo-document { max-width: 760px; margin: 0 auto; padding: 4px 2px 50px; }
.demo-entry { padding: 18px 0 20px; border-top: 1px solid #e5e9e2; }
.demo-entry:first-child { border-top: 0; }
.demo-entry-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.demo-entry-actions { display: flex; align-items: center; gap: 8px; }
.demo-time { padding: 0; border: 0; background: transparent; color: #727d70; font: inherit; font-size: 11.5px; font-variant-numeric: tabular-nums; cursor: pointer; }
.demo-time:hover { color: #4d5a49; }
.demo-time::after { content: '⌄'; margin-left: 5px; color: #9aa398; }
.demo-time[aria-expanded="true"]::after { content: '⌃'; }
.demo-time-detail { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 10px; padding: 9px 11px; border-left: 2px solid #d5ded0; background: #f7f9f5; color: #657062; font-size: 11.5px; line-height: 1.55; font-variant-numeric: tabular-nums; }
.demo-time-detail[hidden] { display: none; }
.demo-time-detail span { display: flex; gap: 7px; }
.demo-time-detail b { color: #4d594a; font-weight: 650; }
.demo-editable { min-height: 32px; margin: 0; padding: 4px 5px; border-radius: 5px; color: #30372f; font-size: 15px; line-height: 1.78; outline: none; cursor: text; }
.demo-editable:hover { background: #f7f9f5; }
.demo-editable:focus { background: #f6f8f4; box-shadow: inset 0 0 0 1px #cbd6c6; }
.demo-icon-button { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #828c80; cursor: pointer; }
.demo-icon-button:hover { background: #f0f3ed; color: #596455; }
.demo-icon-button svg { width: 16px; height: 16px; }

.demo-state { display: inline-flex; align-items: center; min-height: 21px; padding: 0 7px; border: 1px solid #d8dfd5; border-radius: 999px; color: #667164; background: #fafbf8; font-size: 10px; font-weight: 650; line-height: 1; white-space: nowrap; }
.demo-state-source { background: #fafbf8; }
.demo-state-ai { border-color: #cbd8c5; background: #edf2e9; color: #52694a; }
.demo-state-you { border-color: #cbd3c8; background: #f2f5ef; color: #3f503a; }

.demo-topic-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.demo-topic-card { display: flex; min-height: 154px; flex-direction: column; padding: 18px; border: 1px solid #dde3da; border-radius: 12px; background: #fafbf8; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.demo-topic-card:hover { border-color: #c9d3c5; background: #f7f9f5; }
.demo-topic-count { margin-bottom: 19px; color: #70806c; font-size: 10.5px; font-weight: 650; letter-spacing: .03em; }
.demo-topic-card .demo-card-summary { margin-top: 7px; }
.demo-topic-card .demo-card-meta { margin-top: auto; padding-top: 16px; }

.demo-ai-toggle, .demo-access-toggle { display: grid; grid-template-columns: auto 34px auto; align-items: center; gap: 8px; flex: 0 0 auto; min-height: 37px; padding: 0 10px; border: 1px solid #d6ddd2; border-radius: 10px; background: #f9faf7; color: #596556; font: inherit; font-size: 11.5px; cursor: pointer; }
.demo-ai-toggle > span, .demo-access-toggle > span { font-weight: 620; }
.demo-ai-toggle em, .demo-access-toggle em { color: #737e71; font-style: normal; }
.demo-ai-toggle i, .demo-access-toggle i { position: relative; display: block; width: 30px; height: 17px; border-radius: 999px; background: #dde3da; }
.demo-ai-toggle i b, .demo-access-toggle i b { position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(36,45,34,.18); transition: transform .18s ease; }
.demo-ai-toggle.is-on i, .demo-access-toggle.is-on i { background: #738a68; }
.demo-ai-toggle.is-on i b, .demo-access-toggle.is-on i b { transform: translateX(13px); }
.demo-ai-toggle.is-on em, .demo-access-toggle.is-on em { color: #52694a; }

.demo-derived-card { margin: 0 0 15px; padding: 18px 19px; border: 1px solid #d6e0d1; border-radius: 12px; background: #f3f7f0; }
.demo-derived-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 11px; margin-bottom: 15px; color: #667164; font-size: 11px; }
.demo-derived-meta button { margin-left: auto; padding: 0; border: 0; background: transparent; color: #5a7251; font: inherit; font-weight: 650; cursor: pointer; }
.demo-derived-card h4, .demo-settings-section h4, .demo-context-picker h4, .demo-preview h4 { margin: 0 0 8px; color: #2d352c; font-size: 13.5px; font-weight: 650; }
.demo-derived-card > p { margin: 0; color: #465244; font-size: 13.5px; line-height: 1.72; }
.demo-source-list { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 15px; padding-top: 12px; border-top: 1px solid #dce5d8; color: #6c7869; font-size: 10.5px; }
.demo-source-continuity { margin: 0 0 6px; color: #737e71; font-size: 11.5px; }
.demo-source-stack { max-width: 760px; }
.demo-source-block { padding: 15px 2px; border-top: 1px solid #e4e8e1; }
.demo-source-block > div { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; margin-bottom: 7px; color: #727d70; font-size: 10.5px; }
.demo-source-block p { margin: 0; color: #3d463b; font-size: 13.5px; line-height: 1.7; }

.demo-context-math { display: grid; grid-template-columns: minmax(0,1fr) 34px minmax(0,1fr); gap: 12px; align-items: center; margin-bottom: 18px; }
.demo-context-math > div { min-height: 98px; padding: 15px 16px; border: 1px solid #dde3da; border-radius: 11px; background: #fafbf8; }
.demo-context-math > div.is-context { border-color: #cbd8c5; background: #f2f6ef; }
.demo-context-math span, .demo-context-math small { display: block; color: #707b6e; font-size: 10.5px; }
.demo-context-math strong { display: block; margin: 5px 0 2px; color: #283027; font-size: 27px; line-height: 1; font-weight: 620; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.demo-context-arrow { text-align: center; color: #9aa398 !important; font-size: 16px !important; }
.demo-question { margin-bottom: 17px; padding: 13px 15px; border-left: 2px solid #cbd6c6; background: #f7f9f5; }
.demo-question > span { color: #717c6f; font-size: 10.5px; font-weight: 650; }
.demo-question p { margin: 4px 0 0; color: #364034; font-size: 13px; line-height: 1.58; }
.demo-context-picker { margin-bottom: 17px; transition: opacity .18s ease; }
.demo-context-picker.is-disabled { opacity: .54; }
.demo-context-row { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; gap: 9px; align-items: center; min-height: 50px; border-top: 1px solid #e3e7e0; cursor: pointer; }
.demo-context-row:last-child { border-bottom: 1px solid #e3e7e0; }
.demo-context-row input { accent-color: #647b58; }
.demo-context-row > span b { display: block; color: #354033; font-size: 12px; font-weight: 620; }
.demo-context-row > span small { display: block; margin-top: 1px; color: #768174; font-size: 10.5px; }
.demo-context-row em { color: #7f897d; font-size: 10.5px; font-style: normal; }
.demo-context-row em.is-included { color: #52694a; font-weight: 650; }
.demo-context-row em.is-excluded { color: #6f786d; }
.demo-preview { padding: 15px 16px; border: 1px solid #dfe4dc; border-radius: 11px; background: #fafbf8; }
.demo-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.demo-preview-head h4 { margin: 0; }
.demo-preview-head > span { color: #70836a; font-size: 9.5px; font-weight: 720; letter-spacing: .14em; }
.demo-preview article { padding: 10px 0; border-top: 1px solid #e6eae3; }
.demo-preview article small { margin-left: 8px; color: #737e71; font-size: 10.5px; }
.demo-preview article p { margin: 5px 0 0; color: #3f483d; font-size: 12px; line-height: 1.6; }
.demo-empty-preview { margin: 10px 0 3px; color: #737e71; font-size: 12px; line-height: 1.6; }
.demo-context-actions { display: flex; align-items: center; gap: 14px; margin-top: 13px; }
.demo-primary { flex: 0 0 auto; min-height: 37px; padding: 0 13px; border: 0; border-radius: 9px; background: #52694a; color: #fff; font-size: 11.5px; font-weight: 650; }
.demo-primary:disabled { background: #d9dfd6; color: #7f897d; cursor: default; }
.demo-context-actions > span { color: #727d70; font-size: 10.5px; line-height: 1.5; }

.demo-settings-section { max-width: 720px; padding: 20px 0; border-top: 1px solid #e3e7e0; }
.demo-settings-section:first-of-type { border-top: 0; padding-top: 0; }
.demo-settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.demo-settings-heading p, .demo-precedence, .demo-filter-result { margin: 0; color: #687267; font-size: 12px; line-height: 1.65; }
.demo-settings-heading p strong { color: #40503c; font-weight: 650; }
.demo-settings-heading > span { color: #657b59; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.demo-segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid #dbe1d8; border-radius: 10px; background: #f5f7f3; }
.demo-segmented button { min-height: 33px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: #667164; font: inherit; font-size: 11.5px; cursor: pointer; }
.demo-segmented button.is-active { background: #fff; color: #344230; box-shadow: 0 1px 3px rgba(36,45,34,.08); font-weight: 650; }
.demo-filter-result { margin-top: 11px; color: #52614e; font-variant-numeric: tabular-nums; }
.demo-scope-row { display: grid; grid-template-columns: 95px 1fr; gap: 14px; align-items: start; padding: 11px 0; border-top: 1px solid #e6eae3; }
.demo-scope-row span { color: #687267; font-size: 11px; font-weight: 650; }
.demo-scope-row.is-positive span { color: #52694a; }
.demo-scope-row p { margin: 0; color: #4f5a4d; font-size: 12px; line-height: 1.55; }

.demo-toast { position: absolute; z-index: 8; right: 20px; bottom: 18px; display: flex; align-items: center; gap: 13px; max-width: min(480px,calc(100% - 40px)); padding: 10px 12px; border: 1px solid #ced8ca; border-radius: 10px; background: rgba(247,249,245,.98); color: #43503f; box-shadow: 0 10px 30px rgba(36,45,34,.10); font-size: 11.5px; line-height: 1.45; opacity: 0; transform: translateY(7px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.demo-toast.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.demo-toast button { flex: 0 0 auto; padding: 0; border: 0; background: transparent; color: #52694a; font: inherit; font-weight: 700; cursor: pointer; }
.demo-hint { max-width: 760px; margin: 12px 0 0; color: #717c6f; font-size: 11.5px; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .demo-ai-toggle i b, .demo-access-toggle i b, .demo-toast, .demo-context-picker { transition: none; }
}

@media (max-width: 900px) {
  .paia-demo-window { grid-template-columns: 178px minmax(0,1fr); height: 620px; }
  .demo-stage { padding: 26px 26px 34px; }
  .demo-conversation-card { grid-template-columns: 1fr 1.2fr; }
  .demo-conversation-card .demo-card-meta { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .paia-simulator { margin-top: 46px; }
  .demo-page-hero { padding-top: 42px; padding-bottom: 46px; }
  .demo-page-hero .eyebrow { margin-bottom: 12px; }
  .demo-page-hero h1 { margin-bottom: 10px; font-size: 40px; }
  .demo-page-lead { margin-bottom: 12px; font-size: 15px; }
  .demo-page-meta { align-items: flex-start; flex-direction: column; gap: 7px; font-size: 11.5px; }
  .demo-page-meta .text-link { font-size: 11.5px; }
  .demo-page-hero .paia-simulator { margin-top: 22px; }
  .demo-controls { margin-bottom: 9px; }
  .demo-exit { padding-top: 52px; padding-bottom: 56px; }
  .demo-exit h2 { margin-bottom: 20px; }

  .demo-intro { align-items: flex-start; }
  .demo-intro-copy { display: grid; gap: 2px; }
  .demo-intro-copy span + span::before { display: none; }
  .demo-reset { white-space: nowrap; }

  .paia-demo-window {
    display: block;
    height: auto;
    overflow: visible;
    border-radius: 14px;
  }
  .demo-sidebar {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid #e1e6de;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .demo-sidebar::-webkit-scrollbar { display: none; }
  .demo-brand { display: none; }
  .demo-nav { display: flex; gap: 3px; }
  .demo-sidebar-settings { margin: 0 0 0 auto; padding: 0 0 0 4px; border-top: 0; border-left: 1px solid #e1e6de; }
  .demo-nav-button { width: auto; min-height: 35px; padding: 0 9px; white-space: nowrap; font-size: 11.5px; }
  .demo-main { display: block; }
  .demo-topbar { min-height: 45px; padding: 0 16px; }
  .demo-topbar strong { font-size: 12.5px; }
  .demo-stage { overflow: visible; padding: 20px 17px 28px; }

  .demo-page-head { display: grid; gap: 14px; margin-bottom: 20px; }
  .demo-page-head h3 { font-size: 23px; }
  .demo-page-head p { font-size: 13px; }
  .demo-secondary { justify-self: start; }
  .demo-stat-line { gap: 5px 10px; font-size: 10.5px; }
  .demo-stat-line span + span::before { margin-right: 10px; }
  .demo-conversation-card { grid-template-columns: 1fr; gap: 7px; min-height: 0; padding: 16px 4px; }
  .demo-conversation-card .demo-card-meta { grid-column: auto; }
  .demo-card-title { font-size: 14px; }
  .demo-card-summary { font-size: 12px; }
  .demo-card-meta { font-size: 10.5px; }
  .demo-editable { font-size: 14.5px; line-height: 1.72; }
  .demo-time-detail { display: grid; gap: 5px; font-size: 11px; }

  .demo-topic-grid { grid-template-columns: 1fr; }
  .demo-topic-card { min-height: 130px; }
  .demo-ai-toggle, .demo-access-toggle { grid-template-columns: auto 30px auto; justify-self: start; }
  .demo-derived-meta button { margin-left: 0; }
  .demo-source-block > div { font-size: 10px; }

  .demo-context-math { grid-template-columns: 1fr 20px 1fr; gap: 6px; }
  .demo-context-math > div { min-height: 91px; padding: 13px 12px; }
  .demo-context-math strong { font-size: 24px; }
  .demo-context-math small { line-height: 1.35; }
  .demo-context-row { grid-template-columns: 20px 1fr; padding: 7px 0; }
  .demo-context-row em { grid-column: 2; margin-top: -4px; }
  .demo-context-actions { align-items: flex-start; flex-direction: column; gap: 8px; }
  .demo-settings-heading { display: grid; gap: 4px; }
  .demo-scope-row { grid-template-columns: 78px 1fr; }

  .demo-toast { position: fixed; left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .demo-hint { font-size: 11px; }
}
