:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --panel: #fffdfa;
  --ink: #1e2724;
  --muted: #65716c;
  --line: #d9d4c9;
  --accent: #4f817c;
  --accent-2: #c97e66;
  --shadow: 0 18px 44px rgba(30, 39, 36, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
textarea,
input {
  font: inherit;
}

.shell {
  width: calc(100% - 48px);
  max-width: 1680px;
  margin: 0 auto;
  padding: 28px 0 44px;
}

.document-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.document-intro p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.overall-score {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 10px;
  min-width: min(100%, 420px);
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 7px;
  background: #e9f0ec;
  color: #274943;
}

.overall-score span {
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: lowercase;
}

.overall-score strong {
  font-size: 22px;
  font-weight: 950;
  line-height: .95;
}

.overall-score em {
  flex-basis: 100%;
  color: #4e625d;
  font-size: 11px;
  font-style: normal;
  font-weight: 760;
  line-height: 1.25;
  text-align: right;
}

.local-intake {
  display: grid;
  gap: 14px;
  margin-top: 26px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(30, 39, 36, .05);
}

.intake-copy {
  display: grid;
  gap: 4px;
}

.intake-copy h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: lowercase;
}

.intake-copy p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.dropzone {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 7px;
  background: #f8f5ee;
}

.dropzone.drag-active,
.dropzone:focus-within {
  border-color: var(--accent);
  background: #f4f1ea;
}

.dropzone textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fffdfa;
  color: var(--ink);
  line-height: 1.35;
}

.dropzone textarea::placeholder {
  color: #7f8884;
}

.intake-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.file-inline,
.intake-controls button,
.vault-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdfa;
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.intake-controls button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.file-inline input {
  display: none;
}

.pending-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.pending-list span,
.pending-action {
  max-width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 999px;
  background: #ebe6dc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.pending-action {
  background: #fffdfa;
  color: var(--accent);
  cursor: pointer;
}

.vault-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  justify-content: stretch;
  align-items: start;
  gap: 18px;
}

.document-bank {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.source-documents {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 420px));
  justify-content: center;
  align-items: start;
  gap: 18px;
  padding-top: 4px;
}

.vault-empty {
  margin: 0;
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.sync-status {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: lowercase;
}

.vault-item,
.source-document {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdfa;
  box-shadow: 0 10px 28px rgba(30, 39, 36, .055);
}

.source-document {
  color: var(--ink);
}

.vault-thumb {
  width: 100%;
  aspect-ratio: 4 / 3.35;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2eee6;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  overflow: hidden;
  text-decoration: none;
}

.vault-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.vault-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.vault-title {
  margin: 0;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.autism-score,
.adhd-score {
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 5px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: 6px;
  background: #e9f0ec;
  color: #274943;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: lowercase;
}

.adhd-score {
  border-color: color-mix(in srgb, #214f8f 38%, var(--line));
  background: #e8eef8;
  color: #214f8f;
}

.autism-score-why,
.adhd-score-why {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.28;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.autism-signal {
  margin: 0;
  color: #6f3a41;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.28;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.autism-signal strong {
  color: #8f3d4b;
  font-weight: 900;
}

.adhd-signal {
  color: #264c7f;
}

.adhd-signal strong {
  color: #214f8f;
}

.vault-meta,
.vault-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.vault-text {
  max-width: 760px;
}

.score-citations {
  margin-top: 24px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}

.score-citations h2 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: lowercase;
}

.basis-list {
  display: grid;
  gap: 8px;
  max-width: 1040px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.38;
}

.basis-list li {
  padding-left: 3px;
}

.basis-list a {
  color: #315d58;
  font-weight: 850;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.vault-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.vault-actions button,
.source-action {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12px;
  text-decoration: none;
}

.source-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdfa;
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  text-transform: lowercase;
}

.vault-actions .danger {
  color: #9d4f46;
}

@media (max-width: 720px) {
  .shell {
    width: min(calc(100vw - 24px), 360px);
    max-width: min(calc(100vw - 24px), 360px);
    margin-left: 12px;
    margin-right: auto;
    padding-top: 28px;
    overflow-x: hidden;
  }

  .local-intake {
    padding: 12px;
  }

  .document-intro {
    display: grid;
    gap: 10px;
  }

  .overall-score {
    justify-content: flex-start;
    min-width: 0;
  }

  .overall-score em {
    text-align: left;
  }

  .vault-list,
  .source-documents {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }
}
