:root {
  --bg: #f3f7f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #607083;
  --line: rgba(23, 33, 43, 0.12);
  --blue: #2467a8;
  --teal: #128a7d;
  --green: #25845a;
  --amber: #b9821e;
  --red: #b14b55;
  --soft-blue: #e9f3fb;
  --soft-teal: #e6f6f3;
  --soft-green: #e9f5ed;
  --soft-amber: #fbf3df;
  --shadow: 0 18px 42px rgba(24, 41, 58, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(243, 247, 248, 0.98)),
    linear-gradient(90deg, rgba(18, 138, 125, 0.08), rgba(36, 103, 168, 0.07));
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", Arial, sans-serif;
}

body.embed-mode {
  min-height: 0;
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

button {
  font: inherit;
}

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

h1 {
  max-width: 880px;
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.22;
  letter-spacing: 0;
}

.lab-shell {
  width: min(1760px, calc(100vw - 28px));
  margin: 14px auto 28px;
}

body.embed-mode .lab-shell {
  width: min(1500px, calc(100vw - 16px));
  margin: 8px auto;
}

.lab-topbar,
.focus-card,
.outcome-card,
.trust-item,
.team-section,
.role-card,
.detail-modal {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lab-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
}

.lab-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lab-subtitle {
  max-width: 940px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.48;
}

.live-box {
  min-width: 280px;
  display: grid;
  justify-items: end;
  gap: 10px;
  color: var(--muted);
  text-align: right;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--soft-green);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.live-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(37, 132, 90, 0.34);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 132, 90, 0.34); }
  70% { box-shadow: 0 0 0 12px rgba(37, 132, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 132, 90, 0); }
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

body.embed-mode .trust-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trust-item {
  min-height: 78px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px;
  border-left: 4px solid var(--teal);
}

.trust-item:nth-child(2) {
  border-left-color: var(--blue);
}

.trust-item:nth-child(3) {
  border-left-color: var(--amber);
}

.trust-item:nth-child(4) {
  border-left-color: var(--green);
}

.trust-item strong {
  font-size: 16px;
  line-height: 1.2;
}

.trust-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.team-section {
  margin-top: 10px;
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.role-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

body.embed-mode .role-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.role-card {
  min-height: 148px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  background: #fbfdfe;
}

.role-card strong {
  font-size: 15px;
  line-height: 1.22;
}

.role-card p {
  margin-bottom: 0;
  color: #344758;
  font-size: 13px;
  line-height: 1.38;
}

.role-card span {
  align-self: end;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.live-work-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.live-work-card {
  min-height: 142px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfe, #f5fbfa);
}

.live-work-card span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-work-card strong {
  font-size: 16px;
  line-height: 1.2;
}

.live-work-card p {
  min-height: 38px;
  margin: 0;
  color: #344758;
  font-size: 13px;
  line-height: 1.34;
}

.live-work-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.28;
}

.mini-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3edf1;
}

.mini-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.story-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.45fr 0.95fr;
  gap: 12px;
  margin-top: 12px;
  align-items: stretch;
}

body.embed-mode .story-grid {
  grid-template-columns: 0.78fr 1.28fr 0.78fr;
}

.focus-card {
  min-height: 520px;
  padding: 20px;
}

body.embed-mode .focus-card {
  min-height: 390px;
  padding: 16px;
}

body.embed-mode .team-section {
  padding: 14px;
}

body.embed-mode .live-work-card {
  min-height: 132px;
}

.patient-card,
.route-card {
  display: grid;
  align-content: start;
  gap: 16px;
}

.patient-main {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--soft-teal), #ffffff);
}

.patient-main span {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d8f0ed;
  color: var(--teal);
  font-weight: 900;
}

.patient-main strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.24;
}

.patient-main p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.42;
}

.patient-facts {
  display: grid;
  gap: 10px;
}

.patient-facts div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.patient-facts span,
.outcome-card span,
.screen-block span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.patient-facts strong {
  line-height: 1.34;
}

.detail-button {
  min-height: 42px;
  border: 1px solid rgba(18, 138, 125, 0.22);
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
}

.detail-button:hover {
  filter: brightness(0.96);
}

.detail-button.compact {
  min-height: 36px;
  padding: 0 12px;
  background: #fff;
  color: var(--teal);
}

.operation-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
}

.operation-head,
.step-meter-top,
.screen-titleline,
.summary-actions,
.action-row,
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.channel-pill,
.screen-titleline span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.step-meter {
  padding: 14px;
  border-radius: 8px;
  background: #fbfdfe;
  border: 1px solid var(--line);
}

.step-meter-top {
  margin-bottom: 10px;
}

.step-meter-top span {
  color: var(--muted);
}

.meter-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf2;
}

.meter-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.work-screen {
  min-height: 0;
  padding: 16px;
  border-radius: 8px;
  background: #111b27;
  border: 1px solid rgba(17, 27, 39, 0.18);
  color: #f4f8fb;
}

.window-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.window-dots span:nth-child(1) { background: #ee6b62; }
.window-dots span:nth-child(2) { background: #f0bd58; }
.window-dots span:nth-child(3) { background: #45c7a8; }

.screen-subtitle {
  margin: 8px 0 14px;
  color: #aebdcb;
  line-height: 1.45;
}

.screen-blocks {
  display: grid;
  gap: 10px;
}

.screen-block {
  padding: 13px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.screen-block span {
  color: #8fdad1;
}

.screen-block strong {
  color: #f6fbff;
  font-size: 15px;
  line-height: 1.46;
}

.route-compact,
.full-route {
  display: grid;
  gap: 10px;
}

.route-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.route-step span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf2f5;
  color: var(--muted);
  font-weight: 850;
}

.route-step.done span {
  background: var(--soft-green);
  color: var(--green);
}

.route-step.current {
  border-color: rgba(18, 138, 125, 0.34);
  background: var(--soft-teal);
}

.route-step.current span {
  background: var(--teal);
  color: #fff;
}

.route-step.todo {
  opacity: 0.75;
}

.route-step p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.summary-actions,
.action-row {
  flex-wrap: wrap;
}

.summary-actions .detail-button {
  flex: 1;
  min-width: 150px;
}

.outcome-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.outcome-card {
  min-height: 112px;
  padding: 16px;
}

.outcome-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 27px;
  line-height: 1.1;
}

.outcome-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.35;
}

.action-card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(10, 18, 29, 0.54);
}

.modal-backdrop.hidden {
  display: none;
}

.detail-modal {
  width: min(1120px, calc(100vw - 34px));
  max-height: min(840px, calc(100vh - 34px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.modal-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

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

.modal-grid,
.clinical-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

.modal-feed {
  display: grid;
  gap: 10px;
}

.modal-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.modal-card.current {
  border-color: rgba(18, 138, 125, 0.35);
  background: var(--soft-teal);
}

.modal-card h3 {
  margin-bottom: 8px;
}

.modal-card p {
  margin-bottom: 8px;
  color: #324455;
  line-height: 1.46;
}

.modal-card small {
  color: var(--muted);
  line-height: 1.38;
}

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

.modal-list span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 1240px) {
  .story-grid,
  body.embed-mode .story-grid {
    grid-template-columns: 1fr;
  }

  .focus-card,
  body.embed-mode .focus-card {
    min-height: auto;
  }

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

  .role-strip,
  body.embed-mode .role-strip,
  .live-work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .lab-shell,
  body.embed-mode .lab-shell {
    width: min(100vw - 12px, 100%);
    margin: 6px auto 14px;
  }

  .lab-topbar,
  .operation-head,
  .section-head,
  .modal-head {
    display: grid;
  }

  .live-box {
    min-width: 0;
    justify-items: start;
    text-align: left;
  }

  h1 {
    font-size: 28px;
  }

  .trust-strip,
  body.embed-mode .trust-strip,
  .outcome-grid,
  .role-strip,
  body.embed-mode .role-strip,
  .live-work-grid,
  .modal-grid,
  .clinical-grid {
    grid-template-columns: 1fr;
  }

  .patient-main {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .patient-main span {
    width: 56px;
    height: 56px;
  }
}
