/* Application UI shared by the interactive showcase demos. Loaded only on
   showcase detail and full-screen demo pages, after site.css (reuses its tokens). */

.demo-root {
  position: relative;
  min-height: 560px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: #f4f6f9;
  text-align: left;
}
.demo-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 560px;
  color: var(--muted);
}
.demo-loading .i {
  width: 22px;
  height: 22px;
  color: var(--blue-500);
  animation: beat 1.2s ease-in-out infinite;
}
.demo-noscript {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
@keyframes beat {
  50% {
    transform: scale(1.18);
    opacity: 0.6;
  }
}

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 620px;
}
.app-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: #fff;
  overflow-y: auto;
  max-height: 760px;
}
.app-side-title {
  padding: 4px 8px 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.app-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 20px;
}
.app-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-title h3 {
  font-size: 18px;
  letter-spacing: -0.02em;
}
.app-title p {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}
.app-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.app-synthetic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff4dd;
  color: #7a4b00;
  font-size: 12px;
  font-weight: 600;
}
.app-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
}
.muted {
  color: var(--muted);
}

/* ---------- Controls ---------- */
.ab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.ab:hover {
  border-color: var(--navy-700);
}
.ab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ab-primary {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
}
.ab-primary:hover {
  background: var(--navy-700);
}
.ab-gold {
  background: var(--gold-500);
  border-color: var(--gold-500);
  color: var(--navy-950);
}
.ab-danger {
  background: var(--crit);
  border-color: var(--crit);
  color: #fff;
}
.ab-sm {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12.5px;
}
.ab-block {
  width: 100%;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(29, 131, 88, 0.5);
  animation: ping 1.8s infinite;
}
.is-paused .live-dot {
  background: var(--muted);
  animation: none;
}
@keyframes ping {
  70% {
    box-shadow: 0 0 0 7px rgba(29, 131, 88, 0);
  }
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: #e8edf3;
}
.seg button {
  min-height: 30px;
  padding: 5px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.seg button[aria-pressed='true'] {
  background: #fff;
  color: var(--navy-900);
  box-shadow: var(--shadow-sm);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.field input[type='search'],
.field select,
.app select,
.app input[type='search'] {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  font-size: 13.5px;
}
.field input[type='range'] {
  accent-color: var(--navy-700);
  width: 100%;
}
.field output {
  font-weight: 700;
  color: var(--navy-900);
}

/* ---------- Cards, KPIs, badges ---------- */
.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.kpi {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.kpi > span {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi b {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -0.02em;
  color: var(--navy-900);
}
.kpi b small {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.kpi > small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.kpi.ok b {
  color: var(--ok);
}
.kpi.warn b {
  color: var(--warn);
}
.kpi.crit b {
  color: var(--crit);
}
.kpi.alerting {
  border-color: #eeb3ab;
  box-shadow: 0 0 0 3px rgba(194, 54, 43, 0.1);
}
.kpi > small.delta-up {
  color: var(--crit);
}
.kpi > small.delta-down {
  color: var(--ok);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: #eef2f6;
  color: var(--ink-2);
  white-space: nowrap;
}
.pill.ok {
  background: #e4f4ec;
  color: #146343;
}
.pill.warn {
  background: #fff1d6;
  color: #7a4b00;
}
.pill.crit {
  background: #fde4e1;
  color: #9b2219;
}
.pill.info {
  background: var(--blue-50);
  color: var(--navy-700);
}
.sdot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--ok);
}
.sdot.warn {
  background: var(--gold-500);
}
.sdot.crit {
  background: var(--crit);
}
.sdot.off {
  background: #9aa8b6;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--navy-800);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Charts ---------- */
.ch {
  display: block;
  width: 100%;
  height: auto;
}
.ch-grid line {
  stroke: #edf1f5;
}
.ch-band {
  fill: rgba(29, 131, 88, 0.07);
}
.ch-area {
  fill: rgba(42, 123, 208, 0.06);
}
.ch-line {
  fill: none;
  stroke: var(--blue-500);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ch-limits line {
  stroke: var(--crit);
  stroke-width: 1.4;
  stroke-dasharray: 6 5;
  opacity: 0.75;
}
.ch-dot {
  fill: #fff;
  stroke: var(--blue-500);
  stroke-width: 2.5;
}
.ch-gold .ch-line,
.ch-gold .ch-dot {
  stroke: var(--gold-600);
}
.ch-gold .ch-area {
  fill: rgba(201, 162, 74, 0.12);
}
.ch-alert .ch-line,
.ch-alert .ch-dot {
  stroke: var(--crit);
}
.ch-alert .ch-area {
  fill: rgba(194, 54, 43, 0.05);
}
.hbars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hbar {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 52px;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-size: 13px;
}
button.hbar:hover,
.hbar[aria-pressed='true'] {
  background: var(--blue-50);
}
.hbar-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: #eaeff4;
}
.hbar-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--blue-500);
  transition: width 0.4s var(--ease);
}
.hbar-fill.warn {
  background: var(--gold-500);
}
.hbar-fill.crit {
  background: var(--crit);
}
.hbar-target {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 20px;
  background: var(--ink);
}
.hbar b {
  text-align: right;
}
.vbars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
  padding-top: 8px;
}
.vbar {
  flex: 1;
  min-width: 0;
  border-radius: 3px 3px 0 0;
  background: var(--blue-300);
  transition: height 0.4s var(--ease);
}
.vbar.peak {
  background: var(--navy-600);
}
.vbars-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dt {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.dt th {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}
.dt td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.dt tr.abn td {
  background: #fffaf0;
}
.dt tr[aria-selected='true'] td {
  background: var(--blue-50);
}
.dt .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dt .strong {
  font-weight: 700;
}
.rangebar {
  position: relative;
  width: 120px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f6d8d4 0 15%, #d9f0e3 15% 85%, #f6d8d4 85%);
}
.rangebar i {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 16px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--navy-900);
}
.stock-bar {
  position: relative;
  width: 90px;
  height: 6px;
  margin-top: 4px;
  border-radius: 3px;
  background: #eaeff4;
}
.stock-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 3px;
  background: var(--ok);
}
.stock-bar i.warn {
  background: var(--gold-500);
}
.stock-bar i.crit {
  background: var(--crit);
}

/* ---------- Patient list & alerts (VitalSense) ---------- */
.pt {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  text-align: left;
}
.pt:hover {
  background: var(--paper);
}
.pt[aria-current='true'] {
  background: var(--blue-50);
  border-color: #cfe2f6;
}
.pt strong {
  display: block;
  font-size: 13.5px;
}
.pt small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: right;
}
.pt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.pt-head h3 {
  font-size: 20px;
}
.alert-row {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.alert-row:last-child {
  border-bottom: 0;
}
.alert-row::before {
  content: '';
  align-self: stretch;
  border-radius: 2px;
  background: var(--crit);
}
.alert-row.warn::before {
  background: var(--gold-500);
}
.alert-row.acked strong {
  font-weight: 600;
  color: var(--muted);
}
.alert-row.acked::before {
  background: var(--line-2);
}
.alert-row strong {
  display: block;
  font-size: 13.5px;
}
.alert-row small {
  color: var(--muted);
}
.empty-mini {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.offline-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #eef2f6;
  color: var(--ink-2);
}

/* ---------- Board (ClinicFlow) ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 360px;
  padding: 10px;
  border-radius: 12px;
  background: #e9eef4;
}
.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.pcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  animation: rise 0.35s var(--ease) both;
}
.pcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pcard strong {
  font-size: 14px;
}
.pcard small {
  color: var(--muted);
  font-size: 12px;
}
.wait {
  font-size: 12px;
  font-weight: 700;
  color: var(--ok);
  white-space: nowrap;
}
.wait.warn {
  color: var(--warn);
}
.wait.crit {
  color: var(--crit);
}
.pcard-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.pcard-actions .ab {
  flex: 1;
}

/* ---------- Phone app (CareConnect) ---------- */
.phone-app {
  display: flex;
  flex-direction: column;
  max-width: 420px;
  min-height: 660px;
  margin: 0 auto;
  background: #fff;
}
.pa-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.pa-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pa-head h3 {
  font-size: 17px;
}
.pa-progress {
  display: flex;
  gap: 5px;
  margin-top: 14px;
}
.pa-progress i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.3s;
}
.pa-progress i.on {
  background: var(--gold-500);
}
.pa-step {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.pa-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding: 18px;
}
.pa-body h4 {
  margin: 4px 0 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.opt:hover {
  border-color: var(--line-2);
}
.opt[aria-pressed='true'] {
  border-color: var(--gold-500);
  background: #fdf8ec;
}
.opt .i {
  width: 22px;
  height: 22px;
  color: var(--navy-700);
}
.opt strong {
  display: block;
  font-size: 14.5px;
}
.opt small {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
}
.slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.slot {
  min-height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
}
.slot[aria-pressed='true'] {
  border-color: var(--navy-900);
  background: var(--navy-900);
  color: #fff;
}
.slot:disabled {
  color: #a5b1bd;
  background: #f3f5f8;
  text-decoration: line-through;
  cursor: not-allowed;
}
.pa-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.pa-foot .ab {
  flex: 1;
  min-height: 46px;
  font-size: 14px;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--navy-700);
}
.summary {
  border: 1px solid var(--line);
  border-radius: 14px;
}
.summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.summary div:last-child {
  border-bottom: 0;
}
.summary dt {
  color: var(--muted);
}
.summary dd {
  margin: 0;
  font-weight: 650;
  text-align: right;
}
.big-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 8px 12px;
  text-align: center;
}
.big-status .ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #e4f4ec;
  color: var(--ok);
}
.big-status .ring .i {
  width: 38px;
  height: 38px;
}
.big-status .ring.wait {
  background: var(--blue-50);
  color: var(--navy-700);
  font-size: 30px;
  font-weight: 800;
}
.big-status h3 {
  font-size: 19px;
}
.big-status p {
  color: var(--muted);
  font-size: 13.5px;
}
.video-mock {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(60% 50% at 50% 40%, #27527f, #0b1d30);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-mock .avatar {
  width: 96px;
  height: 96px;
  font-size: 30px;
  background: rgba(255, 255, 255, 0.14);
}
.video-self {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 28%;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  background: #3a5a7c;
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.video-label {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 12px;
}

/* ---------- Recall feed (MedStock) ---------- */
.feed a {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--navy-700);
}
.feed a:hover {
  text-decoration: underline;
}
.feed small {
  display: block;
  color: var(--muted);
}
.feed-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Full-screen demo page ---------- */
.demo-body {
  background: var(--navy-950);
}
.demo-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  color: #fff;
}
.demo-topbar .back-link {
  color: var(--on-dark);
}
.demo-topbar .back-link:hover {
  color: #fff;
}
.demo-topbar .lang-switch {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.demo-page-body {
  padding: 0 20px 20px;
}
.demo-page-body .demo-root {
  min-height: calc(100vh - 84px);
  border-radius: 14px;
  overflow: hidden;
}
.demo-page-body.is-phone .demo-root {
  max-width: 420px;
  margin-inline: auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .app-side {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .app-side-title {
    display: none;
  }
  .app-side .pt {
    min-width: 210px;
  }
  .app-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .app-main {
    padding: 14px;
  }
  .board {
    grid-template-columns: minmax(0, 1fr);
  }
  .col {
    min-height: 0;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hbar {
    grid-template-columns: 84px minmax(0, 1fr) 44px;
  }
  .demo-page-body {
    padding: 0 8px 8px;
  }
}
.dt td .ab {
  min-height: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--navy-700);
  text-align: left;
  white-space: normal;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.lab-print {
  display: none;
}
@media print {
  .demo-root {
    display: none;
  }
  html.print-lab body > *:not(.lab-print) {
    display: none !important;
  }
  html.print-lab .lab-print {
    display: block;
    font: 12pt/1.4 var(--font-sans);
    color: #000;
  }
  .lab-print h1 {
    font-size: 16pt;
    margin-bottom: 6pt;
  }
  .lab-print table {
    width: 100%;
    margin: 12pt 0;
    border-collapse: collapse;
  }
  .lab-print th,
  .lab-print td {
    padding: 4pt 6pt;
    border-bottom: 1px solid #999;
    text-align: left;
  }
}
/* The phone app carries its own synthetic-data banner; avoid a truncated duplicate. */
.demo-frame-phone .demo-frame-bar em {
  display: none;
}
