:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-soft: #fbfaf6;
  --ink: #18201e;
  --muted: #64706c;
  --line: #d9ded8;
  --teal: #0f766e;
  --teal-dark: #0d5f59;
  --mint: #dcefe8;
  --amber: #c47b27;
  --amber-soft: #f3e1c7;
  --blue: #38598a;
  --shadow: 0 18px 44px rgba(24, 32, 30, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-header,
main {
  width: min(1460px, calc(100% - 40px));
  margin: 0 auto;
}

.page-header {
  padding: 22px 0 18px;
}

.intro,
.section-heading,
.details-header,
.panel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.intro {
  align-items: flex-end;
  margin-top: 24px;
}

.intro h1 {
  max-width: 700px;
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.summary {
  max-width: 520px;
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 1.1rem;
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--teal) 10%, transparent);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.retrieval-tool {
  margin: 18px 0 24px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--teal) 5%, transparent);
  box-shadow: var(--shadow);
}

.section-heading {
  align-items: flex-start;
}

.section-heading h2,
.details-header h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.62fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.results-region,
.sidebar-stack,
.details-panel,
.extraction-panel {
  min-width: 0;
}

.results-region,
.details-panel,
.extraction-panel {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sidebar-stack {
  display: grid;
  gap: 20px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

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

th + th,
td + td {
  border-left: 1px solid var(--line);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--teal) 15%, var(--surface));
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

td {
  color: var(--ink);
  font-size: 0.92rem;
}

tbody tr.is-selected {
  box-shadow: inset 4px 0 0 var(--teal);
  background: color-mix(in srgb, var(--teal) 10%, transparent);
}

.case-name {
  font-weight: 800;
}

.reference-link {
  display: inline-block;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.reference-link:hover {
  text-decoration: underline;
}

.details-header {
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.details-content {
  padding: 18px;
}

.extraction-content {
  padding: 18px;
}

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

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

.detail-item {
  border-top: 2px solid var(--line);
  padding-top: 8px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  margin-top: 3px;
}

.detail-section {
  margin-top: 20px;
}

.detail-section h3 {
  margin: 0 0 9px;
  font-size: 0.95rem;
}

.treatment-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.treatment-list li {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.raw-report {
  margin: 0;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
}

.pipeline-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.96rem;
}

.example-stack {
  display: grid;
  gap: 16px;
}

.code-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  color: var(--teal-dark);
}

.panel-label {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--teal) 15%, transparent);
}

.panel-label span {
  font-weight: 800;
}

.panel-label small {
  color: var(--muted);
}

pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  color: inherit;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
}

@media (max-width: 1120px) {
  .intro,
  .workspace {
    grid-template-columns: 1fr;
  }

  .intro {
    display: grid;
    align-items: start;
  }

  .summary {
    max-width: 760px;
  }

  .workspace {
    display: grid;
  }

  .sidebar-stack {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 860px) {
  .page-header,
  main {
    width: min(100% - 24px, 1460px);
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .retrieval-tool,
  .extraction-panel {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .intro h1 {
    font-size: 1.9rem;
  }

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