/* ==========================================================================
   Detail-screen styles — Report, Chat, Ambulance, Detector
   ========================================================================== */

/* --- Report: charts -------------------------------------------------------- */

.chartcard__head {
  margin-bottom: 6px;
}

.axis-label {
  font-size: 9px;
  fill: var(--ink-400);
  font-family: var(--font-body);
}

.gridline {
  stroke: var(--ink-100);
  stroke-dasharray: 2 4;
}

.scalebar {
  height: 9px;
  border-radius: var(--r-pill);
  background: linear-gradient(
    90deg,
    #6fe3b4 0%,
    #b9e37f 18%,
    #f5e06a 38%,
    #f7b96a 56%,
    #f58aa0 74%,
    #b06ae8 100%
  );
}

.scalebar-wrap {
  margin: 14px 0 4px;
  position: relative;
}

.scalebar__ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--ink-400);
  margin-top: 5px;
}

.scalebar__marker {
  position: absolute;
  top: 12px;
  left: 68%;
  translate: -50% 0;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid var(--red-400);
}

/* Body render, cranial slices and their read-outs share one baseline height so
   each label lines up with the slice it belongs to. */
.bodyscan {
  --scan-h: 252px;
  display: grid;
  /* Body and slices stay adjacent so the leader lines drawn into the two
     bitmaps still meet; the read-outs take the remaining width. */
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 6px;
  padding: 2px 0 6px;
}

.bodyscan img {
  height: var(--scan-h);
  width: auto;
}

.bodyscan__labels {
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  align-items: center;
  height: var(--scan-h);
  font-size: var(--text-sm);
  color: var(--ink-500);
  text-align: right;
}

.donut-legend {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 4px 10px;
  align-items: center;
  font-size: var(--text-sm);
  color: var(--ink-600);
}

.donut-legend__val {
  font-weight: 600;
  color: var(--ink-800);
  text-align: right;
}

.donut-legend__trend {
  font-size: 9px;
  color: var(--ink-400);
}

.stat-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  gap: 4px;
  margin: 16px 0 4px;
}

.stat-trio > div + div {
  border-left: 1px solid var(--ink-100);
}

.stat-trio .itile {
  margin: 0 auto 10px;
  width: 42px;
  height: 42px;
}

.stat-trio__num {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink-900);
}

.stat-trio__label {
  font-size: var(--text-md);
  color: var(--ink-500);
}

.toggle-pill {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--blue-100), var(--yellow-300));
}

.toggle-pill__opt {
  width: 30px;
  height: 26px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  color: var(--surface);
}

.toggle-pill__opt[aria-selected="true"] {
  background: var(--surface);
  color: var(--blue-500);
  box-shadow: 0 1px 4px rgba(28, 42, 80, 0.16);
}

.byline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--ink-400);
  margin-top: 12px;
}

.byline__dot {
  width: 14px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--red-500);
  flex: none;
}

/* --- Chat ------------------------------------------------------------------ */

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 56px 18px 16px;
  background: var(--surface);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex: none;
}

.chat-head__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-md);
  color: var(--ink-500);
}

.chat-head__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c46b;
}

.bubbles {
  display: grid;
  gap: 16px;
  padding: 22px 18px;
}

.bubble {
  max-width: 76%;
  padding: 14px 16px;
  font-size: var(--text-lg);
  line-height: 1.4;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-800);
  box-shadow: var(--shadow-card);
}

.bubble--me {
  justify-self: end;
  background: var(--blue-500);
  color: #fff;
  box-shadow: 0 8px 18px rgba(89, 132, 246, 0.28);
}

.bubble__time {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--ink-400);
  margin-top: 8px;
}

.bubble--me .bubble__time {
  color: rgba(255, 255, 255, 0.86);
  justify-content: flex-end;
}

.bubble--wide {
  max-width: 88%;
}

.mini-timeline {
  border-top: 1px solid var(--ink-100);
  margin-top: 12px;
  padding-top: 14px;
  display: grid;
  gap: 14px;
}

.mini-timeline__item {
  position: relative;
  padding-left: 20px;
  font-size: var(--text-md);
}

.mini-timeline__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-400);
}

.mini-timeline__item:first-child::before {
  background: var(--blue-500);
}

.mini-timeline__item::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 16px;
  bottom: -16px;
  width: 1px;
  background: var(--ink-200);
}

.mini-timeline__item:last-child::after {
  display: none;
}

.mini-timeline__when {
  color: var(--ink-400);
}

.mini-timeline__what {
  color: var(--ink-800);
  font-weight: 500;
}

.composer {
  flex: none;
  margin: auto 18px 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  color: var(--ink-300);
  font-size: var(--text-lg);
}

.composer__divider {
  width: 1px;
  height: 20px;
  background: var(--ink-200);
}

/* --- Ambulance -------------------------------------------------------------- */

.map {
  position: absolute;
  inset: 0 0 auto;
  height: 62%;
  object-fit: cover;
  object-position: center top;
  width: 100%;
}

/* Floats over the map, so it needs its own scrim to stay legible. */
.appbar--float {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 62%, rgba(255, 255, 255, 0));
}

.sheet {
  position: absolute;
  inset: 40% 0 0;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -14px 40px rgba(28, 42, 80, 0.14);
  padding: 24px 22px;
  overflow-y: auto;
  scrollbar-width: none;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
}

.step {
  display: grid;
  justify-items: center;
  gap: 8px;
  position: relative;
  font-size: var(--text-md);
  color: var(--ink-500);
}

.step::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 50%;
  width: 100%;
  border-top: 1px dashed var(--ink-200);
  z-index: 0;
}

.step:last-child::before {
  display: none;
}

.step__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--ink-300);
  z-index: 1;
  box-shadow: inset 0 0 0 1.5px currentColor;
}

.step.is-done .step__dot {
  background: var(--blue-600);
  color: #fff;
  box-shadow: none;
}

.step.is-done {
  color: var(--ink-800);
  font-weight: 500;
}

.route {
  display: grid;
  gap: 18px;
  position: relative;
  margin-top: 14px;
}

.route__item {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: start;
  gap: 10px;
}

.route__icon {
  color: var(--ink-800);
  display: grid;
  place-items: center;
  position: relative;
}

.route__item:first-child .route__icon::after {
  content: "";
  position: absolute;
  top: 24px;
  left: 50%;
  height: 30px;
  border-left: 1.5px dashed var(--blue-300);
}

.route__label {
  font-size: var(--text-md);
  color: var(--ink-400);
}

.route__value {
  font-size: var(--text-lg);
  color: var(--ink-900);
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  border-radius: var(--r-md);
  background: var(--red-500);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-fab);
  transition: transform var(--dur-fast) var(--ease-out-expo);
}

.btn-primary:active {
  transform: scale(0.97);
}

/* --- Detector --------------------------------------------------------------- */

.device-hero {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(150deg, var(--blue-050), #fff 60%);
  padding: 10px 0 0;
}

/* height:auto is needed so the width/height attributes stop acting as a size. */
.device-hero img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.device-hero__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-800);
  box-shadow: var(--shadow-card);
}

.statuslight {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue-500);
  box-shadow: 0 0 0 0 rgba(89, 132, 246, 0.5);
  animation: pulse 2.4s ease-out infinite;
}

.statuslight--green {
  background: #22c46b;
  box-shadow: 0 0 0 0 rgba(34, 196, 107, 0.5);
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 9px rgba(89, 132, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(89, 132, 246, 0);
  }
}

.speclist {
  display: grid;
  gap: 0;
}

.speclist > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  font-size: var(--text-lg);
}

.speclist > div + div {
  border-top: 1px solid var(--ink-100);
}

.speclist dt {
  color: var(--ink-500);
  font-size: var(--text-md);
}

.speclist dd {
  font-weight: 500;
  color: var(--ink-900);
}
