:root {
  color-scheme: light;
  --ink: #15191b;
  --muted: #59616a;
  --subtle: #6a727b;
  --line: #e4e8ea;
  --line-strong: #c9cfd4;
  --surface: #ffffff;
  --surface-soft: #f7f9f9;
  --surface-hover: #f1f6f6;
  --accent: #0a757d;
  --accent-dark: #085f66;
  --accent-soft: #e8f5f5;
  --blue: #2563eb;
  --blue-soft: #edf4ff;
  --amber: #9a6400;
  --amber-soft: #fff8e6;
  --red: #b23a34;
  --red-soft: #fff2f0;
  --shadow: 0 26px 64px rgb(17 24 28 / 16%), 0 6px 16px rgb(17 24 28 / 6%);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--surface);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

body.drawer-open {
  overflow: hidden;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.noscript-banner {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  padding: 12px 20px;
  color: #fff;
  background: var(--red);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

/* Access gate */

.access-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 20px;
  background: #fff;
}

.access-card {
  width: min(100%, 470px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.access-brand,
.header-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.access-brand {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font-size: 19px;
  font-weight: 700;
}

.brand-mark.compact {
  width: 31px;
  height: 31px;
  border-radius: 6px;
  font-size: 18px;
}

.access-brand span:last-child,
.header-brand span:last-child {
  display: grid;
  gap: 3px;
}

.access-brand strong {
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.07em;
}

.access-brand small,
.header-brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.access-lock {
  display: grid;
  width: 44px;
  height: 44px;
  margin-top: 30px;
  place-items: center;
  border: 1px solid #cfe4e1;
  border-radius: 9px;
  color: var(--accent);
  background: var(--accent-soft);
}

.access-lock svg {
  width: 23px;
  height: 23px;
}

.access-kicker {
  margin: 22px 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.access-card h1 {
  margin: 0;
  font-size: clamp(25px, 5vw, 31px);
  font-weight: 690;
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.access-copy {
  max-width: 390px;
  margin: 12px 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.access-form {
  display: grid;
  gap: 8px;
}

.access-form > label {
  font-size: 12px;
  font-weight: 700;
}

.access-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.access-input-row input {
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.access-input-row input::placeholder {
  color: #a7afad;
}

.access-input-row button {
  min-width: 92px;
  border: 1px solid var(--accent);
  border-radius: 0 6px 6px 0;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 720;
}

.access-input-row button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.form-error {
  margin: 4px 0 0;
  color: var(--red);
  font-size: 12px;
  line-height: 1.45;
}

.access-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.access-notice svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--accent);
}

/* Application shell */

.app-shell {
  min-height: 100vh;
  background: #fff;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(10px);
}

.header-brand strong {
  font-size: 13px;
  font-weight: 730;
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.connection-state {
  display: inline-flex;
  height: 29px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 650;
}

.connection-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9da6a4;
}

.connection-state i[data-status="live"] {
  background: #16a36f;
  box-shadow: 0 0 0 3px rgb(22 163 111 / 12%);
}

.connection-state i[data-status="loading"] {
  background: #d79917;
  animation: pulse 1s ease-in-out infinite;
}

.connection-state i[data-status="error"] {
  background: #d92d20;
}

.access-label {
  max-width: 180px;
  overflow: hidden;
  padding: 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.export-button,
.view-button,
.pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: #34413f;
  background: #fff;
  font-size: 13px;
  font-weight: 670;
}

.icon-button {
  height: 31px;
  gap: 6px;
  padding: 0 10px;
}

.icon-button svg {
  width: 15px;
  height: 15px;
}

.icon-button:hover:not(:disabled),
.export-button:hover:not(:disabled),
.view-button:hover:not(:disabled),
.pagination button:hover:not(:disabled) {
  border-color: #aebbb8;
  background: var(--surface-hover);
}

.workspace {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 25px 28px 40px;
}

.workspace-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.view-tabs button {
  height: 31px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 680;
}

.view-tabs button:hover {
  color: var(--ink);
}

.view-tabs button[aria-selected="true"] {
  color: var(--accent-dark);
  background: #fff;
  box-shadow: 0 1px 3px rgb(20 35 32 / 10%);
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.export-actions > label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.export-actions select {
  height: 32px;
  min-width: 205px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  font-size: 13px;
}

.workspace-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.workspace-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px !important;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.workspace-title h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.workspace-title p:not(.workspace-kicker) {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.workspace-title time {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: 12px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.summary-strip article {
  display: flex;
  min-height: 67px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-right: 1px solid var(--line);
}

.summary-strip article:last-child {
  border-right: 0;
}

.summary-strip span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
}

.summary-strip strong {
  font-variant-numeric: tabular-nums;
  font-size: 23px;
  font-weight: 670;
  letter-spacing: -0.04em;
}

/* Database */

.database-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.database-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 18px 15px;
}

.database-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.database-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dataset-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: #fff;
}

.dataset-tabs button {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 3px solid transparent;
  color: #53605e;
  background: #fff;
  text-align: left;
}

.dataset-tabs button:last-child {
  border-right: 0;
}

.dataset-tabs button:hover {
  background: #f7faf9;
}

.dataset-tabs button[aria-pressed="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
  background: var(--accent-soft);
}

.dataset-tabs button > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.dataset-tabs b {
  font-size: 13px;
  font-weight: 720;
}

.dataset-tabs small {
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dataset-tabs strong {
  display: inline-grid;
  min-width: 30px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0 7px;
  border: 1px solid #cbd7d5;
  border-radius: 13px;
  background: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.database-heading .restricted-copy {
  color: #8a5a06;
  font-size: 12px;
}

.export-button {
  height: 32px;
  flex: 0 0 auto;
  gap: 6px;
  padding: 0 11px;
}

.export-button svg {
  width: 15px;
  height: 15px;
}

.toolbar {
  display: flex;
  min-height: 51px;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.search-field {
  position: relative;
  display: flex;
  min-width: 210px;
  max-width: 410px;
  flex: 1 1 300px;
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: #7c8785;
  pointer-events: none;
}

.search-field input,
.filter-field select {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  font-size: 13px;
}

.search-field input {
  padding: 0 10px 0 32px;
}

.search-field input::placeholder {
  color: #949d9b;
}

.filter-field {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 7px;
}

.filter-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.filter-field select {
  min-width: 130px;
  padding: 0 28px 0 9px;
}

.sort-field {
  margin-left: auto;
}

.table-status {
  display: flex;
  min-height: 240px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #dbe2e0;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.table-scroller {
  position: relative;
  min-height: 180px;
  overflow: auto;
}

.response-table {
  width: 100%;
  min-width: 1780px;
  border-spacing: 0;
  border-collapse: separate;
  table-layout: auto;
  font-size: 13px;
}

.response-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 35px;
  padding: 0 11px;
  border-bottom: 1px solid var(--line-strong);
  color: #626c6a;
  background: #f5f7f6;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.response-table td {
  height: 49px;
  max-width: 230px;
  padding: 7px 11px;
  border-bottom: 1px solid #edf0ef;
  color: #35413f;
  vertical-align: middle;
}

.response-table tbody tr:last-child td {
  border-bottom: 0;
}

.response-table tbody tr:hover td {
  background: var(--surface-hover);
}

.response-table code {
  color: #42504e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 650;
}

.id-column {
  width: 86px;
}

.identity-column {
  min-width: 140px;
}

.email-column {
  min-width: 190px;
}

.institution-column {
  min-width: 175px;
}

.track-column {
  min-width: 145px;
}

.task-column {
  min-width: 210px;
}

.wide-column {
  min-width: 165px;
}

.date-column {
  min-width: 145px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.numeric-column {
  width: 65px;
  font-variant-numeric: tabular-nums;
  text-align: right !important;
}

.action-column {
  position: sticky;
  z-index: 1;
  right: 0;
  width: 67px;
  border-left: 1px solid #edf0ef;
  background: #fff;
  text-align: right !important;
}

.response-table th.action-column {
  z-index: 3;
  background: #f5f7f6;
}

.response-table tbody tr:hover .action-column {
  background: var(--surface-hover);
}

.cell-stack {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.cell-stack strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 630;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-stack small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-truncate {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca5a3;
}

.status-badge.complete_submission {
  border-color: #bce1d3;
  color: #087350;
  background: #eefaf5;
}

.status-badge.complete_submission i {
  background: #0e9f6e;
}

.status-badge.partial_submission {
  border-color: #d8c8f0;
  color: #6741a5;
  background: #f7f2ff;
}

.status-badge.partial_submission i {
  background: #8359c7;
}

.status-badge.unknown_submission {
  border-color: #d5dade;
  color: #59616a;
  background: #f5f7f8;
}

.status-badge.editing {
  border-color: #cbd9f5;
  color: #2d5daf;
  background: var(--blue-soft);
}

.status-badge.editing i {
  background: var(--blue);
}

.status-badge.draft {
  border-color: #e7d59b;
  color: #8b610a;
  background: var(--amber-soft);
}

.status-badge.draft i {
  background: #d29212;
}

.track-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 11px;
  font-weight: 720;
  white-space: nowrap;
}

.track-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.track-badge.survey {
  border-color: #b9dcda;
  color: #086a72;
  background: #eff9f8;
}

.track-badge.survey i {
  background: #0a838b;
}

.track-badge.study {
  border-color: #c9d5f2;
  color: #3457a5;
  background: #f1f5ff;
}

.track-badge.study i {
  background: #4f6fc5;
}

.view-button {
  height: 27px;
  padding: 0 9px;
  color: var(--accent);
}

.empty-state {
  display: grid;
  min-height: 190px;
  place-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 13px;
}

.empty-state span {
  font-size: 13px;
}

.table-footer {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fbfcfc;
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination span {
  margin-right: 5px;
}

.pagination button {
  width: 27px;
  height: 27px;
  padding: 0;
  font-size: 13px;
}

/* Statistics */

.statistics-toolbar {
  display: flex;
  min-height: 53px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.statistics-toolbar > div {
  display: grid;
  gap: 3px;
}

.statistics-toolbar strong {
  font-size: 13px;
  font-weight: 700;
}

.statistics-toolbar > div span {
  color: var(--muted);
  font-size: 12px;
}

.statistics-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.statistics-overview article {
  display: grid;
  min-height: 112px;
  align-content: center;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.statistics-overview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.statistics-overview strong {
  font-variant-numeric: tabular-nums;
  font-size: 27px;
  font-weight: 680;
  letter-spacing: -0.045em;
}

.statistics-overview small {
  color: var(--subtle);
  font-size: 11px;
}

.statistics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.statistics-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.statistics-panel-wide {
  grid-column: 1 / -1;
}

.statistics-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.statistics-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.statistics-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chart-list {
  display: grid;
  gap: 13px;
}

.chart-list.compact {
  gap: 10px;
}

.chart-row {
  display: grid;
  gap: 6px;
}

.chart-row-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.chart-row-heading span {
  min-width: 0;
  overflow: hidden;
  color: #384340;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-row-heading strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.chart-progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: #edf1f0;
}

.chart-progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #edf1f0;
}

.chart-progress::-webkit-progress-value {
  border-radius: 999px;
  background: #72827f;
}

.chart-progress::-moz-progress-bar {
  border-radius: 999px;
  background: #72827f;
}

.chart-progress.accent::-webkit-progress-value,
.chart-progress.created::-webkit-progress-value {
  background: var(--accent);
}

.chart-progress.accent::-moz-progress-bar,
.chart-progress.created::-moz-progress-bar {
  background: var(--accent);
}

.chart-progress.submitted::-webkit-progress-value {
  background: #70b59a;
}

.chart-progress.submitted::-moz-progress-bar {
  background: #70b59a;
}

.chart-legend {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 13px;
  color: var(--muted);
  font-size: 11px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}

.chart-legend i.submitted {
  background: #70b59a;
}

.activity-chart {
  display: grid;
  gap: 7px;
}

.activity-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

.activity-row time {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.activity-series {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 25px;
  align-items: center;
  gap: 7px;
}

.activity-series span,
.activity-series strong {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.activity-series strong {
  text-align: right;
}

.coverage-chart {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 30px;
}

.distribution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.distribution-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.distribution-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.distribution-heading h3 {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: #384340;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.distribution-heading code {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.distribution-heading small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.statistics-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Response drawer */

.drawer-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  opacity: 0;
  background: rgb(20 30 28 / 30%);
  transition: opacity 180ms ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
}

.response-drawer {
  position: fixed;
  z-index: 70;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: min(610px, 94vw);
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -18px 0 50px rgb(20 35 32 / 13%);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.response-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  min-height: 103px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 17px;
  border-bottom: 1px solid var(--line);
}

.drawer-header p {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.drawer-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.drawer-header span {
  display: block;
  max-width: 470px;
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-header button {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0 0 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: #fff;
  font-size: 22px;
  line-height: 1;
}

.drawer-header button:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.drawer-content {
  overflow: auto;
  flex: 1;
  padding: 0 22px 40px;
}

.drawer-section {
  padding: 21px 0;
  border-bottom: 1px solid var(--line);
}

.drawer-section:last-child {
  border-bottom: 0;
}

.drawer-section h3 {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 730;
}

.drawer-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.drawer-section-heading span {
  color: var(--muted);
  font-size: 12px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
}

.metadata-grid dt,
.metadata-grid dd {
  min-height: 37px;
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.metadata-grid dt {
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 650;
}

.metadata-grid dd {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.answer-list {
  display: grid;
  gap: 9px;
}

.answer-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.answer-heading {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.answer-heading code {
  min-height: 100%;
  padding: 10px;
  border-right: 1px solid var(--line);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 760;
}

.answer-heading p {
  margin: 0;
  padding: 9px 11px;
  color: #4a5553;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.answer-card.has-long-key .answer-heading {
  grid-template-columns: 1fr;
}

.answer-card.has-long-key .answer-heading code {
  min-height: 0;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.answer-value {
  overflow: auto;
  max-height: 340px;
  margin: 0;
  padding: 11px 12px 12px;
  color: #24302e;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.toast-region {
  position: fixed;
  z-index: 90;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(340px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 11px 13px;
  border: 1px solid #cbd9d6;
  border-radius: 6px;
  color: #fff;
  background: #233633;
  box-shadow: 0 10px 30px rgb(20 35 32 / 18%);
  font-size: 13px;
  font-weight: 620;
}

.toast.error {
  border-color: #cc6d63;
  background: #8f2820;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

@media (max-width: 980px) {
  .app-header {
    padding: 0 18px;
  }

  .workspace {
    padding-right: 18px;
    padding-left: 18px;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .statistics-overview article:nth-child(n + 4) {
    grid-column: span 1;
  }

  .distribution-grid {
    grid-template-columns: 1fr;
  }

  .summary-strip article:nth-child(even) {
    border-right: 0;
  }

  .summary-strip article:nth-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .search-field {
    max-width: none;
    flex-basis: 100%;
  }

  .sort-field {
    margin-left: 0;
  }
}

@media (max-width: 680px) {
  .access-shell {
    align-items: start;
    padding: 20px 14px;
  }

  .access-card {
    margin-top: 4vh;
    padding: 24px 20px;
    box-shadow: 0 12px 35px rgb(21 36 33 / 8%);
  }

  .app-header {
    min-height: 56px;
    padding: 0 12px;
  }

  .header-brand small,
  .access-label,
  .connection-state,
  .icon-button span {
    display: none;
  }

  .header-actions {
    gap: 5px;
  }

  .icon-button {
    width: 33px;
    padding: 0;
  }

  .workspace {
    padding: 19px 12px 30px;
  }

  .workspace-nav {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 19px;
  }

  .view-tabs,
  .view-tabs button {
    width: 100%;
  }

  .export-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .export-actions > label {
    display: none;
  }

  .export-actions select {
    min-width: 0;
  }

  .workspace-title {
    display: block;
    margin-bottom: 16px;
  }

  .workspace-title h1 {
    font-size: 22px;
  }

  .workspace-title time {
    display: block;
    margin-top: 9px;
  }

  .summary-strip article {
    min-height: 58px;
    padding: 10px 12px;
  }

  .summary-strip span {
    font-size: 12px;
  }

  .summary-strip strong {
    font-size: 19px;
  }

  .statistics-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .statistics-toolbar .filter-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .statistics-overview,
  .statistics-grid {
    grid-template-columns: 1fr;
  }

  .statistics-overview article,
  .statistics-overview article:nth-child(n + 4),
  .statistics-panel,
  .statistics-panel-wide {
    grid-column: 1;
  }

  .statistics-overview article {
    min-height: 90px;
  }

  .coverage-chart {
    grid-template-columns: 1fr;
  }

  .statistics-panel {
    padding: 15px 12px;
  }

  .statistics-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .activity-row {
    grid-template-columns: 49px minmax(0, 1fr);
  }

  .activity-series:last-child {
    grid-column: 2;
  }

  .database-heading {
    align-items: flex-start;
    padding: 15px 12px 13px;
  }

  .database-heading p {
    max-width: 240px;
    line-height: 1.45;
  }

  .dataset-tabs {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  .dataset-tabs button {
    min-height: 57px;
    padding: 8px 12px;
  }

  .export-button {
    padding: 0 10px;
  }

  .export-button svg {
    width: 16px;
    height: 16px;
  }

  .toolbar {
    gap: 7px;
    padding: 9px 12px;
  }

  .filter-field {
    display: grid;
    flex: 1 1 135px;
    gap: 4px;
  }

  .filter-field select {
    min-width: 0;
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 12px;
  }

  .pagination {
    width: 100%;
    justify-content: flex-end;
  }

  .response-drawer {
    width: 100vw;
    max-width: none;
    border-left: 0;
  }

  .drawer-header {
    padding: 17px 16px 14px;
  }

  .drawer-content {
    padding: 0 16px 30px;
  }

  .metadata-grid {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .answer-heading {
    grid-template-columns: 50px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
