:root {
  color-scheme: light dark;
  --page: #fbf7ed;
  --panel: #ffffff;
  --ink: #183748;
  --muted: #4b5f66;
  --line: #d7dfd5;
  --accent: #183748;
  --accent-ink: #ffffff;
  --link: #245e60;
  --focus: #b8770f;
  --plate: #f6eedf;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0e1920;
    --panel: #15232c;
    --ink: #e9eff1;
    --muted: #b3c1c6;
    --line: #2d3f4a;
    --accent: #f3dcae;
    --accent-ink: #183748;
    --link: #8fd3cd;
    --focus: #f2b84b;
    --plate: #fbf7ed;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--link); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -0.4px; line-height: 1.2; }
.brand span { display: block; font-size: 12px; font-weight: 450; letter-spacing: 0.2px; color: var(--muted); }
nav { display: flex; flex-wrap: wrap; gap: 0 18px; }
nav a { display: inline-block; padding: 4px 0; }
nav a[aria-current="page"] { color: var(--ink); font-weight: 650; }

main { max-width: 1120px; margin: 0 auto; padding: 24px; }
h1 { margin: 0 0 20px; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }

.panels {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.panel {
  min-width: 0;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.panel-small { padding: 24px; }
.panel-small h2 { margin: 0 0 8px; font-size: 18px; line-height: 1.3; }
.empty-text { margin: 0; color: var(--muted); }
.empty-text strong { color: var(--ink); }

/* The first-use empty state: image, heading, one or two sentences, one action. */
.empty { max-width: 440px; min-height: 386px; margin: 0 auto; text-align: center; }
.empty-art {
  display: inline-block;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--plate);
  border-radius: 16px;
}
.empty-art img { display: block; width: clamp(168px, 56vw, 264px); height: auto; }
.empty h2 { margin: 0 0 8px; font-size: 22px; line-height: 1.25; }
.empty p { margin: 0 0 20px; color: var(--muted); }

button {
  min-height: 44px;
  padding: 10px 18px;
  font: inherit;
  border-radius: 8px;
  cursor: pointer;
}
.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); font-weight: 650; }
.secondary { background: transparent; color: var(--ink); border: 1px solid currentColor; }

.status { margin: 0; color: var(--muted); }
/* The loading message and the first-use state share one minimum height, a little more than the state's tallest
   measured height (357-385 px at the widths tested), so the panel keeps its height when the load finishes. */
.status:not(.vh) { display: grid; place-items: center; min-height: 386px; }
.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The list, shown once there is at least one document. */
.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.list-head h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.search { display: grid; gap: 4px; margin-bottom: 16px; }
.search label { font-size: 14px; font-weight: 600; }
.search input {
  width: 100%;
  max-width: 360px;
  min-height: 44px;
  padding: 9px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--muted);
  border-radius: 8px;
}
.documents { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.documents li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.doc-text { display: grid; flex: 1; min-width: 0; }
.doc-name { font-weight: 600; overflow-wrap: anywhere; }
.doc-meta { font-size: 14px; color: var(--muted); }
.remove {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--muted);
}

/* The no-results message: text only, smaller than the first-use state. */
.no-results p { margin: 0; color: var(--muted); }
.no-results p:not(:empty) { margin: 16px 0 12px; }

footer { max-width: 1120px; margin: 0 auto; padding: 8px 24px 32px; font-size: 13px; color: var(--muted); }
footer p { margin: 0; }

@media (max-width: 760px) {
  .app-header { padding: 12px 16px; }
  main { padding: 16px; }
  h1 { margin-bottom: 14px; font-size: 24px; }
  .panels { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .panel { padding: 20px 16px; }
  footer { padding: 8px 16px 24px; }
}
