:root {
  --background: #efe6d4;
  --surface: #fbf6eb;
  --surface-subtle: #f4ead9;
  --border: #e0d2b8;
  --border-strong: #c4a474;
  --text: #3a2c1f;
  --text-soft: #6d5c48;
  --text-faint: #8d7b66;
  --primary: #4f7a2c;
  --primary-dark: #36561c;
  --primary-soft: #e2ecc4;
  --blue-soft: #e2ecc4;
  --blue: #3f6a28;
  --warning-soft: #f6e6c0;
  --warning: #9a5810;
  --danger-soft: #f6ddd0;
  --danger: #b84a28;
  --high-1: #f6e6c0;
  --high-2: #edc078;
  --high-3: #e09060;
  --low-1: #e2ecc4;
  --low-2: #b4d080;
  --low-3: #6e9a3c;
  --uninterpreted: #efe6d8;
  --gold: #c4922a;
  --teal: #2f6f64;
  --teal-soft: #dceee9;
  --wine: #8b3a4a;
  --wine-soft: #f6e8eb;
  --shadow-sm: 0 1px 2px rgb(58 44 31 / 6%);
  --shadow-md: 0 12px 32px rgb(58 44 31 / 10%);
  --chrome: rgb(251 246 235 / 94%);
  --chrome-bar: rgb(251 246 235 / 90%);
  --chrome-line: rgb(203 184 150 / 70%);
  --paper: #fffaf0;
  --table-head: #f6f9fa;
  --row-hover: #f3faf8;
  --table-ink: #2b3d43;
  --scrim: rgb(244 247 249 / 82%);
  --field: #fff;
  --on-primary: #fffef8;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  font-family:
    "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% -8%, rgb(176 138 62 / 16%), transparent 26rem),
    radial-gradient(circle at 94% 0%, rgb(79 122 44 / 14%), transparent 22rem),
    var(--background);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.app-nav {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 8px;
  padding: 18px 14px 16px;
  border-right: 1px solid var(--chrome-line);
  background: var(--chrome);
}

.app-nav .brand {
  flex: 0 0 auto;
  padding: 2px 6px 16px;
}

.app-nav-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
  overflow: auto;
}

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-section-label {
  margin: 0 10px 4px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.nav-item svg,
.nav-item img {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.nav-item img {
  mix-blend-mode: multiply;
}

.nav-item:hover:not(:disabled) {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.nav-item.is-active {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 6px 14px rgb(79 122 44 / 28%);
}

.nav-item.is-configured:not(.is-active)::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgb(79 122 44 / 18%);
}

.nav-item:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.nav-footer-actions {
  display: flex;
  gap: 4px;
  margin: 4px 8px 0;
}

.nav-options-gear {
  flex: 0 0 auto;
  width: 44px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  justify-content: center;
}

html:not([data-theme="pardo"]) .theme-icon-sun,
html[data-theme="pardo"] .theme-icon-moon {
  display: none;
}

.nav-options-gear svg {
  width: 20px;
  height: 20px;
}

.nav-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 8px 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  font-size: 0.78rem;
  color: var(--text-soft);
}

.nav-session[hidden] {
  display: none;
}

.nav-session-user {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}

.nav-logout-button {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.nav-logout-button:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.totp-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.totp-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.totp-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.totp-inline-form input {
  flex: 1 1 200px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--text);
  font: inherit;
}

.totp-enroll-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.totp-enroll-panel[hidden] {
  display: none;
}

.totp-qr-wrap {
  flex: 0 0 auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.totp-qr-image {
  display: block;
  width: 200px;
  height: 200px;
}

.totp-enroll-steps {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.totp-enroll-label {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.totp-secret-row {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.totp-secret-row code {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--field);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.04em;
}

.totp-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.totp-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.totp-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.totp-user-meta small {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.totp-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.totp-footer-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.nav-privacy {
  margin: 10px 8px 0;
}

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

.topbar .nav-toggle {
  display: none;
  flex: 0 0 auto;
}

.nav-backdrop {
  position: fixed;
  z-index: 28;
  inset: 0;
  background: rgb(18 34 40 / 32%);
}

.nav-backdrop[hidden] {
  display: none;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 28px;
  border-bottom: 1px solid var(--chrome-line);
  background: var(--chrome-bar);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  width: 68px;
  height: 68px;
  overflow: visible;
  place-items: center;
  animation: brand-mark-enter 780ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 58%;
  animation: brand-mark-idle 5.4s ease-in-out 820ms infinite;
}

.brand:hover .brand-mark img,
.brand:focus-visible .brand-mark img {
  animation-play-state: paused;
  transform: translateY(-2px) scale(1.045);
  filter:
    drop-shadow(0 8px 12px rgb(58 44 31 / 16%))
    drop-shadow(0 0 10px rgb(196 146 42 / 28%));
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 320ms ease;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 21px;
  line-height: 1.1;
  font-weight: 700;
}

.brand small {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 11px;
  letter-spacing: 0.02em;
}

@keyframes brand-mark-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.86);
    filter: blur(3px);
  }

  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes brand-mark-idle {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 2px 3px rgb(58 44 31 / 8%));
  }

  50% {
    transform: translateY(-3px) scale(1.035);
    filter: drop-shadow(0 10px 14px rgb(196 146 42 / 24%));
  }
}

.topbar-context {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  color: var(--text-soft);
  font-size: 13px;
}

.privacy-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-dark);
  font-weight: 650;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgb(176 138 62 / 16%);
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.page {
  width: min(1500px, calc(100% - 56px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.sync-progress-banner {
  margin: 0 0 4px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 650;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.heading-description {
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 14px;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0.01em;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible,
.icon-button:focus-visible,
.nav-item:focus-visible,
select:focus-visible,
input:focus-visible,
th button:focus-visible,
tbody tr:focus-visible {
  outline: 3px solid rgb(79 122 44 / 38%);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button-primary {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary-dark);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 18%),
    0 2px 0 var(--primary-dark),
    0 8px 18px rgb(79 122 44 / 34%);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 12%),
    0 3px 0 #243810,
    0 12px 24px rgb(54 86 28 / 40%);
}

.button-secondary {
  color: var(--primary-dark);
  border-color: var(--gold);
  background: var(--surface);
  box-shadow:
    0 2px 0 rgb(196 146 42 / 28%),
    0 6px 14px rgb(58 44 31 / 10%);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow:
    0 3px 0 rgb(79 122 44 / 28%),
    0 8px 16px rgb(58 44 31 / 12%);
}

.button-secondary.is-configured {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.button svg {
  width: 18px;
  height: 18px;
}

.metrics {
  display: grid;
  gap: 8px;
  margin: 16px 0 14px;
}

.metrics-units {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.metric-card {
  display: flex;
  width: 100%;
  min-height: 0;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 0 1px 6px rgb(58 44 31 / 7%);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.metric-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.metric-card.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow:
    0 0 0 1px rgb(79 122 44 / 35%),
    0 2px 8px rgb(58 44 31 / 10%);
}

.metric-total {
  border-left-color: var(--gold);
  border-left-width: 6px;
  padding: 12px 14px;
}

.metric-total .metric-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.metric-total strong {
  font-size: 28px;
}

.metric-total.is-active {
  border-color: var(--gold);
  background: rgb(196 146 42 / 12%);
  box-shadow:
    0 0 0 1px rgb(196 146 42 / 35%),
    0 2px 8px rgb(58 44 31 / 10%);
}

.metric-isolation {
  border-left-color: var(--danger);
  border-style: solid;
  border-left-style: solid;
  background: rgb(180 60 50 / 4%);
}

.metric-isolation.is-active {
  border-color: var(--danger);
  background: rgb(180 60 50 / 10%);
  box-shadow:
    0 0 0 1px rgb(180 60 50 / 30%),
    0 2px 8px rgb(58 44 31 / 10%);
}

.metric-icon {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  overflow: hidden;
  place-items: center;
}

.metric-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.metric-label {
  display: block;
  margin-bottom: 2px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 620;
  line-height: 1.2;
}

.metric-card strong {
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.035em;
}

.options-page .options-heading {
  margin-bottom: 8px;
}

.options-page .options-heading h1 {
  margin: 0;
}

.options-groups {
  display: grid;
  gap: 18px;
  max-width: 520px;
}

.background-progress {
  display: grid;
  gap: 8px;
}

.background-job {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-subtle) 72%, var(--surface));
}

.background-job-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.background-job-title {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.background-job-state {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.background-job-state.is-active {
  color: var(--primary-dark);
}

.background-job-state.is-error {
  color: #8a2f1f;
}

.background-job-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary-soft) 55%, #d9cbb3);
}

.background-job-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--primary) 0%,
    color-mix(in srgb, var(--primary) 70%, var(--gold)) 100%
  );
  transition: width 0.35s ease;
}

.background-job-fill.is-indeterminate {
  width: 36%;
  animation: background-job-pulse 1.2s ease-in-out infinite;
}

@keyframes background-job-pulse {
  0% {
    transform: translateX(-20%);
  }
  50% {
    transform: translateX(180%);
  }
  100% {
    transform: translateX(-20%);
  }
}

.background-job-meta {
  margin: 0;
  color: color-mix(in srgb, var(--text) 72%, transparent);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.35;
}

.options-group {
  display: grid;
  gap: 4px;
}

.options-group-label {
  margin: 0 2px 2px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.options-items {
  display: grid;
  gap: 2px;
}

.options-item {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.options-item:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.options-item svg,
.options-item img {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.options-item img {
  mix-blend-mode: multiply;
}

.options-item.is-configured::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgb(79 122 44 / 18%);
}

.list-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

#patients-view {
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.55'/%3E%3C/svg%3E");
  --paper-fiber:
    repeating-linear-gradient(
      118deg,
      transparent 0 14px,
      rgb(58 44 31 / 2.4%) 14px 15px
    ),
    repeating-linear-gradient(
      28deg,
      transparent 0 19px,
      rgb(176 138 62 / 2%) 19px 20px
    );
  position: relative;
  z-index: 0;
}

#patients-view::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: multiply;
  background-image: var(--paper-grain), var(--paper-fiber);
  background-size: 180px 180px, auto, auto;
}

#patients-view > * {
  position: relative;
  z-index: 1;
}

#patients-view .metric-card,
#patients-view .list-card {
  position: relative;
  isolation: isolate;
}

#patients-view .metric-card::after,
#patients-view .list-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: var(--paper-grain), var(--paper-fiber);
  background-size: 160px 160px, auto, auto;
}

#patients-view .metric-card > *,
#patients-view .list-card > * {
  position: relative;
  z-index: 1;
}

#patients-view .search-box {
  background-image: var(--paper-grain), var(--paper-fiber);
  background-size: 140px 140px, auto, auto;
  background-blend-mode: multiply, multiply, normal;
  background-color: var(--surface-subtle);
}

#patients-view .search-box:focus-within {
  background-image: var(--paper-grain), var(--paper-fiber);
  background-size: 140px 140px, auto, auto;
  background-blend-mode: multiply, multiply, normal;
  background-color: var(--surface);
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  display: flex;
  width: min(440px, 44vw);
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--text-soft);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgb(79 122 44 / 16%);
}

.search-box svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.search-box input::placeholder {
  color: var(--text-faint);
}

kbd {
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-faint);
  font-family: inherit;
  font-size: 10px;
  white-space: nowrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

select {
  height: 42px;
  min-width: 170px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  outline: 0;
  color: var(--text);
  background: var(--surface);
  font-size: 12px;
  box-shadow: 0 2px 0 rgb(196 146 42 / 18%);
}

#physician-filter {
  min-width: 220px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgb(58 44 31 / 8%);
}

.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-soft);
}

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

.list-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12px;
}

.list-summary strong {
  color: var(--text);
}

.list-summary span::before {
  margin-right: 9px;
  content: "•";
  color: var(--border-strong);
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 280px);
  min-height: 360px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--table-head);
}

th {
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

th button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

th button:hover {
  color: var(--primary);
}

th button span {
  font-size: 12px;
}

th button[data-direction="asc"] span::after {
  content: "↑";
}

th button[data-direction="desc"] span::after {
  content: "↓";
}

td {
  height: 58px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--table-ink);
  font-size: 12px;
  vertical-align: middle;
}

#patients-view td {
  height: 46px;
  padding: 4px 14px;
}

tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

tbody tr:hover,
tbody tr:focus {
  outline: none;
  background: var(--row-hover);
}

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

.patient-cell {
  min-width: 210px;
}

.patient-name {
  display: block;
  color: var(--text);
  font-weight: 680;
}

.patient-specialty {
  display: block;
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 10px;
}

.bed-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.bed-label {
  color: var(--primary-dark);
  font-weight: 750;
}

.isolation-sticker {
  display: inline-flex;
  max-width: 100%;
  min-height: 20px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  border-radius: 999px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: normal;
}

.readmission-sticker {
  display: inline-flex;
  max-width: 100%;
  min-height: 20px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  border-radius: 999px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.physician-cell {
  min-width: 190px;
}

.doctor-chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  padding: 3px 9px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doctor-chip.is-empty {
  color: var(--text-soft);
  border-color: var(--border);
  background: var(--surface-subtle);
}

.doctor-chip.is-olive {
  color: #1f4a12;
  border-color: #c4e06a;
  background: #c4e06a;
}

.doctor-chip.is-ochre {
  color: #6a3c00;
  border-color: #f0c24a;
  background: #f0c24a;
}

.doctor-chip.is-terracotta {
  color: #7a1c10;
  border-color: #f09a72;
  background: #f09a72;
}

.doctor-chip.is-mustard {
  color: #5c4400;
  border-color: #f2d84a;
  background: #f2d84a;
}

.doctor-chip.is-moss {
  color: #143820;
  border-color: #7ec87a;
  background: #7ec87a;
}

.doctor-chip.is-rust {
  color: #7a1800;
  border-color: #ee7a3c;
  background: #ee7a3c;
}

.doctor-chip.is-umber {
  color: #5a1428;
  border-color: #e890a4;
  background: #e890a4;
}

.doctor-chip.is-clay {
  color: #6a2c08;
  border-color: #e8a058;
  background: #e8a058;
}

.date-cell {
  white-space: nowrap;
}

.date-cell small {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.badge-success {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.badge-info {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge-neutral {
  color: var(--text-soft);
  background: var(--surface-subtle);
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.row-arrow {
  color: var(--text-faint);
}

.row-arrow svg {
  width: 16px;
  height: 16px;
}

.empty-state {
  display: grid;
  min-height: 340px;
  place-items: center;
  align-content: center;
  padding: 40px;
  text-align: center;
}

.empty-state[hidden],
.table-scroll[hidden] {
  display: none;
}

.empty-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 15px;
  place-items: center;
  border-radius: 17px;
  color: var(--primary);
  background: var(--primary-soft);
}

.empty-icon svg {
  width: 27px;
  height: 27px;
}

.empty-state h2 {
  margin-bottom: 7px;
  font-size: 17px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.drawer-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgb(18 34 40 / 32%);
}

.drawer {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  display: flex;
  width: min(560px, 94vw);
  height: 100vh;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -18px 0 45px rgb(20 41 49 / 16%);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

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

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.drawer-header h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
}

.drawer-detail-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.highlight-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-subtle);
}

.highlight-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.highlight-item strong {
  font-size: 13px;
  font-weight: 620;
  word-break: break-word;
}

.drawer-actions {
  display: grid;
  gap: 8px;
}

.drawer-actions .button {
  width: 100%;
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.drawer-footer p {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.5;
}

.loading-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--scrim);
  backdrop-filter: blur(5px);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-card {
  width: min(390px, calc(100% - 40px));
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.spinner {
  display: block;
  width: 34px;
  height: 34px;
  margin: 0 auto 18px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.loading-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.loading-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(390px, calc(100vw - 44px));
  gap: 10px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: toast-in 180ms ease-out;
}

.toast-mark {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.toast-error .toast-mark {
  background: var(--danger);
}

.toast-warning .toast-mark {
  color: #6e4309;
  background: #f7c968;
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  margin-bottom: 3px;
  font-size: 12px;
}

.toast span {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}

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

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.census-diff-overlay {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--scrim);
  backdrop-filter: blur(5px);
}

.census-diff-overlay[hidden] {
  display: none;
}

.census-diff-card {
  display: flex;
  width: min(680px, 100%);
  max-height: min(80vh, 720px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.census-diff-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 0;
}

.census-diff-header h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

.census-diff-summary {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.census-diff-content {
  min-height: 0;
  padding: 18px 22px;
  overflow: auto;
}

.census-diff-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.census-diff-columns.is-single {
  grid-template-columns: 1fr;
}

.census-diff-section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.census-diff-section h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.census-diff-admissions h3 {
  color: var(--primary-dark);
}

.census-diff-discharges h3 {
  color: var(--danger);
}

.census-diff-section ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.census-diff-section li {
  display: grid;
  gap: 2px;
}

.census-diff-section strong {
  font-size: 13px;
  line-height: 1.35;
}

.census-diff-section span {
  color: var(--text-soft);
  font-size: 12px;
}

.census-diff-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0 22px 20px;
}

.bolek-credentials-card {
  width: min(440px, 100%);
}

.bolek-credentials-form {
  display: grid;
  gap: 14px;
  padding: 8px 22px 0;
}

.bolek-credentials-form label {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.bolek-credentials-form input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.bolek-credentials-form .census-diff-footer {
  padding: 8px 0 20px;
}

.sync-settings-card {
  width: min(520px, 100%);
}

.sync-settings-form {
  display: grid;
  gap: 12px;
  padding: 8px 22px 0;
}

.sync-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
}

.sync-toggle input {
  margin-top: 3px;
}

.sync-warning,
.sync-status {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
}

.sync-evolutions-batch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgb(196 146 42 / 38%);
  border-radius: 12px;
  background: rgb(196 146 42 / 7%);
}

.sync-evolutions-batch strong {
  color: var(--ink);
  font-size: 14px;
}

.sync-evolutions-batch p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
}

.sync-evolutions-batch .button {
  flex: 0 0 auto;
}

.sync-settings-form .census-diff-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 0 20px;
}

@media (max-width: 700px) {
  .census-diff-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 899px) {
  .app-shell {
    display: block;
  }

  .topbar .nav-toggle {
    display: inline-grid;
  }

  .app-nav {
    position: fixed;
    z-index: 30;
    top: 0;
    left: 0;
    width: min(280px, 88vw);
    height: 100vh;
    transform: translateX(-110%);
    transition: transform 220ms ease;
    box-shadow: none;
  }

  .app-nav.is-open {
    transform: translateX(0);
    box-shadow: 18px 0 45px rgb(20 41 49 / 16%);
  }

  body.nav-open {
    overflow: hidden;
  }
}

@media (max-width: 1050px) {
  .metrics-units {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

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

  .search-box {
    width: 100%;
  }

  .filter-group {
    flex-wrap: wrap;
  }

  select {
    min-width: 200px;
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 0 18px;
  }

  .topbar .privacy-indicator,
  .divider {
    display: none;
  }

  .page {
    width: calc(100% - 28px);
    padding-top: 24px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions {
    display: flex;
    justify-content: stretch;
  }

  .heading-actions .button {
    width: 100%;
  }

  .metrics-units {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .metric-card {
    padding: 9px 10px;
  }

  .metric-icon {
    width: 32px;
    height: 32px;
  }

  .metric-card strong {
    font-size: 20px;
  }

  .metric-total strong {
    font-size: 24px;
  }

  .list-card {
    border-radius: 14px;
  }

  .filter-group label {
    flex: 1;
  }

  select {
    width: 100%;
    min-width: 0;
  }

  .table-scroll {
    max-height: none;
  }

  th:nth-child(3),
  td:nth-child(3),
  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }
}

.mini-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.lab-panel {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.lab-panel h3,
.lab-panel h4,
.lab-panel p {
  margin: 0;
}

.lab-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.lab-header h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.lab-header p,
.lab-empty {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.lab-empty {
  margin-top: 8px;
}

.lab-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.lab-metrics article,
.lab-card,
.lab-doc {
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--paper);
}

.lab-metrics span,
.lab-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lab-metrics strong,
.lab-card strong {
  font-size: 20px;
  letter-spacing: -0.03em;
}

.lab-docs {
  display: grid;
  gap: 10px;
}

.lab-card small,
.lab-card em {
  font-style: normal;
  font-weight: 650;
  font-size: 11px;
}

.lab-card.flag-high,
.lab-card.flag-low {
  border-color: #f0c7c7;
  background: var(--danger-soft);
}

.lab-card.flag-normal {
  border-color: #dce3c8;
  background: #f3fbf8;
}

.exam-search {
  display: block;
  margin-bottom: 12px;
}

.exam-search input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
}

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

.series-heading span {
  display: block;
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 12px;
}

.sparkline-wrap {
  display: block;
  width: 100%;
  overflow: visible;
}

.sparkline {
  display: block;
  width: 100%;
  height: 32px;
  margin: 0;
  overflow: visible;
}

.sparkline-band {
  fill: var(--primary-soft);
  opacity: 0.4;
}

.sparkline-ref {
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.sparkline polyline {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.sparkline polyline.is-alert {
  stroke-width: 2.1;
}

.sparkline-dot {
  stroke: none;
}

.sparkline-dot.is-last {
  stroke: var(--surface);
  stroke-width: 0.9;
}

.sparkline-dot.flag-high {
  fill: var(--danger);
}

.sparkline-dot.flag-low {
  fill: var(--blue);
}

.sparkline-dot.flag-normal {
  fill: var(--primary);
}

.sparkline-dot.flag-uninterpreted {
  fill: var(--text-faint);
}

.lab-docs {
  margin-top: 16px;
}

.lab-docs h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.lab-doc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.lab-doc:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.lab-doc span {
  color: var(--text-faint);
  font-size: 11px;
}

.exams-view {
  width: min(1500px, calc(100% - 56px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.handoff-view {
  width: min(1100px, calc(100% - 56px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.stock-page .stock-content {
  display: grid;
  gap: 22px;
  padding-bottom: 48px;
}

.ward-page .ward-content {
  display: grid;
  gap: 22px;
  padding-bottom: 48px;
}

.ward-census {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.ward-units {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ward-unit {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--text);
}

.ward-unit.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.ward-unit-name {
  font-size: 13px;
  font-weight: 700;
}

.ward-unit-count {
  color: var(--text-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ward-bands {
  display: grid;
  gap: 18px;
}

.ward-band {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
}

.ward-band-alta {
  background: color-mix(in srgb, var(--danger-soft) 78%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--danger) 34%, var(--border));
}

.ward-band-atencao {
  background: color-mix(in srgb, var(--warning-soft) 82%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--border));
}

.ward-band-giro {
  background: color-mix(in srgb, var(--primary-soft) 72%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
}

.ward-family-stack {
  display: grid;
  gap: 10px;
}

.ward-family {
  --ward-ink: var(--text);
  --ward-wash: var(--paper);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--ward-ink) 28%, var(--border));
  border-radius: 16px;
  background: color-mix(in srgb, var(--ward-wash) 70%, var(--paper));
}

.ward-family-vitals {
  --ward-ink: var(--danger);
  --ward-wash: var(--danger-soft);
}

.ward-family-antimicrobial {
  --ward-ink: var(--teal);
  --ward-wash: var(--teal-soft);
}

.ward-family-lab {
  --ward-ink: var(--warning);
  --ward-wash: var(--warning-soft);
}

.ward-family-device {
  --ward-ink: var(--wine);
  --ward-wash: var(--wine-soft);
}

.ward-family-blood {
  --ward-ink: var(--gold);
  --ward-wash: color-mix(in srgb, var(--gold) 28%, var(--paper));
}

.ward-family-flow {
  --ward-ink: var(--primary-dark);
  --ward-wash: var(--primary-soft);
}

.ward-family h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ward-ink);
  font-size: 14px;
  font-weight: 750;
}

.ward-family-mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--paper);
}

.ward-band h2,
.ward-giro {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  font-weight: 750;
}

.ward-giro {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.ward-giro-mark {
  width: 1ch;
  color: var(--text-soft);
}

.ward-band-alta h2,
.ward-band-alta .ward-count {
  color: var(--danger);
}

.ward-band-atencao h2,
.ward-band-atencao .ward-count {
  color: var(--warning);
}

.ward-band-giro .ward-giro,
.ward-band-giro .ward-count {
  color: var(--primary-dark);
}

.ward-count {
  min-width: 1.6rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--field);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.ward-cards {
  display: grid;
  gap: 8px;
}

.ward-card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 14px;
  background: var(--paper);
  color: var(--text);
  text-align: left;
}

.ward-unit:hover {
  border-color: var(--border-strong);
}

.ward-unit.is-selected:hover {
  border-color: var(--primary);
}

.ward-card:hover {
  border-top-color: var(--border-strong);
  border-right-color: var(--border-strong);
  border-bottom-color: var(--border-strong);
}

.ward-card:focus-visible,
.ward-unit:focus-visible,
.ward-giro:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ward-card-head,
.ward-signal {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.ward-bed,
.ward-name {
  font-weight: 750;
}

.ward-place,
.ward-stay,
.ward-rule {
  color: var(--text-soft);
  font-size: 13px;
}

.ward-stay {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.ward-signal .ward-rule {
  flex: 1 1 220px;
  color: var(--text);
  font-size: 14px;
}

.ward-action {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 750;
}

.ward-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ward-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--field);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.ward-family .ward-card {
  border-left-color: var(--ward-ink);
}

.ward-family .ward-count {
  color: var(--ward-ink);
  background: var(--paper);
}

.ward-chip.ward-family-vitals {
  background: var(--danger-soft);
  color: var(--danger);
}

.ward-chip.ward-family-antimicrobial {
  background: var(--teal-soft);
  color: var(--teal);
}

.ward-chip.ward-family-lab {
  background: var(--warning-soft);
  color: var(--warning);
}

.ward-chip.ward-family-device {
  background: var(--wine-soft);
  color: var(--wine);
}

.ward-chip.ward-family-blood {
  background: color-mix(in srgb, var(--gold) 28%, var(--paper));
  color: var(--gold);
}

.ward-chip.ward-family-flow {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.ward-severity-alta {
  border-left-color: var(--danger);
}

.ward-severity-atencao {
  border-left-color: var(--warning);
}

.ward-severity-info {
  border-left-color: var(--border-strong);
}

.ward-note {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
}

@media (max-width: 720px) {
  .ward-stay {
    margin-left: 0;
  }
}

.stock-meta {
  color: var(--text-soft);
  font-size: 13px;
}

.stock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stock-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--stock-tone) 35%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--stock-tone) 12%, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.stock-chip:hover {
  background: color-mix(in srgb, var(--stock-tone) 22%, var(--surface));
  border-color: color-mix(in srgb, var(--stock-tone) 55%, var(--border));
  transform: translateY(-1px);
}

.stock-chip-emoji {
  font-size: 14px;
  line-height: 1;
}

.stock-chip-count {
  min-width: 1.4rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stock-tone) 22%, transparent);
  color: color-mix(in srgb, var(--stock-tone) 72%, #1a1a1a);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.stock-group {
  display: grid;
  gap: 10px;
  scroll-margin-top: 24px;
}

.stock-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.stock-group-emoji {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--stock-tone) 18%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stock-tone) 28%, transparent);
  font-size: 1rem;
  line-height: 1;
}

.stock-group-label {
  flex: 1;
}

.stock-group-count {
  min-width: 1.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stock-tone) 16%, var(--surface-subtle));
  color: color-mix(in srgb, var(--stock-tone) 70%, #222);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.stock-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stock-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 4.6rem;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--stock-tone) 24%, var(--border));
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stock-card-low {
  background: color-mix(in srgb, var(--warning-soft) 62%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 38%, var(--border));
}

.stock-card-empty {
  background: color-mix(in srgb, var(--danger-soft) 62%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 38%, var(--border));
}

.stock-med-name {
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.stock-qty-pill {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  min-width: 2.4rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.stock-qty-ok {
  color: #245c38;
  background: color-mix(in srgb, #7cbc8f 28%, var(--surface));
}

.stock-qty-low {
  color: var(--warning);
  background: var(--warning-soft);
}

.stock-qty-empty {
  color: var(--danger);
  background: var(--danger-soft);
}

.stock-tone-teal { --stock-tone: #2f7a6b; }
.stock-tone-rose { --stock-tone: #b4536a; }
.stock-tone-crimson { --stock-tone: #b33b4a; }
.stock-tone-violet { --stock-tone: #6f5b8c; }
.stock-tone-sky { --stock-tone: #3d7ea6; }
.stock-tone-amber { --stock-tone: #b07928; }
.stock-tone-cyan { --stock-tone: #3a8a9a; }
.stock-tone-red { --stock-tone: #b84a28; }
.stock-tone-blue { --stock-tone: #3f6ea0; }
.stock-tone-lime { --stock-tone: #5d8a3d; }
.stock-tone-stone { --stock-tone: #7a7166; }

.handoff-content {
  display: grid;
  gap: 22px;
}

.handoff-setup {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.handoff-physician-field {
  display: grid;
  gap: 6px;
  min-width: min(360px, 100%);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
}

.handoff-physician-field select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
}

.handoff-units {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.handoff-physicians {
  flex: 1 1 100%;
}

.handoff-units legend {
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
}

.handoff-unit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.handoff-unit-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.handoff-unit-list input {
  accent-color: var(--primary);
}

.handoff-cards {
  display: grid;
  gap: 12px;
}

.handoff-card {
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--paper);
}

.handoff-bed {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}

.handoff-patient-name {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-align: left;
  cursor: pointer;
}

.handoff-patient-name:hover {
  color: var(--primary-dark);
}

.handoff-meta,
.handoff-hints {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.handoff-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.handoff-hints span {
  padding: 2px 8px;
  border: 1px dashed var(--warning);
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 11px;
  font-weight: 750;
}

.handoff-summary,
.handoff-attention {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text);
}

.handoff-summary {
  display: grid;
  gap: 4px;
  font-size: 14px;
  line-height: 1.45;
}

.handoff-attention {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.4;
}

p.handoff-summary {
  display: block;
}

.handoff-disclaimer {
  margin: 8px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.exams-content {
  display: grid;
  gap: 22px;
}

.exams-toolbar-top,
.exams-header,
.flowsheet-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.exams-toolbar-top {
  align-items: center;
  flex-wrap: wrap;
}

.exams-summary-copy-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.exam-summary-fallback {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
}

.exam-summary-fallback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.exam-summary-fallback-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-summary-fallback .evolution-draft-output {
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.exams-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 680;
}

.exams-back svg {
  width: 16px;
  height: 16px;
}

.exams-header h1 {
  margin-bottom: 6px;
}

.exams-header-copy p,
.exams-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.exams-header-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
  min-width: min(280px, 100%);
}

.exams-header-actions .exams-last-collected {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
  white-space: nowrap;
}

.exams-header-actions .exams-last-collected--empty {
  min-height: 1.45em;
}

.exams-pending-count {
  margin: 0;
  color: var(--warning);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.lab-pending-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--warning);
  border-radius: 12px;
  background: var(--warning-soft);
}

.lab-pending-banner strong {
  display: block;
  margin-bottom: 8px;
  color: var(--warning);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lab-pending-banner ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lab-pending-banner li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 650;
}

.lab-pending-banner time {
  color: var(--text-faint);
  font-weight: 650;
  white-space: nowrap;
}

.prescription-validity {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.prescription-validity.is-stale {
  padding: 10px 14px;
  border: 1px dashed var(--warning);
  border-radius: 12px;
  background: var(--warning-soft);
  color: var(--warning);
}

.prescription-changes {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--paper);
}

.prescription-changes strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prescription-changes ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.prescription-changes li span {
  margin-right: 6px;
  font-weight: 760;
}

.prescription-changes p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.prescription-change-added span {
  color: var(--primary-dark);
}

.prescription-change-removed span {
  color: var(--danger);
}

.prescription-change-modified span {
  color: var(--warning);
}

.prescription-change-diet {
  color: var(--text);
}

.prescription-diet ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prescription-diet li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.prescription-diet li span {
  color: var(--text-soft);
  font-size: 13px;
}

.prescription-section {
  margin: 16px 0;
}

.prescription-section h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 14px;
}

.prescription-antimicrobials {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prescription-antimicrobials li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
}

.prescription-antimicrobials li span:not(.badge) {
  color: var(--text-soft);
}

.evolution-source-toggle {
  justify-content: center;
  width: fit-content;
  margin: 0 auto 14px;
}

.drawer-changes {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--paper);
}

.drawer-changes header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.drawer-changes h3 {
  margin: 0;
  font-size: 15px;
}

.drawer-changes h4 {
  margin: 12px 0 4px;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.drawer-changes ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
}

.drawer-changes p {
  margin: 0;
  font-size: 13px;
}

.drawer-changes li span {
  margin-right: 4px;
  font-weight: 760;
}

.drawer-changes li.flag-high strong {
  color: var(--danger);
}

.drawer-changes li.flag-low strong {
  color: var(--blue);
}

.drawer-changes time {
  color: var(--text-faint);
}

.drawer-changes .drawer-changes-note {
  margin-top: 12px;
  color: var(--text-faint);
  font-size: 11px;
}

.handoff-changes strong {
  margin-right: 4px;
  font-size: 11px;
}

.evolution-draft {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.evolution-draft-base {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.evolution-draft-label {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.evolution-draft-notes {
  width: 100%;
  min-height: 140px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.evolution-draft-notes:focus-visible {
  outline: 3px solid rgb(79 122 44 / 38%);
  outline-offset: 1px;
}

.evolution-draft-actions,
.evolution-draft-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.evolution-draft-result-head {
  justify-content: space-between;
}

.evolution-draft-result-head h3 {
  margin: 0;
  font-size: 14px;
}

.evolution-draft-hint {
  color: var(--text-soft);
  font-size: 12px;
}

.evolution-draft-result {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.evolution-draft-warning {
  margin: 0;
  color: var(--warning);
  font-size: 13px;
}

.evolution-draft-output {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font: 13px/1.6 Consolas, "Cascadia Mono", monospace;
  white-space: pre;
}

.history-readmission {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px dashed var(--warning);
  border-radius: 12px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 13px;
  font-weight: 700;
}

.history-transfers {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.history-transfers time {
  margin-right: 10px;
  color: var(--text-faint);
}

.history-admission {
  margin-bottom: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.history-admission summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
}

.history-admission summary span:not(.badge) {
  color: var(--text-soft);
}

.history-admission dl {
  display: grid;
  gap: 4px 12px;
  margin: 12px 0 0;
  font-size: 13px;
}

.history-admission dt {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-admission dd {
  margin: 0 0 8px;
  white-space: pre-line;
}

.history-author {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.prescription-devices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.prescription-devices span {
  padding: 5px 10px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.prescription-devices-note {
  margin: 8px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.prescription-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.prescription-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.prescription-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.prescription-table td .badge {
  margin-left: 6px;
}

.prescription-table small {
  display: block;
  margin-top: 4px;
  color: var(--text-faint);
}

.prescription-table tr.is-suspended td {
  color: var(--text-faint);
  text-decoration: line-through;
}

.prescription-note {
  color: var(--text-soft);
  white-space: pre-line;
}

.prescription-care summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.prescription-care ul {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
}

.prescription-care li span,
.prescription-care li small {
  margin-left: 6px;
  color: var(--text-faint);
}

.lab-doc--pending {
  border-style: dashed;
}

.lab-doc--pending .imaging-pending-badge {
  display: block;
  margin-top: 6px;
}

.exams-docs-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.exams-docs-inline a {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 650;
}

.exams-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.exams-metrics article {
  padding: 12px 14px;
  border: 1px solid #d4b06a;
  border-left: 6px solid var(--gold);
  border-radius: 12px;
  background: var(--paper);
}

.exams-metrics article.is-alert {
  border-color: #d45a32;
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.exams-metrics article.is-ok {
  border-color: #7aaa3c;
  border-left-color: var(--primary);
  background: var(--primary-soft);
}

.exams-metrics article.is-alert strong {
  color: var(--danger);
}

.exams-metrics article.is-ok strong {
  color: var(--primary-dark);
}

.exams-metrics span {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.exams-metrics strong {
  font-size: 20px;
  letter-spacing: -0.03em;
}

.flowsheet-toolbar {
  align-items: center;
  flex-wrap: wrap;
}

.flowsheet-toolbar .exam-search {
  flex: 1 1 240px;
  margin: 0;
}

.flowsheet-toolbar .exam-search input {
  height: 40px;
}

.flowsheet-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flowsheet-filters button[aria-pressed="true"] {
  border-color: var(--primary-dark);
  background: var(--primary);
  color: var(--on-primary);
}

.exam-layout-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 2px 0 rgb(196 146 42 / 22%);
}

.exam-layout-toggle button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 2px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 750;
}

.exam-layout-toggle button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 4px 12px rgb(79 122 44 / 28%);
}

.exam-layout-toggle button:hover:not([aria-pressed="true"]) {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.exam-layout-toggle button:focus-visible {
  outline: 3px solid rgb(79 122 44 / 38%);
  outline-offset: 1px;
}

.exam-kind-tabs {
  position: relative;
  display: flex;
  width: fit-content;
  min-height: 46px;
  justify-self: center;
  margin-inline: auto;
  padding: 4px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 0 rgb(196 146 42 / 22%);
}

.exam-kind-indicator {
  position: absolute;
  top: 4px;
  left: 0;
  z-index: 0;
  height: calc(100% - 8px);
  border-radius: 8px;
  background: var(--primary);
  box-shadow: 0 4px 12px rgb(79 122 44 / 28%);
  pointer-events: none;
  transition: transform 320ms ease, width 320ms ease;
}

.exam-kind-tabs button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition: color 320ms ease;
}

.exam-kind-tabs button[aria-selected="true"] {
  color: var(--on-primary);
}

.exam-kind-tabs button:hover:not([aria-selected="true"]) {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.exam-kind-tabs button:focus-visible {
  outline: 3px solid rgb(79 122 44 / 38%);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .exam-kind-indicator,
  .exam-kind-tabs button {
    transition: none;
  }
}

.exam-kind-tabs + .lab-panel {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 0;
}

.drawer-content .exam-kind-tabs {
  margin-top: 8px;
}

.drawer-content .exam-kind-tabs button {
  min-height: 34px;
  font-size: 12px;
}

.evolution-calendar {
  width: min(100%, 360px);
  margin-inline: auto;
  padding: 10px 12px 12px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 2px 0 rgb(196 146 42 / 22%);
}

.evolution-calendar-fallback {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  text-align: center;
}

.evolution-calendar-header {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.evolution-calendar-header strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  text-align: center;
  text-transform: capitalize;
}

.evolution-calendar-header span {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

.evolution-calendar-nav {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--primary-dark);
}

.evolution-calendar-nav svg {
  width: 16px;
  height: 16px;
}

.evolution-calendar-nav:hover:not(:disabled) {
  background: var(--primary-soft);
}

.evolution-calendar-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.evolution-calendar-nav:focus-visible,
.evolution-cal-day:focus-visible {
  outline: 3px solid rgb(79 122 44 / 38%);
  outline-offset: 1px;
}

.evolution-calendar-weekdays,
.evolution-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.evolution-calendar-weekdays {
  margin-bottom: 4px;
}

.evolution-calendar-weekdays span {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-align: center;
}

.evolution-cal-day {
  display: grid;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 650;
}

.evolution-cal-day.is-pad {
  visibility: hidden;
}

.evolution-cal-day.is-stay {
  background: var(--warning-soft);
  color: var(--text);
}

.evolution-cal-day.is-noted {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800;
}

button.evolution-cal-day.is-noted {
  cursor: pointer;
}

.evolution-cal-day.is-noted:hover,
.evolution-cal-day.is-noted[aria-current="date"] {
  background: var(--primary);
  color: var(--on-primary);
}

.evolution-cal-day.is-noted[aria-current="date"] {
  box-shadow: 0 4px 12px rgb(79 122 44 / 28%);
}

.evolution-cal-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--gold);
}

.evolution-cal-day.is-noted.is-today[aria-current="date"] {
  box-shadow: inset 0 0 0 1.5px var(--gold), 0 4px 12px rgb(79 122 44 / 28%);
}

.evolution-calendar-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 10px 0 0;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
}

.evolution-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.evolution-calendar-legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--warning-soft);
}

.evolution-calendar-legend i.is-noted {
  background: var(--primary-soft);
}

.evolution-empty {
  display: grid;
  max-width: 620px;
  justify-items: center;
  margin: 34px auto 0;
  padding: 42px 24px;
  border: 1px dashed var(--gold);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.evolution-empty h2 {
  margin: 12px 0 6px;
  color: var(--ink);
  font-size: 20px;
}

.evolution-empty p {
  margin: 0;
}

.evolution-empty-icon {
  width: 42px;
  height: 42px;
  color: var(--primary);
}

.evolution-timeline {
  display: grid;
  max-width: 1040px;
  gap: 22px;
  margin: 24px auto 0;
}

.evolution-day {
  position: relative;
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  gap: 18px;
  scroll-margin-top: 16px;
}

.evolution-day.is-targeted .evolution-day-dot {
  background: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.evolution-day:not(:last-child)::before {
  position: absolute;
  top: 38px;
  bottom: -28px;
  left: 9px;
  width: 2px;
  background: linear-gradient(var(--gold), rgb(196 146 42 / 18%));
  content: "";
}

.evolution-day-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-top: 8px;
}

.evolution-day-dot {
  z-index: 1;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

.evolution-day-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.evolution-day-header span:last-child {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.evolution-day-items {
  display: grid;
  gap: 10px;
}

.evolution-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgb(54 70 38 / 7%);
}

.evolution-card[open] {
  border-color: rgb(79 122 44 / 35%);
  box-shadow: 0 8px 24px rgb(54 70 38 / 10%);
}

.evolution-card summary {
  display: grid;
  min-height: 74px;
  grid-template-columns: 58px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.evolution-card summary::-webkit-details-marker {
  display: none;
}

.evolution-card summary:hover {
  background: var(--primary-soft);
}

.evolution-time {
  padding: 7px 6px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.evolution-summary-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.evolution-summary-copy strong,
.evolution-summary-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evolution-summary-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.evolution-summary-copy span {
  color: var(--muted);
  font-size: 12px;
}

.evolution-chevron {
  color: var(--muted);
  font-size: 20px;
  transition: transform 180ms ease;
}

.evolution-card[open] .evolution-chevron {
  transform: rotate(180deg);
}

.evolution-body {
  padding: 18px 22px 22px;
  border-top: 1px solid var(--line);
  background: rgb(249 247 239 / 55%);
  color: var(--ink);
  font-family: "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.vitals-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 72%);
}

.vitals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.vitals-table th,
.vitals-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.vitals-table th {
  color: var(--muted);
  font-weight: 600;
  background: rgb(249 247 239 / 80%);
}

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

.vitals-toolbar {
  display: flex;
  gap: 12px;
}

.vitals-period-note {
  color: var(--text-faint);
  font-size: 12px;
}

.vitals-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.vitals-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--border-strong);
  border-radius: 12px;
  background: var(--paper);
}

.vitals-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vitals-card header strong {
  color: var(--text-soft);
}

.vitals-card-value {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.vitals-card-when,
.vitals-card-range,
.vitals-card-empty {
  margin: 0;
  color: var(--text-faint);
  font-size: 11px;
}

.vitals-card-range em {
  margin-left: 4px;
  color: var(--danger);
  font-style: normal;
  font-weight: 700;
}

.vitals-card.flag-normal {
  border-left-color: var(--primary);
}

.vitals-card.flag-high {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.vitals-card.flag-high .vitals-card-value {
  color: var(--danger);
}

.vitals-card.flag-low {
  border-left-color: var(--low-3);
  background: var(--low-1);
}

.vitals-card.flag-low .vitals-card-value {
  color: var(--blue);
}

.vitals-card.is-empty {
  opacity: 0.6;
}

.vitals-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 10px;
}

.vitals-chart {
  margin: 0;
  padding: 10px 12px 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
}

.vitals-chart figcaption {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
}

.vitals-chart figcaption span {
  color: var(--text-faint);
}

.vitals-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.vitals-chart-band {
  fill: var(--primary-soft);
  opacity: 0.35;
}

.vitals-chart-ref {
  stroke: var(--text-faint);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.vitals-chart-day {
  stroke: var(--border);
  stroke-width: 1;
}

.vitals-chart-label {
  fill: var(--text-faint);
  font-size: 11px;
}

.vitals-chart-line {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.vitals-chart-line.series-1 {
  stroke: var(--text-soft);
  stroke-dasharray: 5 3;
}

.vitals-day-row th {
  padding: 6px 12px;
  color: var(--text-soft);
  font-size: 12px;
  text-transform: capitalize;
  background: var(--surface-subtle);
}

.vitals-cell.flag-high {
  color: var(--danger);
  font-weight: 700;
  background: var(--danger-soft);
}

.vitals-cell.flag-low {
  color: var(--blue);
  font-weight: 700;
  background: var(--low-1);
}

.vitals-cell.flag-uninterpreted {
  color: var(--text-faint);
}

.vitals-cell.flag-implausible {
  color: var(--warning);
  text-decoration: underline dotted;
  cursor: help;
}

@media (max-width: 700px) {
  .exam-kind-tabs {
    width: 100%;
  }

  .exam-kind-tabs button {
    flex: 1 1 0;
    justify-content: center;
    padding-inline: 8px;
    font-size: 12px;
  }

  .evolution-day {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .evolution-day:not(:last-child)::before {
    display: none;
  }

  .evolution-card summary {
    grid-template-columns: 52px minmax(0, 1fr) 20px;
    padding-inline: 12px;
  }

  .evolution-body {
    padding-inline: 16px;
  }
}

.imaging-timeline {
  display: grid;
  gap: 22px;
  margin-top: 16px;
}

.imaging-day {
  display: grid;
  gap: 12px;
  padding-left: 18px;
  border-left: 2px solid var(--border-strong);
}

.imaging-day-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 0 -18px;
  padding-left: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.imaging-day-label::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 2px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--background);
}

.imaging-docs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.imaging-doc {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}

button.lab-doc.imaging-doc {
  width: 100%;
  margin: 0;
  appearance: none;
  font: inherit;
  text-align: left;
}

.imaging-doc--text {
  position: relative;
  flex-direction: row;
  align-items: flex-start;
}

.imaging-doc--text::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: auto;
  margin-top: 6px;
  border-right: 2px solid var(--text-faint);
  border-top: 2px solid var(--text-faint);
}

.imaging-report-overlay {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  overflow: hidden;
  background: transparent;
}

.imaging-report-overlay[hidden] {
  display: none;
}

.imaging-report-overlay.is-closing {
  pointer-events: none;
}

.imaging-report-scrim {
  position: absolute;
  inset: 0;
  background: rgb(58 44 31 / 42%);
}

.imaging-report-overlay.is-settled .imaging-report-scrim {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.imaging-report-morph {
  position: fixed;
  z-index: 1;
  box-sizing: border-box;
  pointer-events: none;
  border: 1px solid var(--border-strong);
  border-left-width: 6px;
  border-radius: 16px;
  background: var(--surface);
  transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
  transform-origin: 0 0;
  backface-visibility: hidden;
}

.imaging-doc.is-morphing {
  opacity: 0;
}

.imaging-report-motion {
  position: relative;
  z-index: 2;
}

.imaging-report-dialog {
  position: relative;
  display: flex;
  width: min(720px, 92vw);
  height: min(70vh, 720px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: var(--surface);
  box-shadow:
    0 28px 80px rgb(58 44 31 / 24%),
    inset 0 1px 0 rgb(255 255 255 / 55%);
}

.imaging-report-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid rgb(196 164 116 / 35%);
}

.imaging-report-heading {
  min-width: 0;
  flex: 1;
}

.imaging-report-heading h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.imaging-report-heading p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.imaging-report-dialog .imaging-kind-badge {
  flex: 0 0 auto;
  min-width: 58px;
  margin-top: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.imaging-report-pacs {
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 6px 10px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.imaging-report-pacs:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.imaging-report-pacs[hidden] {
  display: none;
}

.imaging-report-body {
  min-height: 0;
  flex: 1;
  margin: 0;
  padding: 18px 22px 24px;
  overflow: auto;
  color: var(--text);
  background: rgb(255 255 255 / 42%);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.imaging-report-body strong {
  font-weight: 750;
}

.imaging-report-dialog.imaging-doc--rx,
.imaging-report-dialog.imaging-doc--tc,
.imaging-report-dialog.imaging-doc--tc-cc,
.imaging-report-dialog.imaging-doc--angiotc,
.imaging-report-dialog.imaging-doc--rm,
.imaging-report-dialog.imaging-doc--us,
.imaging-report-dialog.imaging-doc--mg,
.imaging-report-dialog.imaging-doc--other {
  align-items: stretch;
}

.imaging-doc .imaging-kind-badge {
  flex: 0 0 auto;
  min-width: 58px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.imaging-doc-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.imaging-doc-copy strong {
  font-size: 14px;
}

.imaging-doc--rx {
  border-color: #d4b06a;
  border-left: 6px solid var(--gold);
  background: var(--warning-soft);
}

.imaging-doc--rx .imaging-kind-badge {
  border-color: var(--gold);
  background: #f3d48a;
  color: #7a4e0c;
}

.imaging-doc--tc {
  border-color: #7aaa3c;
  border-left: 6px solid var(--primary);
  background: var(--primary-soft);
}

.imaging-doc--tc .imaging-kind-badge {
  border-color: var(--primary);
  background: #cfe4b0;
  color: var(--primary-dark);
}

.imaging-doc--tc-cc {
  border-color: #6aa89c;
  border-left: 6px solid var(--teal);
  background: var(--teal-soft);
}

.imaging-doc--tc-cc .imaging-kind-badge {
  border-color: var(--teal);
  background: #b7ddd5;
  color: #1f4f47;
}

.imaging-doc--angiotc {
  border-color: #c89aa4;
  border-left: 6px solid var(--wine);
  background: var(--wine-soft);
}

.imaging-doc--angiotc .imaging-kind-badge {
  border-color: var(--wine);
  background: #e8c5cc;
  color: #6b2c38;
}

.imaging-doc--rm,
.imaging-doc--us,
.imaging-doc--mg,
.imaging-doc--other {
  border-left: 6px solid var(--border-strong);
}

.imaging-doc--pending {
  position: relative;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  border-style: dashed;
  opacity: 0.96;
}

.imaging-doc-main {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
}

.imaging-doc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.imaging-pending-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 2px;
  padding: 2px 8px;
  border: 1px solid var(--warning);
  border-radius: 999px;
  background: #f7c968;
  color: #6e4309;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.imaging-pending-pacs {
  flex: 0 0 auto;
  max-width: 100%;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary-dark);
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.imaging-pending-pacs:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

button.imaging-pending-pacs {
  appearance: none;
  cursor: pointer;
}

button.imaging-pending-pacs:disabled {
  opacity: 0.6;
  cursor: wait;
}

.exam-request-sheet {
  display: none;
}

.exam-request-form {
  box-sizing: border-box;
  max-width: 190mm;
  margin: 0 auto;
  border: 2px solid #000;
  color: #000;
  font-family: Tahoma, Arial, sans-serif;
}

.exam-request-hospital {
  padding: 8px 10px 6px;
  border-bottom: 1px solid #000;
  text-align: center;
}

.exam-request-hospital strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.exam-request-hospital span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
}

.exam-request-title {
  margin: 0;
  padding: 8px 10px 2px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

.exam-request-service {
  margin: 0;
  padding: 0 10px 8px;
  border-bottom: 1px solid #000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.exam-request-grid {
  display: block;
}

.exam-request-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.exam-request-cell {
  min-width: 0;
  padding: 6px 8px;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
}

.exam-request-cell:last-child,
.exam-request-cell--wide {
  border-right: 0;
}

.exam-request-cell--wide {
  grid-column: 1 / -1;
}

.exam-request-cell span {
  display: block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.exam-request-cell strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.exam-request-sign {
  padding: 20px 10px 10px;
  text-align: center;
}

.exam-request-sign hr {
  width: 220px;
  margin: 0 auto 6px;
  border: 0;
  border-top: 1px solid #000;
}

.exam-request-sign span {
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.exam-request-footnote {
  margin: 0;
  padding: 0 10px 8px;
  color: #333;
  font-size: 8px;
  text-align: center;
}

@media print {
  body.is-exam-request .app-shell,
  body.is-exam-request .nav-backdrop,
  body.is-exam-request .drawer,
  body.is-exam-request .drawer-backdrop,
  body.is-exam-request .loading-overlay,
  body.is-exam-request .census-diff-overlay,
  body.is-exam-request .imaging-report-overlay,
  body.is-exam-request #toast-region {
    display: none !important;
  }

  body.is-exam-request,
  body.is-exam-request #exam-request-sheet {
    display: block !important;
    background: #fff;
    color: #1b1b1b;
  }

  body.is-exam-request #exam-request-sheet {
    position: static;
    width: auto;
    margin: 0;
    padding: 0;
  }
}

.lab-doc.imaging-doc--rx:hover {
  border-color: var(--gold);
  background: #f8ecc8;
}

.lab-doc.imaging-doc--tc:hover {
  border-color: var(--primary);
  background: #dce8c0;
}

.lab-doc.imaging-doc--tc-cc:hover {
  border-color: var(--teal);
  background: #cce6df;
}

.lab-doc.imaging-doc--angiotc:hover {
  border-color: var(--wine);
  background: #f0d6db;
}

.imaging-timeline--compact {
  gap: 14px;
  margin-top: 12px;
}

.imaging-timeline--compact .imaging-docs {
  grid-template-columns: 1fr;
  gap: 8px;
}

.imaging-timeline--compact .imaging-doc {
  padding: 10px 12px;
}

.drawer-content .imaging-timeline {
  margin-top: 12px;
}

.panel-group.has-cards {
  overflow: visible;
}

.exam-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px;
}

.exam-float-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgb(58 44 31 / 10%);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.exam-float-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgb(27 49 58 / 14%);
}

.exam-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.exam-card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.exam-card-head span,
.exam-card-ref,
.exam-card-delta,
.exam-float-card time {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
}

.exam-card-value {
  display: grid;
  gap: 2px;
  margin: 0;
}

.exam-card-value strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 28px;
  letter-spacing: -0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.exam-card-value .cell-mark {
  font-size: 20px;
}

.exam-card-value em {
  font-style: normal;
  font-size: 11px;
  font-weight: 750;
  color: var(--text-soft);
}

.exam-card-ref,
.exam-card-delta {
  margin: 0;
}

.exam-card-ref {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.exam-card-spark .sparkline {
  width: 100%;
  height: 40px;
}

.exam-card-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam-card-chip {
  display: grid;
  min-width: 52px;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--surface-subtle);
  text-align: right;
}

.exam-card-chip small,
.exam-card-chip strong {
  display: block;
}

.exam-card-chip small {
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.exam-card-chip strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.exam-card-chip.is-latest {
  box-shadow: inset 0 0 0 1px var(--primary);
}

.exam-float-card.flag-high .exam-card-value em,
.exam-card-chip.flag-high strong {
  color: var(--warning);
}

.exam-float-card.flag-low .exam-card-value em,
.exam-card-chip.flag-low strong {
  color: var(--blue);
}

.exam-float-card.flag-high.sev-1 {
  border-color: #e8c070;
  background: linear-gradient(180deg, var(--high-1) 0%, var(--surface) 46%);
}

.exam-float-card.flag-high.sev-2 {
  border-color: #e0a060;
  background: linear-gradient(180deg, var(--high-2) 0%, var(--surface) 52%);
}

.exam-float-card.flag-high.sev-3 {
  border-color: #d47060;
  background: linear-gradient(180deg, var(--high-3) 0%, var(--surface) 54%);
}

.exam-float-card.flag-low.sev-1 {
  border-color: #a8c4e8;
  background: linear-gradient(180deg, var(--low-1) 0%, var(--surface) 46%);
}

.exam-float-card.flag-low.sev-2 {
  border-color: #7aa0d0;
  background: linear-gradient(180deg, var(--low-2) 0%, var(--surface) 52%);
}

.exam-float-card.flag-low.sev-3 {
  border-color: #5a82b8;
  background: linear-gradient(180deg, var(--low-3) 0%, var(--surface) 54%);
}

.exam-float-card.flag-normal {
  border-color: #c5d49a;
}

.exam-float-card.qual-ok {
  border-color: #c5d49a;
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--surface) 50%);
}

.exam-float-card.qual-alert,
.exam-float-card.qual-warn {
  border-color: #e09a58;
  background: linear-gradient(180deg, #f8d4b0 0%, var(--surface) 50%);
}

.exam-card-chip.qual-ok {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.exam-card-chip.qual-alert,
.exam-card-chip.qual-warn {
  background: #f8d4b0;
  color: #9b4d12;
}

.exam-card-chip.flag-high.sev-1 {
  background: var(--high-1);
}

.exam-card-chip.flag-high.sev-2 {
  background: var(--high-2);
}

.exam-card-chip.flag-high.sev-3 {
  background: var(--high-3);
}

.exam-card-chip.flag-low.sev-1 {
  background: var(--low-1);
}

.exam-card-chip.flag-low.sev-2 {
  background: var(--low-2);
}

.exam-card-chip.flag-low.sev-3 {
  background: var(--low-3);
}

.exam-float-card.flag-high.sev-3 .exam-card-value em {
  color: #7a2424;
}

.exam-float-card.flag-low.sev-3 .exam-card-value em {
  color: var(--primary-dark);
}

.flowsheet-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  color: var(--text-soft);
  font-size: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 650;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.legend-swatch.flag-low.sev-1 {
  background: var(--low-1);
  box-shadow: none;
}

.legend-swatch.flag-low.sev-2 {
  background: var(--low-2);
  box-shadow: none;
}

.legend-swatch.flag-low.sev-3 {
  background: var(--low-3);
  box-shadow: none;
}

.legend-swatch.flag-high.sev-1 {
  background: var(--high-1);
  box-shadow: none;
}

.legend-swatch.flag-high.sev-2 {
  background: var(--high-2);
  box-shadow: none;
}

.legend-swatch.flag-high.sev-3 {
  background: var(--high-3);
  box-shadow: none;
}

.legend-swatch.flag-normal {
  background: var(--surface);
}

.legend-swatch.qual-ok {
  background: var(--low-2);
  box-shadow: none;
}

.legend-swatch.qual-alert {
  background: var(--high-2);
  box-shadow: none;
}

.legend-note {
  color: var(--text-faint);
  font-weight: 500;
}

.exam-panels {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exam-panels-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.exam-panels-col,
.exam-panels-span {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.exam-panels > .is-wide {
  min-width: 0;
}

.panel-group {
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--panel-accent, var(--border-strong)) 64%, var(--border));
  border-left: 7px solid var(--panel-accent, var(--border-strong));
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-group.tone-red { --panel-accent: #d43820; --panel-soft: #f6d0c4; }
.panel-group.tone-slate { --panel-accent: #3e5266; --panel-soft: #dcd8ce; }
.panel-group.tone-amber { --panel-accent: #d47e0c; --panel-soft: #f4dca8; }
.panel-group.tone-violet { --panel-accent: #9a3260; --panel-soft: #efd0de; }
.panel-group.tone-teal { --panel-accent: #247a34; --panel-soft: #cfe8c8; }
.panel-group.tone-orange { --panel-accent: #d45412; --panel-soft: #f4d4b4; }
.panel-group.tone-fire { --panel-accent: #d02812; --panel-soft: #f6c8b8; }
.panel-group.tone-heart { --panel-accent: #c41e38; --panel-soft: #f2ccd4; }
.panel-group.tone-sun { --panel-accent: #e08c08; --panel-soft: #f6e4a8; }
.panel-group.tone-lab { --panel-accent: #4e8a1c; --panel-soft: #d8e8b8; }
.panel-group.tone-micro { --panel-accent: #245018; --panel-soft: #c8dcb4; }
.panel-group.tone-neutral { --panel-accent: #8a5428; --panel-soft: #ead8c0; }

.panel-group-header {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 0;
  border-bottom: 2px solid color-mix(in srgb, var(--panel-accent, var(--border-strong)) 68%, var(--border));
  background: var(--panel-soft, var(--surface-subtle));
  box-shadow: inset 0 -1px 0 rgb(255 255 255 / 35%);
  text-align: left;
}

.panel-group-header:hover {
  filter: brightness(0.97);
}

.panel-group.is-collapsed .panel-group-header {
  border-bottom: 0;
}

.panel-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 20px;
  font-weight: 800;
}

.panel-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.ink-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: -4px;
  mix-blend-mode: multiply;
}

.metric-glyph {
  width: 24px;
  height: 24px;
  margin-right: 6px;
  object-fit: contain;
  vertical-align: -6px;
  mix-blend-mode: multiply;
}

.panel-group-title svg {
  width: 16px;
  height: 16px;
  transition: transform 150ms ease;
}

.panel-group.is-collapsed .panel-group-title svg {
  transform: rotate(-90deg);
}

.flowsheet-wrap {
  overflow: auto;
  max-height: calc(100vh - 280px);
}

.flowsheet {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.flowsheet th,
.flowsheet td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 12px;
  vertical-align: middle;
}

.flowsheet thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.flowsheet .analyte-cell {
  position: sticky;
  z-index: 1;
  left: 0;
  width: 1%;
  max-width: 11rem;
  white-space: normal;
  line-height: 1.25;
  background: var(--surface);
  text-align: left;
}

.flowsheet thead .analyte-cell {
  z-index: 3;
}

.flowsheet .analyte-cell strong,
.flowsheet .analyte-cell span {
  display: block;
}

.flowsheet .analyte-cell span {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
}

.flowsheet tbody tr:hover .analyte-cell {
  background: var(--surface-subtle);
}

.flowsheet td.is-latest {
  box-shadow: inset 1px 0 0 var(--primary), inset -1px 0 0 var(--primary);
  font-weight: 750;
}

.flowsheet thead th.is-latest {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.flowsheet-cell {
  width: 1%;
  min-width: 88px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.flowsheet-cell.is-empty {
  color: var(--text-faint);
  background: var(--surface-subtle);
}

.flowsheet-cell .cell-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 14px;
}

.flowsheet-cell.is-text,
.flowsheet-cell.is-text .cell-value {
  justify-content: flex-start;
  white-space: normal;
  text-align: left;
  font-variant-numeric: normal;
}

.flowsheet-cell.is-text .cell-value {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.25;
  max-width: 220px;
}

.flowsheet-cell.is-text .culture-head {
  font-weight: 750;
}

.flowsheet-cell.is-text .culture-abx,
.flowsheet-cell.is-text .culture-detail {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, #5c6570);
}

.flowsheet-cell.is-text .culture-abx {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.cell-mark {
  font-weight: 800;
  line-height: 1;
}

.flowsheet-cell.flag-high .cell-mark {
  color: var(--danger);
}

.flowsheet-cell.flag-low .cell-mark {
  color: var(--blue);
}

.flowsheet-cell.qual-ok {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 750;
}

.flowsheet-cell.qual-alert {
  background: #f8d4b0;
  color: #9b4d12;
  font-weight: 750;
}

.flowsheet-cell.qual-warn {
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 750;
}

.flowsheet-cell.flag-normal {
  background: var(--surface);
}

.flowsheet .trend-cell {
  width: auto;
  min-width: 140px;
  padding: 6px 10px;
  background: var(--surface);
  text-align: left;
  vertical-align: middle;
  overflow: visible;
}

.exam-panels-col .flowsheet th,
.exam-panels-col .flowsheet td {
  padding: 6px 6px;
}

.exam-panels-col .flowsheet .analyte-cell {
  max-width: 9.5rem;
}

.exam-panels-col .flowsheet thead th:not(.analyte-cell):not(.trend-cell) {
  white-space: normal;
  max-width: 4.5rem;
  line-height: 1.25;
}

.exam-panels-col .flowsheet-cell {
  min-width: 62px;
}

.exam-panels-col .flowsheet .trend-cell {
  min-width: 104px;
  padding: 4px 6px;
}

.flowsheet thead .trend-cell {
  position: sticky;
  z-index: 2;
  top: 0;
}

.trend-empty {
  color: var(--text-faint);
}

.flowsheet-cell.flag-high {
  background: var(--high-1);
  color: var(--warning);
}

.flowsheet-cell.flag-low {
  background: var(--low-1);
  color: var(--blue);
}

.flowsheet-cell.flag-high.sev-1 {
  background: var(--high-1);
  color: var(--warning);
}

.flowsheet-cell.flag-high.sev-2 {
  background: var(--high-2);
  color: #8a4b10;
}

.flowsheet-cell.flag-high.sev-3 {
  background: var(--high-3);
  color: #7a2424;
}

.flowsheet-cell.flag-low.sev-1 {
  background: var(--low-1);
  color: var(--blue);
}

.flowsheet-cell.flag-low.sev-2 {
  background: var(--low-2);
  color: var(--primary);
}

.flowsheet-cell.flag-low.sev-3 {
  background: var(--low-3);
  color: var(--primary-dark);
}

.flowsheet-cell.flag-uninterpreted {
  background: var(--uninterpreted);
  color: var(--text-soft);
}

.lab-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1100px) {
  .exam-panels-pair {
    grid-template-columns: 1fr;
  }

  .exam-kind-tabs {
    width: 100%;
  }

  .exam-kind-tabs button {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding-inline: 6px;
    font-size: 12px;
  }

  .exam-kind-tabs .metric-glyph {
    display: none;
  }
}

@media (max-width: 700px) {
  .exams-view,
  .handoff-view {
    width: calc(100% - 28px);
    padding-top: 20px;
  }

  .exams-header,
  .exams-toolbar-top {
    flex-direction: column;
  }

  .exams-metrics {
    grid-template-columns: 1fr;
  }

  .exam-cards {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .handoff-setup {
    flex-direction: column;
    align-items: stretch;
  }
}

html[data-theme="pardo"] {
  color-scheme: dark;
  --background: #241c16;
  --surface: #32281f;
  --surface-subtle: #3d3126;
  --border: #5a4636;
  --border-strong: #8a6a4a;
  --text: #f4ead9;
  --text-soft: #d4c4ae;
  --text-faint: #a89278;
  --primary: #6ea043;
  --primary-dark: #b6d98a;
  --primary-soft: #243018;
  --blue-soft: #243018;
  --blue: #9ccc6a;
  --warning-soft: #4a3418;
  --warning: #e0a85a;
  --danger-soft: #4a2820;
  --danger: #e88868;
  --high-1: #4a3418;
  --high-2: #8a5a28;
  --high-3: #c47848;
  --low-1: #243018;
  --low-2: #4a6a30;
  --low-3: #8fbf5a;
  --uninterpreted: #3a3026;
  --gold: #e0b45a;
  --teal: #7ec8bc;
  --teal-soft: #1e3330;
  --wine: #e090a0;
  --wine-soft: #3a2428;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 28%);
  --shadow-md: 0 12px 32px rgb(0 0 0 / 40%);
  --chrome: rgb(42 32 24 / 94%);
  --chrome-bar: rgb(42 32 24 / 90%);
  --chrome-line: rgb(90 70 54 / 80%);
  --paper: #3a2e24;
  --table-head: #3d3126;
  --row-hover: #46392c;
  --table-ink: #f4ead9;
  --scrim: rgb(28 20 14 / 78%);
  --field: #2a221b;
  --on-primary: #fffef8;
}

html[data-theme="pardo"] body {
  background:
    radial-gradient(circle at 12% -8%, rgb(176 138 62 / 14%), transparent 26rem),
    radial-gradient(circle at 94% 0%, rgb(110 160 67 / 12%), transparent 22rem),
    var(--background);
}

html[data-theme="pardo"] img {
  mix-blend-mode: normal;
}

html[data-theme="pardo"] #patients-view::before,
html[data-theme="pardo"] #patients-view .metric-card::after,
html[data-theme="pardo"] #patients-view .list-card::after {
  mix-blend-mode: soft-light;
  opacity: 0.28;
}

html[data-theme="pardo"] .button-primary:hover:not(:disabled) {
  color: #241c16;
}

html[data-theme="pardo"] .lab-card.flag-normal {
  border-color: var(--primary);
  background: var(--primary-soft);
}

html[data-theme="pardo"] .evolution-body,
html[data-theme="pardo"] .vitals-table-wrap {
  background: var(--surface-subtle);
  color: var(--text);
}

html[data-theme="pardo"] .vitals-table th {
  background: var(--surface);
  color: var(--text-soft);
}

html[data-theme="pardo"] .lab-doc.imaging-doc--tc:hover {
  background: #31421c;
}

html[data-theme="pardo"] .lab-doc.imaging-doc--tc-cc:hover {
  background: #1e3330;
}

html[data-theme="pardo"] .lab-doc.imaging-doc--angiotc:hover {
  background: #3a2428;
}

html[data-theme="pardo"] .lab-doc.imaging-doc--rx:hover {
  background: #4a3418;
}

@media print {
  html[data-theme="pardo"] {
    color-scheme: light;
    --background: #efe6d4;
    --surface: #fbf6eb;
    --surface-subtle: #f4ead9;
    --border: #e0d2b8;
    --border-strong: #c4a474;
    --text: #3a2c1f;
    --text-soft: #6d5c48;
    --text-faint: #8d7b66;
    --primary: #4f7a2c;
    --primary-dark: #36561c;
    --primary-soft: #e2ecc4;
    --blue-soft: #e2ecc4;
    --blue: #3f6a28;
    --warning-soft: #f6e6c0;
    --warning: #9a5810;
    --danger-soft: #f6ddd0;
    --danger: #b84a28;
    --high-1: #f6e6c0;
    --high-2: #edc078;
    --high-3: #e09060;
    --low-1: #e2ecc4;
    --low-2: #b4d080;
    --low-3: #6e9a3c;
    --uninterpreted: #efe6d8;
    --gold: #c4922a;
    --teal: #2f6f64;
    --teal-soft: #dceee9;
    --wine: #8b3a4a;
    --wine-soft: #f6e8eb;
    --chrome: rgb(251 246 235 / 94%);
    --chrome-bar: rgb(251 246 235 / 90%);
    --chrome-line: rgb(203 184 150 / 70%);
    --paper: #fffaf0;
    --table-head: #f6f9fa;
    --row-hover: #f3faf8;
    --table-ink: #2b3d43;
    --scrim: rgb(244 247 249 / 82%);
    --field: #fff;
    --on-primary: #fffef8;
  }

  body.is-handoff .topbar,
  body.is-handoff #app-nav,
  body.is-handoff .nav-backdrop,
  body.is-handoff #patients-view,
  body.is-handoff #exams-view,
  body.is-handoff .drawer,
  body.is-handoff .drawer-backdrop,
  body.is-handoff .loading-overlay,
  body.is-handoff .census-diff-overlay,
  body.is-handoff #toast-region,
  body.is-handoff .exams-toolbar-top,
  body.is-handoff .handoff-setup,
  body.is-handoff [data-handoff-print] {
    display: none !important;
  }

  body.is-handoff,
  body.is-handoff .app-shell,
  body.is-handoff .app-main {
    display: block;
    min-height: 0;
    height: auto;
    overflow: visible;
  }

  body.is-handoff .handoff-view {
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  /* Grid não fragmenta no Chromium: a lista precisa ser bloco para o
     cartão poder quebrar de uma folha para a outra. */
  body.is-handoff .handoff-content,
  body.is-handoff .handoff-cards {
    display: block;
  }

  body.is-handoff .handoff-cards {
    break-inside: auto;
  }

  body.is-handoff .handoff-header {
    align-items: baseline;
    margin: 0 0 6px;
    padding: 0 0 4px;
    gap: 8px;
    border-bottom: 1px solid #ccc;
  }

  body.is-handoff .handoff-header h1 {
    margin: 0;
    font-size: 14px;
  }

  body.is-handoff .handoff-header .eyebrow,
  body.is-handoff .handoff-disclaimer {
    display: none !important;
  }

  body.is-handoff .handoff-card {
    margin: 0 0 5px;
    padding: 5px 7px;
    border-radius: 4px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.is-handoff .handoff-bed {
    margin: 0;
    gap: 6px;
    font-size: 11px;
  }

  body.is-handoff .handoff-patient-name {
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0;
  }

  body.is-handoff .handoff-meta,
  body.is-handoff .handoff-hints {
    margin: 1px 0 0;
    font-size: 10px;
  }

  body.is-handoff .handoff-hints {
    gap: 4px;
  }

  body.is-handoff .handoff-hints span {
    padding: 0 5px;
    font-size: 9px;
  }

  body.is-handoff .handoff-summary,
  body.is-handoff .handoff-attention {
    margin: 2px 0 0;
    padding: 0;
    gap: 1px;
    font-size: 11px;
    line-height: 1.35;
  }

  body.is-handoff .handoff-attention {
    font-size: 10px;
  }

  @page {
    size: A4;
    margin: 8mm;
  }
}

/* Síntese Sema */

:root {
  --sema-sev1: #d4a017;
  --sema-sev2: #e05a1c;
  --sema-sev3: #b31b2c;
  --sema-good: #4f7a2c;
  --sema-track: #efe4ce;
  --sema-track-line: #b89f78;
  --sema-core: #fffdf8;
  --sema-ink: #2b2118;
  --sema-plate: #fffdf8;
  --sema-frame: #6f5b3d;
  --sema-sys-neu: #3e516c;
  --sema-sys-cv: #8a3d3a;
  --sema-sys-resp: #3f6244;
  --sema-sys-ren: #2f6460;
  --sema-sys-gi: #8a6230;
  --sema-sys-inf: #8a4e32;
  --sema-sys-hem: #7a3544;
  --sema-sys-met: #6e5c28;
}

html[data-theme="pardo"] {
  --sema-sev1: #e0b45a;
  --sema-sev2: #eb8350;
  --sema-sev3: #f0606a;
  --sema-good: #9ccc6a;
  --sema-track: #2c241c;
  --sema-track-line: #6a5440;
  --sema-core: #241c16;
  --sema-ink: #f4ead9;
  --sema-plate: #2a221b;
  --sema-frame: #d4b88a;
  --sema-sys-neu: #b7c4d6;
  --sema-sys-cv: #e7b2aa;
  --sema-sys-resp: #b7d0b4;
  --sema-sys-ren: #a9d0cb;
  --sema-sys-gi: #e2c48a;
  --sema-sys-inf: #e2b497;
  --sema-sys-hem: #e3b3bc;
  --sema-sys-met: #ddd0a2;
}

@media print {
  html[data-theme="pardo"] {
    --sema-sev1: #c4922a;
    --sema-sev2: #d2622a;
    --sema-sev3: #a51f2d;
    --sema-good: #4f7a2c;
    --sema-track: #f1e7d3;
    --sema-track-line: #dccaa8;
    --sema-core: #fffaf0;
    --sema-ink: #3a2c1f;
    --sema-frame: #8f7a58;
    --sema-sys-neu: #3e516c;
    --sema-sys-cv: #8a3d3a;
    --sema-sys-resp: #3f6244;
    --sema-sys-ren: #2f6460;
    --sema-sys-gi: #8a6230;
    --sema-sys-inf: #8a4e32;
    --sema-sys-hem: #7a3544;
    --sema-sys-met: #6e5c28;
  }
}

.sema-view {
  display: grid;
  max-width: 1240px;
  gap: 22px;
  margin: 22px auto 0;
}

.sema-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 20px;
  align-items: center;
  overflow: hidden;
  min-height: 0;
  padding: 16px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 88% 50%, rgb(212 160 23 / 8%) 0%, transparent 42%),
    var(--paper);
  box-shadow: none;
}

.sema-hero-art {
  display: block;
  width: 132px;
  height: 132px;
  object-fit: contain;
  opacity: 0.92;
  animation: sema-hero-float 7s ease-in-out infinite;
}

html[data-theme="pardo"] .sema-hero {
  background: var(--surface);
}

.sema-hero-copy {
  position: relative;
  max-width: 560px;
}

.sema-hero h2 {
  margin: 2px 0 4px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2.2vw, 22px);
  letter-spacing: -0.01em;
}

.sema-hero p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.5;
}

.sema-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.sema-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.sema-chip.is-ok {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.sema-chip.is-pending {
  border-color: var(--gold);
  background: var(--warning-soft);
  color: var(--warning);
}

.sema-chip.is-warning {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.sema-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

.sema-glyph-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 0;
  padding: 28px 20px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 44%, var(--paper) 0 34%, transparent 72%),
    repeating-radial-gradient(
      circle at 50% 50%,
      transparent 0 18px,
      rgb(111 91 61 / 4%) 18px 19px,
      transparent 19px 36px
    ),
    var(--surface);
  box-shadow: var(--shadow-md);
}

.sema-glyph-card figcaption {
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

.sema-glyph {
  display: block;
  width: min(1164px, 100%);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 10px 26px rgb(58 44 31 / 12%));
  user-select: none;
}

.sema-glyph.is-mini {
  width: 112px;
  height: 112px;
}

.sema-sector {
  cursor: pointer;
  transition: opacity 160ms ease, filter 180ms ease;
}

.sema-sector.is-highlighted {
  filter: drop-shadow(0 0 6px rgb(212 160 23 / 35%));
}

.sema-glyph.is-dimmed .sema-sector {
  opacity: 0.22;
}

.sema-glyph.is-dimmed .sema-sector.is-highlighted {
  opacity: 1;
}

.sema-frame {
  fill: none;
  stroke: var(--sema-frame);
  stroke-width: 1.6;
}

.sema-notation-ring {
  fill: none;
  stroke: var(--sema-track-line);
  stroke-width: 0.65;
  stroke-dasharray: 2 5;
  opacity: 0.45;
}

.sema-spoke {
  stroke: var(--sema-track-line);
  stroke-width: 0.55;
  stroke-linecap: round;
  opacity: 0.32;
  stroke-dasharray: 8 10;
  animation: sema-spoke-flow 10s ease-in-out infinite;
}

.sema-spokes .sema-spoke:nth-child(odd) {
  animation-delay: -3s;
}

.sema-frame-soft {
  fill: none;
  stroke: var(--sema-track-line);
  stroke-width: 0.7;
  opacity: 0.55;
}

.sema-guide-ring {
  fill: none;
  stroke: var(--sema-track-line);
  stroke-width: 0.4;
  opacity: 0.35;
}

.sema-sector-track {
  fill: none;
  stroke: var(--sema-track-line);
  stroke-width: 0.95;
}

.sema-wash-motion {
  transform-box: fill-box;
  transform-origin: center;
  animation: sema-wash-drift 18s ease-in-out infinite;
}

.sema-wash-CV.sema-wash-motion,
.sema-wash-RESP.sema-wash-motion {
  animation-name: sema-wash-breathe;
}

.sema-wash-CV.sema-wash-motion { animation-duration: 7.6s; }
.sema-wash-RESP.sema-wash-motion { animation-duration: 10s; }
.sema-wash-REN.sema-wash-motion { animation-duration: 22s; }
.sema-wash-GI.sema-wash-motion { animation-duration: 16s; }
.sema-wash-INF.sema-wash-motion { animation-duration: 13s; }
.sema-wash-HEM.sema-wash-motion { animation-duration: 19s; }
.sema-wash-MET.sema-wash-motion { animation-duration: 15s; }

.sema-wash-art {
  filter: saturate(0.38);
}

.sema-wash-tint {
  opacity: 0.16;
}

.sema-wash-NEU .sema-wash-tint { fill: var(--sema-sys-neu); }
.sema-wash-CV .sema-wash-tint { fill: var(--sema-sys-cv); }
.sema-wash-RESP .sema-wash-tint { fill: var(--sema-sys-resp); }
.sema-wash-REN .sema-wash-tint { fill: var(--sema-sys-ren); }
.sema-wash-GI .sema-wash-tint { fill: var(--sema-sys-gi); }
.sema-wash-INF .sema-wash-tint { fill: var(--sema-sys-inf); }
.sema-wash-HEM .sema-wash-tint { fill: var(--sema-sys-hem); }
.sema-wash-MET .sema-wash-tint { fill: var(--sema-sys-met); }

@keyframes sema-wash-drift {
  0%,
  100% { transform: translate(0, 0); }
  50% { transform: translate(-3.5%, 2%); }
}

@keyframes sema-wash-breathe {
  0%,
  100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-2%, 1%) scale(1.04); }
}

.sema-sector-fill {
  transform-box: view-box;
  transform-origin: center;
  animation: sema-grow 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.sema-sector-1 .sema-sector-fill { animation-delay: 50ms; }
.sema-sector-2 .sema-sector-fill { animation-delay: 100ms; }
.sema-sector-3 .sema-sector-fill { animation-delay: 150ms; }
.sema-sector-4 .sema-sector-fill { animation-delay: 200ms; }
.sema-sector-5 .sema-sector-fill { animation-delay: 250ms; }
.sema-sector-6 .sema-sector-fill { animation-delay: 300ms; }
.sema-sector-7 .sema-sector-fill { animation-delay: 350ms; }

.sema-sector-0 .sema-sector-label { animation-delay: 80ms; }
.sema-sector-1 .sema-sector-label { animation-delay: 120ms; }
.sema-sector-2 .sema-sector-label { animation-delay: 160ms; }
.sema-sector-3 .sema-sector-label { animation-delay: 200ms; }
.sema-sector-4 .sema-sector-label { animation-delay: 240ms; }
.sema-sector-5 .sema-sector-label { animation-delay: 280ms; }
.sema-sector-6 .sema-sector-label { animation-delay: 320ms; }
.sema-sector-7 .sema-sector-label { animation-delay: 360ms; }

@keyframes sema-grow {
  from {
    opacity: 0;
    transform: scale(0.35);
  }
}

@keyframes sema-label-pop {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
}

@keyframes sema-core-glow {
  0%,
  100% { opacity: 0.42; transform: scale(1); }
  50% { opacity: 0.72; transform: scale(1.03); }
}

@keyframes sema-spoke-flow {
  0%,
  100% { stroke-dashoffset: 0; opacity: 0.24; }
  50% { stroke-dashoffset: -12; opacity: 0.48; }
}

@keyframes sema-ring-turn {
  from { transform: rotate(0deg); transform-origin: center; }
  to { transform: rotate(360deg); transform-origin: center; }
}

@keyframes sema-arc-pulse {
  0%,
  100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@keyframes sema-trend-out {
  0%,
  100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}

@keyframes sema-trend-in {
  0%,
  100% { transform: translateX(0); }
  50% { transform: translateX(-2px); }
}

@keyframes sema-dot-pulse {
  0%,
  100% { opacity: 0.55; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes sema-susp-breathe {
  0%,
  100% { opacity: 0.82; }
  50% { opacity: 1; }
}

@keyframes sema-hero-float {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.sema-fill-solid {
  stroke: var(--sema-core);
  stroke-width: 1;
  opacity: 0.62;
}

.sema-fill-solid.sema-sev-1 { fill: var(--sema-sev1); }
.sema-fill-solid.sema-sev-2 { fill: var(--sema-sev2); }
.sema-fill-solid.sema-sev-3 { fill: var(--sema-sev3); }

.sema-fill-hatched {
  stroke-width: 1.2;
}

.sema-fill-hatched.sema-sev-1,
.sema-fill-dashed.sema-sev-1 { stroke: var(--sema-sev1); }
.sema-fill-hatched.sema-sev-2,
.sema-fill-dashed.sema-sev-2 { stroke: var(--sema-sev2); }
.sema-fill-hatched.sema-sev-3,
.sema-fill-dashed.sema-sev-3 { stroke: var(--sema-sev3); }

.sema-fill-dashed {
  fill: none;
  stroke-width: 1.8;
  stroke-dasharray: 4 3;
}

.sema-hatch.sema-sev-1 rect { fill: var(--sema-sev1); }
.sema-hatch.sema-sev-2 rect { fill: var(--sema-sev2); }
.sema-hatch.sema-sev-3 rect { fill: var(--sema-sev3); }

.sema-discarded {
  stroke: var(--text-faint);
  stroke-width: 1.2;
}

.sema-data-arc {
  fill: var(--sema-sev3);
  opacity: 0.88;
  animation: sema-arc-pulse 2.6s ease-in-out infinite;
}

.sema-trend-mark {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sema-trend-mark.sema-trend-up {
  stroke: var(--sema-sev3);
  animation: sema-trend-out 1.9s ease-in-out infinite;
}

.sema-trend-mark.sema-trend-down {
  stroke: var(--sema-good);
  animation: sema-trend-in 1.9s ease-in-out infinite;
}

.sema-trend-mark.sema-trend-flat,
.sema-trend-mark.sema-trend-unk { stroke: var(--text-faint); stroke-width: 1.6; }

.sema-pending-dot {
  fill: var(--sema-sev2);
  animation: sema-dot-pulse 1.6s ease-in-out infinite;
}

.sema-pending-dot:nth-of-type(2) { animation-delay: 0.25s; }
.sema-pending-dot:nth-of-type(3) { animation-delay: 0.5s; }

.sema-sector-label {
  transform-box: fill-box;
  transform-origin: center;
  animation: sema-label-pop 560ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

.sema-label-plate {
  fill: var(--sema-plate);
  stroke: var(--sema-track-line);
  stroke-width: 0.9;
}

.sema-label-plate.is-active {
  stroke: var(--sema-ink);
  stroke-width: 1.15;
}

.sema-sector-icon {
  opacity: 0.78;
}

.sema-sector-icon.is-active {
  opacity: 1;
}

html[data-theme="pardo"] .sema-sector-icon {
  opacity: 0.88;
}

.sema-hub-ring {
  fill: none;
  stroke: var(--sema-frame);
  stroke-width: 1.2;
}

.sema-core-glow {
  fill: var(--sema-track);
  opacity: 0.55;
  animation: sema-core-glow 4.5s ease-in-out infinite;
}

.sema-core {
  fill: var(--sema-core);
  stroke: var(--sema-ink);
  stroke-width: 1.7;
}

.sema-certainty-prov .sema-sector-fill {
  animation-duration: 780ms;
}

.sema-certainty-susp .sema-sector-fill {
  animation-name: sema-grow, sema-susp-breathe;
  animation-duration: 620ms, 2.8s;
  animation-delay: 0ms, 620ms;
  animation-iteration-count: 1, infinite;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1), ease-in-out;
}

.sema-core-stack {
  font-family: "Segoe UI", Inter, sans-serif;
}

.sema-core-day {
  fill: var(--sema-ink);
  font-size: 17px;
  font-weight: 400;
}

.sema-core-caption {
  fill: var(--text-soft);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.sema-sector-caption {
  font-family: "Segoe UI", Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  background: transparent;
}

.sema-sys-NEU .sema-sector-caption { fill: var(--sema-sys-neu); }
.sema-sys-CV .sema-sector-caption { fill: var(--sema-sys-cv); }
.sema-sys-RESP .sema-sector-caption { fill: var(--sema-sys-resp); }
.sema-sys-REN .sema-sector-caption { fill: var(--sema-sys-ren); }
.sema-sys-GI .sema-sector-caption { fill: var(--sema-sys-gi); }
.sema-sys-INF .sema-sector-caption { fill: var(--sema-sys-inf); }
.sema-sys-HEM .sema-sector-caption { fill: var(--sema-sys-hem); }
.sema-sys-MET .sema-sector-caption { fill: var(--sema-sys-met); }

.sema-sys-NEU .sema-label-plate.is-active { stroke: var(--sema-sys-neu); }
.sema-sys-CV .sema-label-plate.is-active { stroke: var(--sema-sys-cv); }
.sema-sys-RESP .sema-label-plate.is-active { stroke: var(--sema-sys-resp); }
.sema-sys-REN .sema-label-plate.is-active { stroke: var(--sema-sys-ren); }
.sema-sys-GI .sema-label-plate.is-active { stroke: var(--sema-sys-gi); }
.sema-sys-INF .sema-label-plate.is-active { stroke: var(--sema-sys-inf); }
.sema-sys-HEM .sema-label-plate.is-active { stroke: var(--sema-sys-hem); }
.sema-sys-MET .sema-label-plate.is-active { stroke: var(--sema-sys-met); }

.sema-band-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.sema-band-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sema-band-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.sema-band-swatch.sema-sev-1 { background: var(--sema-sev1); }
.sema-band-swatch.sema-sev-2 { background: var(--sema-sev2); }
.sema-band-swatch.sema-sev-3 { background: var(--sema-sev3); }

.sema-corner text {
  font: 700 8.5px "Segoe UI", Inter, sans-serif;
  letter-spacing: 0.06em;
}

.sema-corner path,
.sema-corner rect,
.sema-corner circle {
  fill: none;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.sema-corner-allergy path { stroke: var(--sema-sev3); }
.sema-corner-allergy text { fill: var(--sema-sev3); }
.sema-corner-directive rect { stroke: var(--wine); }
.sema-corner-directive text { fill: var(--wine); }
.sema-corner-isolation circle { stroke: var(--teal); stroke-dasharray: 3 2; }
.sema-corner-isolation text { fill: var(--teal); }

.sema-reading {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.sema-summary {
  margin: 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--gold);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-style: italic;
  line-height: 1.45;
}

.sema-context {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0;
  font-size: 13px;
}

.sema-context dt {
  padding-top: 2px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sema-context dd {
  margin: 0;
  color: var(--text);
}

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

.sema-problem {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 6px solid var(--sema-track-line);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.sema-problem--sev-1 { border-left-color: var(--sema-sev1); }
.sema-problem--sev-2 { border-left-color: var(--sema-sev2); }
.sema-problem--sev-3 { border-left-color: var(--sema-sev3); }

.sema-problem.is-highlighted,
.sema-system-card.is-highlighted {
  background: var(--surface-subtle);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.sema-problem-system {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.sema-problem-icon {
  width: 46px;
  height: 46px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.sema-problem-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.sema-problem-main header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
}

.sema-problem-name {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
}

.sema-problem--susp .sema-problem-name {
  font-style: italic;
}

.sema-problem--desc .sema-problem-name {
  color: var(--text-faint);
  text-decoration: line-through;
}

.sema-problem-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.sema-marks {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sema-pips {
  display: inline-flex;
  gap: 3px;
}

.sema-pip {
  width: 10px;
  height: 10px;
  border: 1.4px solid var(--sema-track-line);
  border-radius: 2px;
}

.sema-pip.is-on.sema-sev-1 { border-color: var(--sema-sev1); background: var(--sema-sev1); }
.sema-pip.is-on.sema-sev-2 { border-color: var(--sema-sev2); background: var(--sema-sev2); }
.sema-pip.is-on.sema-sev-3 { border-color: var(--sema-sev3); background: var(--sema-sev3); }

.sema-trend {
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.sema-trend-up { color: var(--sema-sev3); }
.sema-trend-down { color: var(--sema-good); }
.sema-trend-flat,
.sema-trend-unk { color: var(--text-faint); }

.sema-cert {
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sema-series {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sema-series-chip {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

.sema-series-chip.flag-high,
.sema-series-chip.flag-low {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.sema-series-chip .sema-series-name {
  grid-column: 1 / -1;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sema-series-chip .sparkline {
  width: 84px;
  height: 26px;
}

.sema-series-chip strong {
  color: var(--text);
  font-size: 15px;
}

.sema-series-chip.flag-high strong,
.sema-series-chip.flag-low strong {
  color: var(--danger);
}

.sema-series-chip small {
  color: var(--text-faint);
  font-size: 11px;
}

.sema-items {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.sema-items li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 4px;
}

.sema-item-plan b { color: var(--primary); }
.sema-item-pending b { color: var(--sema-sev2); }

.sema-evidence summary {
  width: fit-content;
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.sema-evidence blockquote {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  background: var(--surface-subtle);
  color: var(--text-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-style: italic;
}

.sema-general h4 {
  margin: 0 0 6px;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sema-prose summary {
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.sema-prose pre {
  overflow: auto;
  margin: 10px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 12.5px/1.6 Consolas, "Cascadia Mono", monospace;
  white-space: pre-wrap;
}

.sema-section-head {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.sema-section-head h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.sema-section-head p {
  margin: 0;
  color: var(--text-faint);
  font-size: 13px;
}

.sema-objective-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.sema-system-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--paper);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.sema-system-card.is-alert {
  border-top-color: var(--danger);
}

.sema-system-card.is-empty {
  border-top-color: var(--border-strong);
  opacity: 0.72;
}

.sema-system-card header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.sema-system-card header strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.sema-system-card header span {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.sema-system-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.sema-system-empty {
  margin: 0;
  color: var(--text-faint);
  font-size: 12.5px;
}

.sema-legend {
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.sema-legend-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.sema-minis {
  display: flex;
  gap: 18px;
}

.sema-mini {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.sema-legend-keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 13px;
}

.sema-legend-keys dt {
  color: var(--text);
  font-weight: 750;
}

.sema-legend-keys dd {
  margin: 0;
  color: var(--text-soft);
}

.sema-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 30px 24px 34px;
  border: 1px dashed var(--gold);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}

.sema-empty h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
}

.sema-empty p {
  max-width: 560px;
  margin: 0;
  color: var(--text-soft);
}

.sema-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.sema-illustration {
  object-fit: contain;
  mix-blend-mode: multiply;
  animation: sema-illustration-in 700ms ease both;
}

@keyframes sema-illustration-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

html[data-theme="pardo"] .sema-illustration,
html[data-theme="pardo"] .sema-problem-icon,
html[data-theme="pardo"] .sema-system-icon {
  padding: 6px;
  border-radius: 50%;
  background: var(--sema-plate);
}

.sema-review {
  display: grid;
  gap: 18px;
}

.sema-review-banner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  background: var(--warning-soft);
}

.sema-review-banner h2 {
  margin: 2px 0 6px;
  color: var(--text);
  font-size: 19px;
}

.sema-review-banner p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.sema-warnings {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--warning);
  font-size: 12.5px;
}

.sema-review-grid {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sema-editor {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 10px;
}

.sema-editor label {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sema-editor textarea {
  width: 100%;
  min-height: 380px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font: 13px/1.65 Consolas, "Cascadia Mono", monospace;
  resize: vertical;
  tab-size: 4;
}

.sema-editor textarea:focus-visible {
  outline: 3px solid rgb(79 122 44 / 38%);
  outline-offset: 1px;
}

.sema-cheatsheet {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
}

.sema-cheatsheet dt {
  color: var(--primary-dark);
  font-family: Consolas, "Cascadia Mono", monospace;
}

.sema-cheatsheet dd {
  margin: 0;
}

.sema-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sema-live {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.sema-live .sema-board {
  grid-template-columns: 1fr;
  gap: 18px;
}

.sema-live .sema-glyph {
  width: min(420px, 78vw);
}

.sema-live .sema-glyph-card {
  position: static;
  padding: 18px 14px 12px;
}

.sema-live-ok {
  margin: 0;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}

.sema-errors {
  padding: 10px 14px;
  border: 1px solid var(--danger);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.sema-errors ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

@media (max-width: 1100px) {
  .sema-review-grid,
  .sema-live .sema-board {
    grid-template-columns: 1fr;
  }

  .sema-editor {
    position: static;
  }
}

@media (max-width: 900px) {
  .sema-hero {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .sema-hero-art {
    width: 108px;
    height: 108px;
  }

  .sema-board,
  .sema-legend-body,
  .sema-problems {
    grid-template-columns: 1fr;
  }

  .sema-glyph-card {
    position: static;
    justify-self: stretch;
  }

  .sema-minis {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .sema-problem {
    grid-template-columns: 1fr;
  }

  .sema-problem-system {
    grid-auto-flow: column;
    justify-content: start;
    align-items: center;
  }

  .sema-review-banner {
    grid-template-columns: 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;
  }
}
