:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17242f;
  background: #f4f7f9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --line: #dce4e9;
  --muted: #60717d;
  --blue: #155a75;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem max(1rem, calc((100vw - 1440px) / 2));
  color: #fff;
  background: #12394b;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .35rem; font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { margin-bottom: .9rem; font-size: 1.1rem; }
.eyebrow { margin: 0 0 .35rem; color: #b5dbe8; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.subtitle { margin: 0; color: #d4e4e9; }
.status { border-radius: 999px; padding: .55rem .8rem; font-weight: 700; white-space: nowrap; }
.status-loading { color: #15394a; background: #d9edf5; }
.status-ok { color: #14532d; background: #dcfce7; }
.status-warning { color: #854d0e; background: #fef3c7; }
.status-error { color: #991b1b; background: #fee2e2; }

main { max-width: 1440px; margin: 1.5rem auto; padding: 0 1rem; }
.overview, .record-list, .record-detail { border: 1px solid var(--line); border-radius: .75rem; background: #fff; }
.overview { margin-bottom: 1rem; padding: 1.1rem 1.25rem; }
.overview-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.overview-heading h2 { margin: 0; }
.muted { color: var(--muted); }
.overview > .muted { margin: .65rem 0; }
.button { border: 1px solid var(--line); border-radius: .4rem; padding: .45rem .75rem; font: inherit; cursor: pointer; }
.button-secondary { color: #183c4d; background: #fff; }
.button:hover { background: #eef5f8; }
.button:disabled { cursor: wait; opacity: .6; }
.validation-summary { display: flex; flex-wrap: wrap; gap: .5rem; }
.validation-count { border-radius: 999px; padding: .3rem .6rem; font-size: .85rem; font-weight: 700; }
.count-good { color: #14532d; background: #dcfce7; }
.count-warning { color: #854d0e; background: #fef3c7; }
.count-error { color: #991b1b; background: #fee2e2; }
.diagnostics { display: grid; gap: .4rem; margin-top: .75rem; }
.diagnostic { display: flex; align-items: flex-start; gap: .6rem; border-left: 3px solid #d97706; padding: .5rem .65rem; background: #fffbeb; font-size: .88rem; overflow-wrap: anywhere; }
.diagnostic-error { border-color: #dc2626; background: #fef2f2; }
.diagnostic-category { min-width: 7.5rem; color: #6b4a0b; font-weight: 700; }
.diagnostic-error .diagnostic-category { color: #991b1b; }
.diagnostic-link { border: 0; padding: 0; color: var(--blue); background: none; font: inherit; text-align: left; cursor: pointer; }
.diagnostic-link:hover { text-decoration: underline; }

.browser { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.record-list { position: sticky; top: 1rem; padding: 1rem; }
.record-list h2 { margin-bottom: 1rem; }
label { display: block; margin: .8rem 0 .35rem; font-size: .86rem; font-weight: 650; }
input, select { width: 100%; border: 1px solid #c8d4db; border-radius: .4rem; padding: .6rem .65rem; color: inherit; background: #fff; font: inherit; }
input:focus, select:focus, button:focus-visible { outline: 3px solid #82c6df; outline-offset: 2px; }
.records { display: grid; gap: .35rem; max-height: 60vh; overflow: auto; margin: .5rem 0 0; padding: 0; list-style: none; }
.record-button { display: block; width: 100%; border: 1px solid transparent; border-radius: .45rem; padding: .6rem; color: inherit; background: #fff; text-align: left; cursor: pointer; }
.record-button:hover, .record-button[aria-current="true"] { border-color: #a9d4e1; background: #edf7fa; }
.record-name { display: block; font-weight: 700; }
.record-meta { display: block; margin-top: .2rem; color: var(--muted); font-size: .78rem; }
.empty-state { color: var(--muted); }
.record-detail { min-height: 20rem; padding: 1.25rem; overflow-wrap: anywhere; }
.record-detail h2 { margin-bottom: .3rem; font-size: 1.45rem; }
.record-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.field-list { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(0, 1fr); margin: 1rem 0 0; border-top: 1px solid var(--line); }
.field-list dt, .field-list dd { margin: 0; padding: .65rem .5rem; border-bottom: 1px solid var(--line); }
.field-list dt { color: #405561; font-size: .9rem; font-weight: 700; }
.field-list dd { min-width: 0; white-space: pre-wrap; }
.reference-link { border: 0; padding: 0; color: var(--blue); background: none; font: inherit; text-decoration: underline; cursor: pointer; }
.reference-missing { display: inline-block; border-radius: .25rem; padding: 0 .25rem; color: #991b1b; background: #fee2e2; font-weight: 700; }
footer { padding: 1rem; color: var(--muted); text-align: center; font-size: .85rem; }

@media (max-width: 760px) {
  .page-header { align-items: flex-start; flex-direction: column; }
  .browser { grid-template-columns: 1fr; }
  .record-list { position: static; }
  .records { max-height: 35vh; }
  .field-list { grid-template-columns: 1fr; }
  .field-list dt { padding-bottom: .15rem; border-bottom: 0; }
  .field-list dd { padding-top: .25rem; }
  .diagnostic { flex-direction: column; gap: .2rem; }
}
