:root {
  --ink: #15334d;
  --blue: #1265a8;
  --bg: #f2f7fb;
  --line: #b9ccda;
  --focus: #a35a00;
  --text: 16px;
  --small: 14px;
  --meta: 16px;
  --title: 20px;
  --control: 44px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--text)/1.45 Arial, sans-serif;
}
main { max-width: 1120px; padding: 24px 20px 40px; margin: auto; }
header, .selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
h1 { margin: 0; font-size: 28px; line-height: 1.2; }
h2 { margin: 0 0 16px; font-size: 22px; line-height: 1.3; }
section { margin-top: 24px; }
a { color: var(--blue); text-underline-offset: 3px; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
nav a { font-size: var(--text); }
a.quiet { font-size: var(--text); }

button, .action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control);
  padding: 9px 16px;
  border: 2px solid var(--blue);
  border-radius: 6px;
  background: var(--blue);
  color: white;
  font: 700 var(--text)/1.3 Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.secondary { background: white; color: var(--blue); }
.textbutton {
  min-height: var(--control);
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: var(--text);
  font-weight: 400;
  text-decoration: underline;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.people { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.people button {
  justify-content: flex-start;
  min-height: var(--control);
  padding: 9px 16px;
  background: white;
  color: var(--blue);
  font-size: var(--title);
  text-align: left;
}
.people button[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: white; }
.people button.group { font-size: 18px; }

.finder { padding: 20px 22px; border-top: 4px solid var(--blue); background: white; }
.selection { margin-bottom: 16px; align-items: flex-start; }
.selection h2 { margin: 6px 0; }
.searchline { display: flex; gap: 10px; margin-top: 8px; }
input, select {
  min-width: 0;
  min-height: var(--control);
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font: var(--text)/1.3 Arial, sans-serif;
}
.searchline input { flex: 1; width: 100%; }
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px 24px;
  margin-top: 14px;
}
.filters label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters input { width: 120px; }
.filters input[type=month] { width: 190px; }
.notice { padding: 12px 14px; border-left: 4px solid var(--focus); background: #fff5e2; }
.login { max-width: 650px; }
.login input[type=password], .login input[type=text] { display: block; width: 100%; margin-top: 8px; }
.login input[type=checkbox] { width: 24px; min-height: 24px; vertical-align: middle; margin-right: 8px; }
#files { display: block; width: 100%; margin-top: 10px; }
#upload-results { margin-top: 18px; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.clipboard-field { position: fixed; left: -10000px; top: 0; }
#access-cards input { width: 100%; max-width: 100%; margin-top: 14px; }
#access-cards .record { overflow-wrap: anywhere; }

.result-heading { margin: 24px 0 10px; font-size: 20px; line-height: 1.3; }
.result-collapse { margin-top: 20px; padding-top: 14px; border-top: 2px solid var(--line); }
.result-collapse > summary { padding: 8px 0; font-size: 18px; font-weight: 700; cursor: pointer; }
.record { padding: 18px 0; border-top: 1px solid var(--line); }
.record h3 { margin: 6px 0 10px; font-size: var(--title); line-height: 1.3; overflow-wrap: anywhere; }
.meta { margin: 0; color: #36566c; font-size: var(--meta); }
.record .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.record .context { margin: 6px 0; color: #36566c; font-size: var(--meta); }
.date-facts { margin: 2px 0 10px; }
.date-facts p { margin: 3px 0; color: var(--ink); font-size: var(--meta); font-weight: 700; line-height: 1.4; }
.date-details { margin-top: 4px; }
.date-details summary, .why summary { color: var(--blue); font-size: 15px; cursor: pointer; }
.date-details p { margin: 4px 0 0; font-size: 15px; }
.excerpt { max-width: 76ch; font-size: 15px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.record .excerpt { padding: 10px; background: var(--bg); }
.why { margin-top: 12px; }
.why summary { font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions a.secondary { font-weight: 400; }
.pending { color: #754000; font-size: var(--small); }
.loading { opacity: .7; }
#status { margin: 18px 0; font-size: var(--text); }
.app-help { margin: 10px 0 0; font-size: 14px; }

dialog {
  width: calc(100% - 32px);
  max-width: 1180px;
  height: 92vh;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
dialog::backdrop { background: rgba(10, 30, 45, .65); }
.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.viewer-head h2 { margin: 0; font-size: 22px; }
#preview-frame { width: 100%; height: calc(100% - 150px); min-height: 260px; border: 1px solid var(--line); }

@media (max-width: 820px) {
  .people { grid-template-columns: repeat(2, 1fr); }
  header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .finder { padding: 18px; }
}
@media (max-width: 540px) {
  main { padding: 20px 12px 32px; }
  .people { grid-template-columns: 1fr; }
  .selection { flex-direction: column; gap: 6px; }
  .searchline { flex-direction: column; }
  .filters { align-items: flex-start; flex-direction: column; }
  .filters label { width: 100%; align-items: flex-start; }
  .filters select, .filters input[type=month] { width: 100%; }
  .actions { flex-direction: column; }
  .actions > *, .action { width: 100%; }
  h1 { font-size: 28px; }
  .viewer-head { align-items: flex-start; flex-direction: column; }
  dialog { width: calc(100% - 12px); padding: 12px; }
  #preview-frame { height: calc(100% - 205px); }
}
