@font-face {
  font-family: Manrope;
  src: url('/fonts/manrope.ttf') format('truetype');
  font-weight: 200 800;
  font-display: swap;
}

body.intake-page {
  margin: 0;
  background: #f2ecdc;
  color: #25352d;
  font: 16px/1.52 Manrope, "Segoe UI", sans-serif;
}

.work-frame > main#main.intake {
  --ink: #21342b;
  --muted: #506254;
  --rule: #bbc1b1;
  --deep: #204133;
  --sheet: #f8f5eb;
  --display: var(--brand-serif, Georgia, serif);
  min-width: 0;
  padding: clamp(22px, 2.9vw, 46px) clamp(18px, 3.1vw, 54px) 52px;
  background: linear-gradient(120deg, #1d3329f0 3%, #273c31e8 64%, #20372df0), url('/landing/felt.webp') center top / 980px auto repeat;
  color: var(--ink);
  accent-color: var(--deep);
  overflow-wrap: anywhere;
}

.work-frame > main#main.intake::after { display: none; }
.intake *, .intake *::before, .intake *::after { box-sizing: border-box; }
.intake [hidden] { display: none !important; }
.intake h1, .intake h2, .intake h3, .intake p, .intake ul { margin: 0; }
.intake :is(button, input, textarea) { font: inherit; }
.intake a { color: inherit; text-underline-offset: .18em; }
.intake button { cursor: pointer; }
.intake button:disabled { cursor: not-allowed; }
.intake :focus-visible { outline: 3px solid #a27528; outline-offset: 3px; }
.intake-header, .intake-columns, .analysis-sheet, #plan-reference {
  width: 100%;
  max-width: 1390px;
  margin-inline: auto;
}
.intake-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(24px, 2.4vw, 37px);
}
.intake .intake-back {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  color: #e1e4d6;
  font-size: 15px;
  text-decoration: none;
}
.intake-back::before { content: '←'; }
.intake-back:hover { text-decoration: underline; }
.intake h1 {
  margin-top: 8px;
  color: #fff7e6;
  font: 400 clamp(37px, 4.7vw, 72px)/1.06 var(--display);
  letter-spacing: -.05em;
}
.save-tools { display: grid; justify-items: end; gap: 6px; }
.intake .notice, .intake #plan-reference { color: #eceddc; font-size: 15px; }
.intake #plan-reference { margin-block: -7px 18px; }
.intake #plan-reference a { font-weight: 720; }
.intake #plan-reference.differs {
  color: #fff1cd;
  border-inline-start: 3px solid #d6b777;
  padding-inline-start: 10px;
}

.intake-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.43fr) minmax(280px, 1fr);
  align-items: start;
  gap: clamp(17px, 1.7vw, 28px);
}
.intake-sheet, .intake-conversation, .analysis-sheet {
  min-width: 0;
  padding: clamp(21px, 2vw, 34px);
  border: 1px solid #d7d3c3;
  border-radius: 3px;
  background: linear-gradient(120deg, #fdfbf2f2, #f6f2e5f2), url('/landing/grain.svg') repeat, var(--sheet);
  box-shadow: 0 2px 0 #bbbaa7, 0 10px 22px #13271c25;
}
.intake-conversation {
  background: linear-gradient(120deg, #f2f3e9f5, #e9eddef5), url('/landing/grain.svg') repeat, #edf0e4;
  border-color: #c6cebc;
}
.sheet-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.intake h2 {
  color: #24382d;
  font: 400 clamp(25px, 2.05vw, 34px)/1.15 var(--display);
  letter-spacing: -.035em;
}
.intake label {
  display: block;
  margin: 17px 0 6px;
  color: #29382f;
  font-size: 17px;
  font-weight: 720;
}
.intake-sheet .sheet-header + label { margin-top: 0; }
.intake input:not([type=file]), .intake textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 47px;
  border: 1px solid #949e8f;
  border-radius: 4px;
  padding: 10px 13px;
  background: #fffdf5;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
}
.intake textarea { min-height: 78px; resize: vertical; }
.intake input::placeholder, .intake textarea::placeholder { color: #58655c; opacity: 1; }
.intake input:not([type=file]):focus, .intake textarea:focus {
  outline: 2px solid #4f7460;
  outline-offset: 1px;
  border-color: #375b49;
}
.intake .outline, .intake .primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 17px;
  border: 1px solid #7e8c79;
  border-radius: 4px;
  background: #f8f8ed;
  color: #294232;
  font-size: 16px;
  font-weight: 690;
  line-height: 1.4;
  text-align: center;
}
.intake .primary { background: var(--deep); border-color: var(--deep); color: #fffbed; }
.intake .primary:hover:enabled { background: #315742; }
.intake .outline:hover:enabled { background: #e0e7da; }
.intake .primary:disabled { background: #d9dece; border-color: #bfc7b7; color: #4c5a4e; }
.intake .outline:disabled { background: #e6e9dc; border-color: #c1c7b8; color: #505f53; }
.intake .save-tools .outline {
  background: #f0e6cc;
  color: #28382b;
  border-color: #e3d6b5;
}
.intake .save-tools .outline:hover:enabled { background: #fff1cb; }
.intake .save-tools .outline:disabled {
  background: #2c4337;
  border-color: #7f9381;
  color: #d7e0cd;
}

.drop-area {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 17px;
  border: 1px dashed #7b8e79;
  border-radius: 4px;
  background: #eaf0e2;
}
.drop-area strong { font-size: 17px; font-weight: 720; }
.drop-hint { color: #3c5444; font-weight: 500; }
.drop-area small { display: block; margin-top: 2px; color: #536055; font-size: 14px; }
.drop-area input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-area.hover, .drop-area:focus-within, .drop-area:hover:not(:has(input:disabled)) {
  background: #e2ebd9;
  border-color: #425f49;
}
.drop-area:focus-within, .drop-area.hover { outline: 2px solid #50705a; outline-offset: 2px; }
.drop-area:has(input:disabled) { opacity: .72; }
.drop-area input:disabled { cursor: wait; }
.file-outline {
  position: relative;
  flex: none;
  width: 24px;
  height: 30px;
  border: 1.6px solid #526b53;
  border-radius: 2px 6px 2px 2px;
  box-shadow: 3px 3px 0 #d1dac7;
  background: #fbfbef;
}
.file-outline::before, .file-outline::after {
  content: '';
  position: absolute;
  inset: auto 4px 8px;
  border-bottom: 1px solid #6a806a;
}
.file-outline::after { bottom: 13px; }
#file-list { max-height: 200px; overflow-y: auto; list-style: none; padding: 0; }
#file-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid #d6d8c8; }
#file-list small { color: var(--muted); font-size: 14px; }
#file-list button { border: 0; background: none; color: var(--ink); }
#file-list button.open-file { min-width: 0; flex: 1; padding: 9px 2px; text-align: left; font-size: 16px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
#file-list button:last-child { width: 42px; height: 42px; font-size: 24px; }
#file-list button:hover { background-color: #e8ecde; }
.analysis-action, .analysis-footer, .send-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 13px;
  margin-top: 18px;
}
.intake :is(.analysis-action, .analysis-footer, .send-row) [role=status] { color: var(--muted); font-size: 15px; }
.intake [role=status]:empty { display: none; }
.intake [data-error=true] { color: #883c28 !important; }
.intake-header [data-error=true] { color: #ffd2be !important; }

.messages {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 68px;
  max-height: min(42vh, 390px);
  overflow-y: auto;
  scrollbar-color: #9eab99 transparent;
  padding: 1px 2px 18px;
  overscroll-behavior: contain;
}
.chat-empty { max-width: 39ch; font-size: 17px; line-height: 1.55; color: #435647; }
.chat-entry { display: grid; gap: 5px; max-width: 97%; align-self: flex-start; font-size: 17px; line-height: 1.55; }
.chat-entry b { color: #415647; font-size: 14px; }
.chat-entry p { white-space: pre-wrap; }
.chat-entry.user { align-self: flex-end; margin-left: 12px; }
.chat-entry.user b { text-align: right; }
.chat-entry.user p { padding: 8px 13px; background: #dbe3d2; border-radius: 7px 2px 7px 7px; }
#question-form { border-top: 1px solid var(--rule); padding-top: 16px; }
.send-row { justify-content: flex-end; margin-top: 10px; }
.send-row [role=status] { margin-right: auto; }
.reply-references { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; color: var(--muted); }
.reply-references small { font-size: 14px; }
.retry-question { border: 0; background: none; text-decoration: underline; color: #30563b; padding: 4px 0; }

.analysis-sheet { margin-top: 24px; }
.analysis-header { margin-bottom: 15px; }
.analysis-header p { color: var(--muted); font-size: 15px; margin-top: 7px; }
.intake .outdated { margin-block: 10px; padding: 9px 13px; background: #f2e8cb; color: #624e25; border-inline-start: 3px solid #b69651; }
.analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.analysis-part { border-top: 1px solid var(--rule); padding: 15px 0; }
.intake h3 { margin: 0 0 8px; font: 700 18px/1.35 Manrope, sans-serif; }
.analysis-part ul, .source-list { padding-inline-start: 21px; font-size: 16px; }
.analysis-part li + li, .source-list li + li { margin-block-start: 7px; }
.analysis-part li::marker { color: #657e62; }
.intake details { border-top: 1px solid var(--rule); padding: 10px 0; }
.intake summary { cursor: pointer; font-size: 16px; font-weight: 700; }
.intake .source-list { margin-block: 8px 0; }
.intake .source-ref { border: 1px solid #c5cdbb; border-radius: 3px; background: #e8edde; color: #2e4e37; padding: 1px 6px; font-size: 14px; }
.intake .source-ref:hover { text-decoration: underline; }
.intake .source-dialog {
  box-sizing: border-box;
  width: min(760px, 94vw);
  max-height: 87dvh;
  border: 1px solid #99ab94;
  border-radius: 5px;
  padding: clamp(17px, 2vw, 26px);
  background: #faf7ee;
  color: var(--ink);
  box-shadow: 0 20px 65px #142b2345;
  overscroll-behavior: contain;
}
.source-dialog::backdrop { background: #1c3028af; }
.dialog-heading, .source-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-heading h2 { min-width: 0; overflow-wrap: anywhere; }
.source-nav { flex-wrap: wrap; color: var(--muted); font-size: 15px; }
.source-excerpt { max-height: 48dvh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #f0eee2; border: 1px solid #c5cabb; padding: 12px; font: 15px/1.55 Consolas, monospace; tab-size: 3; }
.source-excerpt span { display: block; }
.source-target { background: #e9dba8; color: #362f1e; }
.route-diagram { padding: 15px; margin: 0 0 14px; border: 1px solid #c4cdbb; border-radius: 4px; background: #eef1e5; }
.intake .route-flow { display: flex; flex-wrap: wrap; align-items: center; list-style: none; gap: 8px 21px; margin: 10px 0 6px; padding: 0; }
.route-flow li { position: relative; padding: 5px 9px; border: 1px solid #8e9f88; border-radius: 3px; color: #2b4431; background: #fcfaf0; font-size: 15px; font-weight: 660; }
.route-flow li + li::before { content: '→'; position: absolute; left: -18px; top: 50%; transform: translateY(-50%); color: #536d54; }
.intake .route-proof { list-style: none; padding: 0; font-size: 14px; color: var(--muted); }
.intake .sr-only { position: absolute; overflow: hidden; clip-path: inset(50%); width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; }
.skip-link { position: absolute; z-index: 40; top: -8em; left: 10px; padding: 8px 12px; color: #253b2c; background: #fff7de; }
.skip-link:focus { top: 6px; }

@media (max-width: 1060px) {
  .intake-columns { grid-template-columns: minmax(0, 1.22fr) minmax(270px, 1fr); gap: 16px; }
  .intake-sheet, .intake-conversation, .analysis-sheet { padding: 20px; }
}
@media (max-width: 850px) {
  .intake-columns { grid-template-columns: 1fr; }
  .analysis-grid { grid-template-columns: 1fr; }
  .messages { max-height: 340px; }
}
@media (max-width: 560px) {
  .work-frame > main#main.intake { padding: 20px 12px 32px; }
  .intake-header { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 18px; }
  .intake h1 { font-size: clamp(36px, 9vw, 46px); }
  .save-tools { justify-items: start; }
  .intake h2 { font-size: 25px; }
  .intake-sheet, .intake-conversation, .analysis-sheet { padding: 17px 15px; }
  .sheet-header { padding-bottom: 12px; margin-bottom: 15px; }
  .drop-area { gap: 11px; padding: 13px; }
  .drop-hint { display: none; }
  .analysis-action, .analysis-footer { align-items: flex-start; flex-direction: column; }
  .intake .primary { width: 100%; }
  .dialog-heading { align-items: flex-start; }
  .source-nav { gap: 7px; }
}
.erp-panel{margin:.8rem 0 1rem;border-block:1px solid #b8b2a2;padding:.75rem 0;color:#253c30}
.erp-panel summary{width:fit-content;cursor:pointer;font-weight:650;touch-action:manipulation}
.erp-panel p{max-width:48ch;margin:.65rem 0;font-size:.9rem;line-height:1.45}
.erp-download{color:#29523c;text-underline-offset:.2em;font-weight:650;font-size:.9rem}
.erp-actions{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem;margin:.7rem 0}
.erp-actions input{min-width:7rem;flex:1}
.erp-panel small{display:block;line-height:1.45}
.erp-panel small[data-error="true"]{color:#963a29}
.erp-panel [hidden]{display:none}

.inference-info{margin:0 0 12px;color:#f4efde;font-size:16px}.inference-info>summary{cursor:pointer;width:fit-content}.inference-info p{max-width:72ch}.inference-info a{color:inherit;text-decoration:underline}
