:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5f6c78;
  --line: #d9e0e7;
  --panel: #ffffff;
  --wash: #f5f7fa;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --error: #b91c1c;
  --ok: #047857;
}

:root.dark-theme {
  color-scheme: dark;
  --ink: #e7edf3;
  --muted: #aab7c4;
  --line: #334454;
  --panel: #17212b;
  --wash: #0d141b;
  --accent: #2dd4bf;
  --accent-dark: #5eead4;
  --warn: #fbbf24;
  --error: #fca5a5;
  --ok: #6ee7b7;
}

* {
  box-sizing: border-box;
}

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

.theme-toggle {
  position: fixed;
  z-index: 1;
  top: 18px;
  right: 18px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(23, 32, 42, 0.12);
}

.theme-toggle:hover {
  background: var(--wash);
}

.copy-report {
  display: block;
  width: fit-content;
  margin: 24px auto 0;
  min-height: 44px;
  box-shadow: 0 10px 24px rgba(23, 32, 42, 0.2);
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.lookup-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1fr);
  gap: 40px;
  align-items: center;
  min-height: calc(100vh - 112px);
}

.brand-block h1,
.report-header h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lede {
  max-width: 620px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.lookup-form,
.record-section,
.summary-band,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(23, 32, 42, 0.08);
}

.lookup-form {
  padding: 28px;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
button,
.secondary-action {
  min-height: 48px;
  border-radius: 6px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid #b8c4cf;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

button,
.secondary-action {
  border: 0;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.secondary-action:hover {
  background: var(--accent-dark);
}

.form-error {
  margin: 14px 0 0;
  color: var(--error);
  font-weight: 700;
}

.report-view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.report-view-toggle legend,
.report-view-toggle > span {
  width: 100%;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.report-view-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-weight: 700;
}

.report-view-toggle input {
  width: auto;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.report {
  display: grid;
  gap: 22px;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.report-actions {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.report-view-toggle.compact {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.meta {
  margin: 14px 0 0;
  color: var(--muted);
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.summary-band > div {
  display: grid;
  gap: 6px;
  padding: 18px;
  background: var(--panel);
}

.summary-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.report-note {
  margin: 0;
  color: var(--muted);
}

.record-list {
  display: grid;
  gap: 16px;
}

.record-section {
  padding: 20px;
}

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

.record-heading h2 {
  margin: 0;
  font-size: 1.1rem;
}

.status {
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-found {
  background: #dff7ed;
  color: var(--ok);
}

:root.dark-theme .status-found {
  background: #143d35;
}

.status-timeout,
.status-error {
  background: #fee2e2;
  color: var(--error);
}

:root.dark-theme .status-timeout,
:root.dark-theme .status-error {
  background: #482329;
}

.status-empty {
  background: #fef3c7;
  color: var(--warn);
}

:root.dark-theme .status-empty {
  background: #4b3912;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

td:last-child,
th:last-child {
  width: 120px;
}

code {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

.empty-message {
  margin: 0;
  color: var(--muted);
}

.notice {
  padding: 18px;
}

.error-notice {
  border-color: #fecaca;
  color: var(--error);
}

@media (max-width: 780px) {
  .page-shell {
    width: min(100% - 24px, 1120px);
    padding: 28px 0;
  }

  .lookup-panel,
  .summary-band {
    grid-template-columns: 1fr;
  }

  .lookup-panel {
    gap: 24px;
    min-height: auto;
  }

  .search-row,
  .report-header,
  .report-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  button,
  .secondary-action {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  .secondary-action,
  .theme-toggle,
  .copy-report,
  .lookup-form {
    display: none;
  }

  .lookup-form,
  .record-section,
  .summary-band,
  .notice {
    box-shadow: none;
  }
}
