/* Bundled font: phones and desktops use the same sketch lettering. */
@font-face {
  font-family: "Patrick Hand";
  src: url("fonts/PatrickHand-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  font-family: "Patrick Hand", sans-serif;
}
/* This heading receives focus for screen readers when returning to the menu.
   Visible keyboard focus remains enabled on interactive controls. */
#intro-title:focus {
  outline: none;
}
body {
  font-size: 16px;
}
.workspace {
  max-width: 1500px;
  margin: auto;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 2rem;
  border-bottom: 1.5px solid #333;
}
.brand {
  font-size: 1.3rem;
  margin-right: auto;
}
.icon-button {
  display: grid;
  place-items: center;
  padding: 0.5rem;
  min-width: 44px;
  border: 0;
}
.icon-button svg {
  width: 25px;
  height: 25px;
}
.menu-wrap {
  position: relative;
}
#app-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  z-index: 20;
  width: 245px;
  padding: 0.65rem;
  background: white;
  border: 1.5px solid #333;
  box-shadow: 3px 3px 0 #ddd;
}
#app-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
}
#app-menu small {
  display: block;
  border-top: 1px dashed #999;
  margin-top: 0.5rem;
  padding: 0.65rem;
}
.relation {
  border: 0;
  border-bottom: 1px dashed #777;
  border-radius: 0;
  padding: 0.25rem 0.1rem;
  background: transparent;
  text-align: left;
}
.tags .relation {
  padding: 0.4rem 0.6rem;
  background: #eee;
}
.recent {
  margin: 1.5rem 0;
}
.recent-items {
  display: flex;
  gap: 0.7rem 1.25rem;
  flex-wrap: wrap;
}
.main {
  min-width: 0;
  padding: 1.5rem 2rem 2rem;
}
footer {
  border-top: 1px dashed #aaa;
  padding-top: 1rem;
  margin-top: 2rem;
  font-size: 0.8rem;
  color: #666;
}
.intro {
  max-width: 810px;
}
.intro h1 {
  font-size: clamp(1.8rem, 4vw, 2.65rem);
}
.intro-foot {
  display: block;
  margin-top: 2rem;
}
.hero {
  margin-bottom: 1.2rem;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: #666;
}
.hero h1 {
  margin: 0.3rem 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}
.hero p {
  margin: 0.4rem 0;
}
.portrait {
  width: 78px;
  height: 78px;
  border: 2px solid #333;
  border-radius: 45% 48% 43% 46%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: #f6f6f6;
  flex-shrink: 0;
}
.identity {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.tags {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0.6rem 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1.2rem 0;
}
.stat {
  border-bottom: 2px solid #555;
  padding: 0.6rem;
}
.stat strong {
  display: block;
  font-size: 1.7rem;
}
.stat small {
  font-size: 0.82rem;
}
.dossier-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
.card {
  padding: 1.1rem;
}
.card h2 {
  font-size: 1.22rem;
}
.card h3 {
  margin-top: 0.6rem;
}
.card p {
  font-size: 0.97rem;
}
.claim {
  border-left: 3px solid #444;
  padding: 0.4rem 0 0.4rem 0.8rem;
  margin: 1rem 0;
}
.claim blockquote {
  margin: 0.3rem 0 0.8rem;
}
.cite {
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  text-align: left;
}
.note {
  border-bottom: 1px dashed #aaa;
  padding: 0.7rem 0;
}
.note small {
  display: block;
}
.note p {
  margin-top: 0.4rem;
}
.case-row {
  padding: 0.8rem 0;
  border-bottom: 1px dashed #aaa;
}
.case-row strong {
  display: block;
}
.case-row .row {
  align-items: start;
}
.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}
.filters {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.filters label {
  flex: 1;
  min-width: 130px;
}
.filters select {
  width: 100%;
}
.link {
  border: 0;
  border-bottom: 1px dashed #888;
  border-radius: 0;
  padding: 0.4rem 0;
  text-align: left;
  background: transparent;
}
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}
.source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1rem;
}
.transcript {
  background: #fafafa;
}
.transcript p {
  font-family: Georgia, serif;
  line-height: 1.9;
}
.passage {
  background: #e9e9e9;
  border-left: 3px solid #444;
  padding: 0.8rem;
}
.source-meta {
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.dropzone {
  text-align: center;
  border: 2px dashed #555;
  padding: 1.8rem 1rem;
}
.dropzone.dragging {
  background: #eee;
}
.dropzone input {
  width: 100%;
  margin: 0.7rem 0;
}
.tabs {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.tabs button[aria-pressed="true"] {
  background: #e7e7e7;
}
.activity-history {
  font-size: 0.9rem;
  padding-left: 1.2rem;
}
.activity-history li {
  margin: 0.5rem 0;
}
.member {
  padding: 0.8rem 0;
  border-bottom: 1px dashed #999;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  background: #f4f4f4;
  padding: 1rem;
}
label input {
  width: 100%;
}
.screen-heading {
  margin-bottom: 1.2rem;
}
.screen-heading small {
  display: block;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.mini-bars {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0;
}
.mini-bars span {
  display: block;
  border-bottom: 5px solid #aaa;
  padding-bottom: 0.25rem;
}
@media (max-width: 1000px) {
  .main {
    padding: 1.2rem;
  }
  .dossier-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .topbar {
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
  }
  .brand {
    font-size: 0.95rem;
  }
  .topbar #global-add {
    font-size: 0.82rem;
    padding: 0.4rem 0.55rem;
  }
  .main {
    padding: 1rem;
  }
  .stats {
    gap: 0.35rem;
  }
  .stat {
    padding: 0.4rem 0.15rem;
  }
  .stat strong {
    font-size: 1.4rem;
  }
  .stat small {
    font-size: 0.72rem;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .identity {
    align-items: start;
  }
  .portrait {
    width: 55px;
    height: 55px;
    font-size: 1.4rem;
  }
  .search-form {
    grid-template-columns: 1fr;
  }
  .source-grid {
    display: block;
  }
  .source-grid > * {
    margin-bottom: 1rem;
  }
}

.example-question {
  margin-top: 1.5rem;
  max-width: 760px;
}

.top-search {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  width: min(300px, 30vw);
}
.top-search input {
  width: 100%;
  min-width: 0;
}
@media (max-width: 640px) {
  .topbar:has(.top-search:not([hidden])) {
    flex-wrap: wrap;
  }
  .topbar:has(.top-search:not([hidden])) .brand {
    flex: 1;
  }
  .top-search {
    flex: 1;
    width: auto;
    min-width: 130px;
  }
  .topbar:has(.top-search:not([hidden])) .brand {
    display: none;
  }
}

.search-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 2.5rem;
  align-items: start;
}
.search-layout > * {
  min-width: 0;
}
.search-layout .recent {
  margin: 0;
  padding-left: 1.5rem;
  border-left: 1px dashed #aaa;
}
.search-layout .recent-items {
  display: grid;
  gap: 0.4rem;
  justify-items: start;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
  align-items: start;
}
.result-card {
  min-width: 0;
}
.result-heading {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.6rem;
}
.result-heading h2 {
  margin: 0;
  flex: 1;
}
.result-title {
  font-weight: bold;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.15rem 0;
  min-height: 44px;
}
.result-title:hover {
  text-decoration: underline;
  background: transparent;
}
.result-open {
  flex-shrink: 0;
}
@media (max-width: 800px) {
  .search-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .search-layout .recent {
    border-left: 0;
    padding-left: 0;
  }
  .search-layout .recent-items {
    display: flex;
    flex-wrap: wrap;
  }
}
@media (max-width: 640px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
}

.dropzone {
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  border: 2px dashed #888;
  border-radius: 12px;
  padding: 2rem 1rem;
  background: #fafafa;
}
.dropzone h2 {
  margin: 0;
}
.upload-icon {
  width: 48px;
  height: 48px;
}
.dropzone.dragging {
  background: #e9e9e9;
  border-color: #222;
}
.upload-queue {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}
.upload-queue li {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #aaa;
  padding: 0.65rem 0;
}
.upload-queue span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.upload-queue small {
  display: block;
}
.upload-queue button {
  border: 0;
  font-size: 1.35rem;
}
.upload-error:empty {
  display: none;
}

.upload-layout {
  max-width: 960px;
}
.dropzone p {
  margin: 0;
}

a.record-link {
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
a.record-link.sketch {
  background: white;
  padding: 0.55rem 1rem;
  border: 1.5px solid #202020;
  border-radius: 3px 8px 4px 6px;
}
a.record-link.sketch.has-outline {
  border-color: transparent;
}
a.record-link:hover {
  background: #f0f0f0;
}
a.record-link.result-title {
  font-weight: bold;
  background: transparent;
  padding: 0.15rem 0;
}
a.record-link.result-title:hover {
  text-decoration: underline;
}
a.record-link.icon-button {
  display: grid;
}
#app-menu a {
  display: flex;
  width: 100%;
  padding: 0.55rem 1rem;
}

.receipt-card {
  max-width: 800px;
}
.receipt-files {
  padding-left: 1.3rem;
  overflow-wrap: anywhere;
  margin: 1rem 0;
}

.home-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
#home-switch {
  display: none;
}
@media (max-width: 800px) {
  #home-switch {
    display: block;
  }
  .search-layout .recent {
    display: none;
  }
  #view[data-home-view="recent"] #search-controls,
  #view[data-home-view="recent"] #search-results {
    display: none;
  }
  #view[data-home-view="recent"] .recent {
    display: block;
  }
  #view[data-home-view="recent"] .recent h2 {
    display: none;
  }
}

/* Simulated external chat: message history and a pinned composer. */
.chat-preview {
  max-width: 900px;
  margin-top: 2rem;
  border: 1.5px solid var(--ink);
  background: white;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.chat-history {
  max-height: 480px;
  overflow-y: auto;
  padding: 1.25rem;
  overscroll-behavior: contain;
}
.chat-message {
  margin-bottom: 1.5rem;
}
.chat-message p {
  margin: 0.5rem 0;
}
.chat-user {
  max-width: 85%;
  margin-left: auto;
  padding: 0.6rem 1rem;
  background: #ededed;
  border-radius: 14px 14px 2px 14px;
}
.chat-composer {
  margin: 0 1.25rem 1.25rem;
  padding: 0.75rem;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
}
.chat-composer textarea {
  border: 0;
  width: 100%;
  resize: vertical;
  padding: 0.25rem;
  min-height: 72px;
}
.chat-composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
#chat-send {
  width: 44px;
  height: 44px;
  padding: 9px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
}
#chat-send svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-sources {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}
.chat-sources a {
  width: fit-content;
}
@media (max-width: 640px) {
  .chat-history {
    max-height: 380px;
    padding: 1rem;
  }
  .chat-composer {
    margin: 0 0.75rem 0.75rem;
  }
  .chat-header {
    padding: 0.75rem 1rem;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ai-setup {
  max-width: 900px;
}
.chat-sources a {
  color: inherit;
}

/* The copied prompt hands the demo off to a separate external-chat window. */
.external-chat .topbar,
.external-chat #app-status {
  display: none;
}
.external-chat .main {
  max-width: 1000px;
  margin: auto;
  padding: 1.5rem;
  animation: chat-window-enter 240ms ease-out;
}
.chat-window-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--ink);
  border-bottom: 0;
  background: #f5f5f5;
}
.external-chat .chat-preview {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  max-width: none;
  height: max(550px, calc(100dvh - 160px));
}
.external-chat .chat-history {
  flex: 1;
  max-height: none;
}
.external-chat .chat-composer {
  flex-shrink: 0;
}
@keyframes chat-window-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 640px) {
  .external-chat .main {
    padding: 0.75rem;
  }
  .external-chat .chat-preview {
    height: max(500px, calc(100dvh - 150px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .external-chat .main {
    animation: none;
  }
}

/* In-demo file picker: sample documents, no native OS dialog. */
#file-picker-dialog {
  box-shadow: 5px 5px 0 rgb(0 0 0 / 18%);
}
#file-picker-dialog::backdrop {
  background: rgb(0 0 0 / 40%);
}
@media (max-width: 640px) {
  #file-picker-dialog {
    width: calc(100% - 32px);
    max-height: calc(100dvh - 48px);
    height: fit-content;
    margin: auto;
    border-radius: 8px 4px 9px 5px;
  }
}
.picker-location {
  padding: 0.5rem 0.75rem;
  background: #f1f1f1;
}
.picker-files {
  border: 1px solid var(--line);
}
.picker-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.picker-file:last-child {
  border-bottom: 0;
}
.picker-file:has(input:checked) {
  background: #ededed;
}
.picker-file input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  flex-shrink: 0;
  accent-color: var(--ink);
}
.picker-file span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.picker-file small {
  display: block;
}
.picker-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
