/* Control Centre styles: one stylesheet for every tab of the CTFast app. */
:root {
  --bg: #eef3f8;
  --card: #ffffff;
  --ink: #1f2328;
  --sub: #5f6368;
  --faint: #80868b;
  --line: #e3e7ec;
  --soft: #f5f7fa;
  --blue: #0a84ff;
  --blue-d: #0a5bd8;
  --blue-l: #e8f1ff;
  --red: #d93025;
  --red-l: #fdecea;
  --amber: #b06000;
  --amber-l: #fef7e0;
  --green: #188038;
  --green-l: #e6f4ea;
  /* Chart series, in a fixed order checked for colour-blind separation. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}
button {
  font-family: inherit;
}
h2,
h3,
h4 {
  margin: 0;
}
.muted {
  color: var(--faint);
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- page layout ---------- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
  padding: 20px;
  min-height: 100vh;
}
.app.wide {
  grid-template-columns: minmax(0, 1fr);
}
.app.wide .phonewrap {
  display: none;
}
.view {
  display: none;
}
.view.on {
  display: block;
}
.footer {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  padding-bottom: 6px;
}

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 16px;
}
.logo {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.logo span {
  color: var(--blue);
}
.logo small {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-left: 2px;
}
.hosp {
  color: var(--sub);
}
.tabs {
  display: flex;
  gap: 4px;
}
.tab {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--sub);
  cursor: pointer;
  font-weight: 600;
}
.tab:hover {
  background: var(--soft);
}
.tab.on {
  background: var(--blue);
  color: #fff;
}
.clock {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}
.clock b {
  font-size: 20px;
  display: block;
  font-variant-numeric: tabular-nums;
}
.clock small {
  color: var(--sub);
}

/* ---------- cards and shared pieces ---------- */
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.card-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.card-head h2 {
  margin: 0;
}
.section-title {
  font-size: 18px !important;
  margin-bottom: 8px !important;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.grid > .card,
.two > .card {
  margin-bottom: 0;
}
.two + .two,
.card + .two,
.two + .card {
  margin-top: 16px;
}
.prose {
  line-height: 1.6;
  max-width: 860px;
}
.prose li {
  margin: 5px 0;
}
.prose h3 {
  margin: 18px 0 6px;
  font-size: 15px;
}
.sub {
  font-size: 15px;
  margin: 18px 0 10px;
}
.flow {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0 0 12px;
}
.flow li {
  counter-increment: step;
  background: var(--soft);
  border-radius: 12px;
  padding: 12px;
  line-height: 1.45;
  color: var(--sub);
  font-size: 13px;
}
.flow li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 8px;
}
.flow li b {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
  font-size: 14px;
}
.note {
  color: var(--faint);
  font-size: 12px;
  margin: 10px 0 0;
  line-height: 1.5;
}
.empty {
  color: var(--faint);
  padding: 34px 10px;
  text-align: center;
  line-height: 1.6;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pill.small {
  font-size: 10px;
  padding: 1px 7px;
}
.p-red {
  background: var(--red-l);
  color: var(--red);
}
.p-amber {
  background: var(--amber-l);
  color: var(--amber);
}
.p-green {
  background: var(--green-l);
  color: var(--green);
}
.p-blue {
  background: var(--blue-l);
  color: var(--blue-d);
}
.p-grey {
  background: #f1f3f4;
  color: var(--sub);
}
.btn {
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}
.btn.blue {
  background: var(--blue);
  color: #fff;
}
.btn.blue:hover:not(:disabled) {
  background: var(--blue-d);
}
.btn.ghost {
  background: #f1f3f4;
  color: var(--ink);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.spin {
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
.spin.big {
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 auto 10px;
  color: var(--blue);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.tooltip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  padding: 6px 9px;
  border-radius: 8px;
  max-width: 260px;
  opacity: 0;
  transition: opacity 0.1s;
}
.tooltip.on {
  opacity: 1;
}

/* ---------- walkthrough bar ---------- */
.presenter {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1f2a44;
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  min-height: 58px;
}
.presenter .stepno {
  background: var(--blue);
  border-radius: 999px;
  padding: 3px 11px;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}
.presenter .desc {
  flex: 1;
  line-height: 1.5;
}
.presenter .controls {
  display: flex;
  gap: 6px;
}
.presenter button {
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
  background: #33415f;
  color: #fff;
}
.presenter button.primary {
  background: var(--blue);
}
.presenter button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------- CT scanner ---------- */
.picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}
.example {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 6px 6px 8px;
  cursor: pointer;
  text-align: left;
}
.example:hover {
  border-color: #9ec5f4;
}
.example.on {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-l);
}
.example img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
  display: block;
  margin-bottom: 3px;
}
.example-title {
  font-weight: 700;
  font-size: 12px;
  line-height: 1.3;
  min-height: 2.6em;
}
.example-meta {
  color: var(--faint);
  font-size: 11px;
}
.send-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.send-row #send {
  margin-left: auto;
}
.upload {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.status-line {
  margin-top: 8px;
  color: var(--sub);
  min-height: 18px;
  font-size: 13px;
}
.status-line.err {
  color: var(--red);
  font-weight: 600;
}

.banner {
  display: none;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-weight: 600;
  border: 1.5px solid;
}
.banner.show {
  display: flex;
}
.banner.red {
  background: var(--red-l);
  color: var(--red);
  border-color: #f5c2bd;
}
.banner.amber {
  background: var(--amber-l);
  color: var(--amber);
  border-color: #f5d48c;
}
.banner.green,
.banner.done {
  background: var(--green-l);
  color: var(--green);
  border-color: #b7dfc2;
}
.banner.blue {
  background: var(--blue-l);
  color: var(--blue-d);
  border-color: #b7d3f6;
}

/* ---------- worklist ---------- */
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  font-size: 12px;
  color: var(--faint);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.queue tr {
  transition:
    background 0.3s,
    opacity 0.3s;
}
.queue tr.sel td {
  background: #f5f9ff;
}
.queue tr.hot td:first-child {
  box-shadow: inset 4px 0 0 var(--red);
}
.queue tr.done {
  opacity: 0.45;
}
.pos {
  font-weight: 700;
  color: var(--sub);
  width: 30px;
}
.case b {
  display: block;
}
.case small,
.exam small {
  display: block;
  color: var(--faint);
}
.queue td {
  white-space: nowrap;
}
.move {
  font-weight: 700;
  font-size: 12px;
  margin-top: 2px;
}
.move.red {
  color: var(--red);
}
.move.amber {
  color: var(--amber);
}

/* ---------- case view ---------- */
#case {
  transition: box-shadow 0.4s;
}
#case.flash {
  box-shadow: 0 0 0 4px var(--blue);
}
.case-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.case-head h2 {
  margin: 0;
  font-size: 15px;
}
#case > .muted {
  margin: 0 0 12px;
}
.scan {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
}
.viewer {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.viewer img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.viewer .heat {
  transition: opacity 0.3s;
}
.viewer.noheat .heat {
  opacity: 0;
}
.viewer .tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
}
.thumbs {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.thumbs img {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
}
.toggle {
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--sub);
}
.score {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
}
.bar {
  height: 8px;
  border-radius: 999px;
  background: #f1f3f4;
  margin: 6px 0 8px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
}
.kv {
  color: var(--sub);
}
.kv b {
  color: var(--ink);
}
.lab {
  font-size: 11px;
  font-weight: 800;
  color: var(--blue-d);
  letter-spacing: 0.4px;
  margin: 14px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.spark {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 46px;
  border-bottom: 1px solid var(--line);
}
.spark::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--threshold);
  border-top: 1px dashed var(--red);
}
.spark i {
  flex: 1;
  background: #c4c9d0;
  border-radius: 2px 2px 0 0;
}
.spark i.hi {
  background: var(--red);
}
.spark i.key {
  outline: 2px solid var(--ink);
}
.spark-axis {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 10px;
  margin-top: 2px;
}
.types div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--sub);
  margin: 3px 0;
}
.types i {
  display: block;
  height: 6px;
  background: #f1f3f4;
  border-radius: 999px;
  overflow: hidden;
}
.types i b {
  display: block;
  height: 100%;
  background: var(--series-1);
  border-radius: 999px;
}
.truth {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--soft);
  color: var(--sub);
  line-height: 1.45;
}
.section {
  border-top: 1px solid var(--line);
  margin-top: 14px;
}
.brief-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
}
.brief-row h4 {
  font-size: 12px;
  color: var(--sub);
  padding-top: 1px;
}
.brief-row p {
  margin: 0 0 5px;
  line-height: 1.45;
  font-size: 13px;
}
.cite {
  color: var(--blue-d);
  font-weight: 600;
  white-space: nowrap;
  cursor: help;
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 46px 14px 1fr;
  gap: 8px;
  padding: 4px 0;
  color: var(--sub);
}
.timeline li b {
  color: var(--ink);
  font-weight: 600;
}
.timeline .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  margin-top: 5px;
}
.dot.red {
  background: var(--red);
}
.dot.green {
  background: var(--green);
}
.dot.amber {
  background: #f9ab00;
}
.dot.blue {
  background: var(--blue);
}
.actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- phones ---------- */
.phonewrap {
  position: sticky;
  top: 20px;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.phone-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 360px;
  margin-bottom: 8px;
}
.phone-switch button {
  position: relative;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 6px 4px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.3;
}
.phone-switch button small {
  display: block;
  font-weight: 500;
  color: var(--faint);
  font-size: 10.5px;
}
.phone-switch button.on {
  border-color: var(--blue);
  background: var(--blue-l);
}
.phone-switch .badge {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}
.owner {
  color: var(--sub);
  font-weight: 600;
  margin-bottom: 8px;
}
.phone {
  width: 360px;
  height: 720px;
  border-radius: 44px;
  background: #111;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(20, 40, 80, 0.18);
}
.screen {
  width: 100%;
  height: 100%;
  border-radius: 34px;
  overflow: hidden;
  background: #dfe9f2;
  display: flex;
  flex-direction: column;
}
.status {
  display: flex;
  justify-content: space-between;
  padding: 10px 22px 4px;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
}
.chathead {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 10px;
  background: #fff;
  border-bottom: 1px solid #e6e9ee;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.chathead b {
  display: block;
}
.chathead small {
  color: var(--faint);
}
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  background: #fff;
  border-radius: 14px 14px 14px 4px;
  padding: 9px 11px;
  max-width: 92%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
  line-height: 1.42;
  font-size: 13px;
}
.msg p {
  margin: 5px 0 0;
  font-size: 12px;
}
.msg.me {
  align-self: flex-end;
  background: #e1f5d7;
  border-radius: 14px 14px 4px 14px;
}
.msg .t {
  color: var(--faint);
  font-size: 10px;
  text-align: right;
  margin-top: 3px;
}
.msg .hd {
  font-weight: 800;
  color: var(--red);
  margin-bottom: 3px;
}
.msg img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin: 6px 0 2px;
  display: block;
}
.kb {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  max-width: 92%;
}
.kb button {
  border: none;
  background: #fff;
  border-radius: 8px;
  padding: 9px 4px;
  font-weight: 700;
  color: var(--blue-d);
  cursor: pointer;
  font-size: 12px;
}
.kb button:hover:not(:disabled) {
  background: var(--blue-l);
}
.kb button:disabled {
  opacity: 0.45;
  cursor: default;
}
.sys {
  align-self: center;
  background: rgba(0, 0, 0, 0.12);
  color: #fff;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 999px;
}
.phone-note {
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  margin: 10px 0 0;
  max-width: 360px;
  line-height: 1.5;
}

/* ---------- results, playbook and audit ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.kpi {
  background: var(--soft);
  border-radius: 12px;
  padding: 12px 14px;
}
.kpi small {
  color: var(--sub);
  display: block;
  font-weight: 600;
}
.kpi b {
  font-size: 26px;
  display: block;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.kpi span {
  font-size: 12px;
  color: var(--faint);
}
.metrics td,
.metrics th {
  padding: 7px 8px;
}
.metrics td:first-child {
  color: var(--sub);
}
.chart {
  margin: 0;
}
.chart svg {
  width: 100%;
  max-width: 480px;
  height: auto;
  display: block;
  overflow: visible;
}
.chart .gridline {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .track {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .axis {
  fill: var(--faint);
  font-size: 11px;
}
.chart .label {
  fill: var(--sub);
  font-size: 12px;
}
.chart .mark {
  stroke: var(--card);
  stroke-width: 2;
  cursor: pointer;
}
.chart .mark.ring {
  stroke-width: 2.5;
}
.roc {
  max-width: 520px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--sub);
  font-size: 12px;
  margin-bottom: 8px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.key {
  display: inline-block;
  width: 10px;
  height: 10px;
}
.key.circle {
  border-radius: 50%;
}
.key.diamond {
  transform: rotate(45deg) scale(0.85);
}
.key.line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}
.key.ring {
  border-radius: 50%;
  border: 2px solid var(--sub);
  background: transparent;
}
.matrices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.matrix h4 {
  font-size: 13px;
  margin-bottom: 8px;
}
.matrix table {
  table-layout: fixed;
}
.matrix th,
.matrix td {
  text-align: center;
}
.matrix td {
  font-size: 20px;
  font-weight: 700;
  padding: 10px 4px;
  border: 2px solid #fff;
}
.matrix td small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--sub);
}
.matrix td.good {
  background: var(--green-l);
}
.matrix td.bad {
  background: var(--red-l);
}
.hbars div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: center;
  margin: 7px 0;
}
.hbars i {
  display: block;
  height: 12px;
  background: #f1f3f4;
  border-radius: 4px;
  overflow: hidden;
}
.hbars i b {
  display: block;
  height: 100%;
  background: var(--series-1);
  border-radius: 0 4px 4px 0;
}

/* ---------- narrow screens ---------- */
@media (max-width: 1250px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .phonewrap {
    position: static;
  }
  .flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .app {
    padding: 12px;
    gap: 14px;
  }
  .grid,
  .two,
  .matrices {
    grid-template-columns: minmax(0, 1fr);
  }
  .flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .top {
    flex-wrap: wrap;
    gap: 8px 14px;
  }
  .presenter {
    flex-wrap: wrap;
  }
  .presenter .desc {
    flex-basis: 100%;
    order: -1;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card {
    overflow-x: auto;
  }
  .scan {
    grid-template-columns: minmax(0, 1fr);
  }
  .phone,
  .phone-switch {
    width: min(360px, calc(100vw - 24px));
  }
}
.metrics.numeric th + th {
  text-align: right;
}
