:root {
  --bg: #eef4f4;
  --surface: #ffffff;
  --ink: #102123;
  --muted: #647577;
  --line: #d3e0e0;
  --brand: #1c6d74;
  --brand-dark: #123f44;
  --accent: #bf6b45;
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
  cursor: pointer;
}

.clinical-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.patient-rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #fbfdfd;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-weight: 850;
}

.menu-button {
  display: none;
}

nav,
.patient-list {
  display: grid;
  gap: 6px;
}

nav button,
.patient-list button,
.filter-bar button,
.report-preview button,
.timeline-panel button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

nav button {
  text-align: left;
  padding: 0 12px;
}

nav .is-active {
  border-color: var(--brand);
  background: #e2f1f1;
  color: var(--brand-dark);
}

.patient-list {
  margin-top: auto;
}

.patient-list p,
.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.patient-list button {
  display: grid;
  gap: 2px;
  padding: 10px;
  text-align: left;
}

.patient-list span,
p,
small,
td {
  color: var(--muted);
}

.clinical-main {
  min-width: 0;
}

.clinical-top {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 82px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 244, 244, 0.9);
  backdrop-filter: blur(14px);
}

.filter-bar {
  display: flex;
  gap: 8px;
}

.filter-bar button:last-child,
.report-preview button,
.timeline-panel button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.7rem;
}

.page {
  display: none;
  padding: 28px;
}

.page.is-active {
  display: block;
}

.clinical-grid,
.workbench {
  display: grid;
  gap: 16px;
}

.clinical-grid {
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(240px, 0.6fr));
}

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

.lead-panel,
.insight-panel,
.chart-panel,
.table-panel,
.report-preview,
.timeline-panel,
.visual-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(14, 46, 50, 0.06);
}

.visual-panel {
  overflow: hidden;
  min-height: 340px;
}

.visual-panel img {
  width: 100%;
  height: 100%;
  min-height: 340px;
  object-fit: cover;
}

.lead-panel {
  display: grid;
  gap: 18px;
  min-height: 340px;
  padding: 28px;
  background: var(--brand-dark);
  color: #fff;
}

.lead-panel h2 {
  max-width: 780px;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 1;
}

.lead-panel p:not(.eyebrow) {
  max-width: 670px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.6;
}

.insight-panel {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 22px;
}

.insight-panel span {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.insight-panel strong {
  font-size: 2.4rem;
  line-height: 1;
}

.chart-panel,
.table-panel,
.report-preview,
.timeline-panel {
  padding: 20px;
}

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

.bars {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 210px;
  margin-top: 18px;
  padding: 16px;
  background: #f4f8f8;
}

.bars span {
  flex: 1;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #65aeb2, var(--brand));
}

table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
}

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

th {
  color: var(--brand-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
}

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

.matrix span,
.matrix strong {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.report-preview,
.timeline-panel {
  display: grid;
  gap: 16px;
}

.timeline-panel ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-panel li {
  display: grid;
  gap: 3px;
  padding: 12px;
  background: #f4f8f8;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 6px;
  background: #102123;
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  transition: 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .clinical-shell {
    grid-template-columns: 1fr;
  }

  .patient-rail {
    position: static;
    height: auto;
  }

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

  .clinical-grid,
  .workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .clinical-top,
  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .page {
    padding: 16px;
  }
}
