* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #d8e2e7;
  font-family: Arial, Helvetica, sans-serif;
  color: #313131;
}

button {
  font: inherit;
}

.app {
  position: fixed;
  inset: 0 auto auto 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: #d8e2e7;
  transform: scale(var(--app-scale, 1));
  transform-origin: top left;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
}

.task-screen {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #d4e0e7, #eef4f6);
}

.task-card {
  width: 760px;
  min-height: 430px;
  display: grid;
  align-content: center;
  gap: 54px;
  padding: 64px;
  text-align: center;
  background: #fff;
  box-shadow: 0 20px 70px rgba(36, 70, 109, 0.22);
}

.task-card h1 {
  margin: 0;
  font-size: 48px;
}

.task-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.task-actions button {
  height: 96px;
  border: 0;
  border-radius: 5px;
  background: #20a384;
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  cursor: pointer;
}

.task-actions button.pending {
  background: #78aeb5;
}

.hidden {
  display: none !important;
}

.patient-screen {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #d4e0e7, #eef4f6);
}

.patient-stage {
  position: relative;
  width: 1260px;
  height: 980px;
  display: grid;
  grid-template-columns: 48% 52%;
  padding: 30px 16px 112px;
  background: #fff;
  box-shadow: 0 20px 70px rgba(36, 70, 109, 0.22);
}

h1 {
  margin: 0 0 28px;
  font-size: 33px;
  line-height: 1;
  color: #2f2f2f;
}

.patient-form {
  width: 585px;
}

.patient-form label {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  font-size: 18px;
}

.patient-form input {
  width: 100%;
  height: 47px;
  border: 2px solid #55b879;
  border-radius: 5px;
  padding: 0 12px;
  font-size: 18px;
  color: #777;
  background: linear-gradient(135deg, #16a75b 0 18px, #fff 19px);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-row label {
  grid-template-columns: 64px 1fr;
}

.button-field {
  grid-template-columns: 130px 1fr !important;
}

.button-field button {
  height: 47px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: #0798cc;
}

.protocol-column {
  display: grid;
  grid-template-columns: 178px 1fr;
  grid-template-rows: auto 1fr;
  gap: 0 112px;
  padding-left: 18px;
}

.protocol-column h1 {
  grid-column: 1 / -1;
}

.body-map {
  width: 178px;
  height: 535px;
  background: #11394a;
}

.body-map img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.protocol-groups {
  display: flex;
  flex-direction: column;
  width: 292px;
  gap: 14px;
}

.protocol-groups button,
.protocol-modal button,
.workflow-buttons button {
  border: 0;
  border-radius: 5px;
  background: #20a384;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.protocol-groups button {
  height: 46px;
  font-size: 18px;
  text-align: left;
  padding-left: 16px;
}

.settings-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #28aa8a;
  color: #fff;
  font-size: 24px;
}

.main-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  height: 88px;
  border-top: 2px solid #58b682;
  background: #fff;
  display: none;
}

.patient-stage .main-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 104px;
}

.footer-items {
  height: 100%;
  display: grid;
  grid-template-columns: 190px 225px 285px 190px 190px 190px 200px;
  align-items: center;
  padding: 0 18px;
  color: #24466d;
  font-size: 16px;
}

.footer-item {
  display: grid;
  grid-template-columns: 50px 1fr;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.footer-icon {
  width: 48px;
  height: 48px;
  border-radius: 5px;
  background: #18a98c;
}

.footer-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.footer-icon.blank {
  background: #20a384;
}

.footer-item span {
  line-height: 1.15;
}

.patient-stage .footer-items {
  grid-template-columns: 158px 184px 236px 158px 158px 158px 170px;
  padding: 0 14px;
  font-size: 14px;
}

.patient-stage .footer-item {
  grid-template-columns: 48px 1fr;
  gap: 8px;
}

.patient-stage .footer-icon {
  width: 46px;
  height: 46px;
}

.scanner-screen {
  background: #9fa8cc;
  padding-bottom: 72px;
}

.scanner-screen > .main-footer {
  display: none;
}

.scanner-left {
  position: absolute;
  inset: 0 0 72px 0;
}

.scanner-top {
  display: grid;
  grid-template-columns: 470px 840px 1fr;
  height: 255px;
  background: #d7d7d7;
  border-bottom: 2px solid #5c5c5c;
}

.small-head {
  height: 34px;
  padding: 8px 14px;
  font-size: 14px;
}

.small-head span {
  margin-left: 80px;
}

.preview-panel img {
  width: 450px;
  height: 150px;
  object-fit: cover;
  margin-left: 16px;
}

.preview-panel label {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 16px;
  font-size: 14px;
}

.preview-panel input {
  height: 28px;
  width: 205px;
  border: 2px solid #929292;
  background: #fff;
}

.scanner-info {
  border-right: 2px solid #777;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 8px 18px;
  gap: 24px;
  font-size: 15px;
}

.control-grid button,
.main-menu-strip button,
.scanner-footer button {
  border: 3px solid #5d5d5d;
  background: #c6c6c6;
  color: #343434;
  min-height: 48px;
}

.control-grid button {
  min-width: 86px;
  margin: 8px 10px 8px 0;
}

.dose-panel {
  padding: 12px 20px;
  font-size: 15px;
}

.dose-panel h2 {
  margin: 0 0 20px;
  font-size: 18px;
  text-align: center;
  font-weight: 400;
}

.dose-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.timer-icon {
  margin-top: 18px;
  width: 82px;
  height: 62px;
  border: 3px solid #9a9a9a;
  background: #bbc6dd;
  display: grid;
  place-items: center;
}

.timer-icon img {
  max-width: 58px;
}

.main-menu-strip {
  display: flex;
  height: 62px;
  background: #003a9b;
  padding: 5px 12px;
  gap: 6px;
}

.main-menu-strip button {
  width: 118px;
  font-size: 13px;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.scan-table {
  margin: 8px auto 0;
  border-collapse: collapse;
  font-size: 14px;
}

.scan-table th,
.scan-table td {
  border: 3px solid #666;
  min-width: 165px;
  height: 34px;
  text-align: center;
  background: #c6c6c6;
}

.scan-table td:first-child {
  background: #fffed1;
}

.progress-block {
  width: 1310px;
  margin: 95px 0 0 30px;
}

.progress-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.progress-title.second {
  margin-top: 18px;
}

.timeline {
  display: flex;
  justify-content: space-between;
  color: #3a4870;
  font-size: 17px;
}

.progress-track {
  height: 38px;
  background: #efe5bc;
  border: 1px solid #ddd;
  overflow: hidden;
}

#progress-fill,
#planning-progress-fill,
#planning-progress-fill-2,
.progress-track .done {
  height: 100%;
  width: 0;
  background: #fff0c3;
}

.progress-track .done {
  width: 100%;
}

.scanner-footer {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 118px;
  display: grid;
  grid-template-columns: 74px 118px 74px 118px 90px 90px 118px 110px 218px 64px 64px;
  gap: 6px;
  align-items: flex-end;
}

.scanner-footer button {
  width: 100%;
  height: 66px;
  font-size: 12px;
}

.scanner-footer .icon-action {
  width: 100%;
}

#confirm-scan {
  width: 218px;
  height: 92px;
  font-size: 16px;
  transform: none;
}

.scanner-footer img {
  display: block;
  max-width: 86px;
  max-height: 34px;
  margin: 0 auto 4px;
}

.planning-screen {
  display: grid;
  grid-template-columns: 49.5% 50.5%;
  background: #a0a9cc;
  padding-bottom: 88px;
}

.planning-left {
  position: relative;
  padding: 16px 28px;
}

.planning-preview {
  width: 455px;
  height: 170px;
  object-fit: cover;
  background: #ddd;
}

.planning-left .progress-block {
  width: 645px;
  margin: 48px 0 0;
}

.workflow-buttons {
  position: absolute;
  left: 350px;
  bottom: 112px;
  width: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.workflow-buttons button {
  min-height: 58px;
  padding: 8px 12px;
  font-size: 16px;
  text-transform: none;
}

.action-status {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border-radius: 50%;
  vertical-align: -2px;
  background: #d92121;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.topogram-area {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topogram-canvas {
  position: relative;
  width: 960px;
  height: 690px;
  overflow: visible;
  background: #050505;
  cursor: crosshair;
}

.topogram-canvas img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.topogram-image {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 3s linear, opacity 260ms ease;
}

.topogram-canvas.revealed .topogram-image {
  clip-path: inset(0 0 0 0);
}

.topogram-canvas.switching .topogram-image {
  transition: opacity 260ms ease;
}

.topogram-nav {
  position: absolute;
  left: 50%;
  bottom: -58px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.debug-zone {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  border: 3px dashed rgba(255, 230, 0, 0.95);
  background: rgba(255, 230, 0, 0.12);
}

.debug-control-zone {
  border-color: rgba(0, 170, 255, 0.95);
  background: rgba(0, 170, 255, 0.12);
}

.debug-range-zone {
  border-color: rgba(0, 255, 120, 0.95);
  background: rgba(0, 255, 120, 0.12);
}

.topogram-nav button {
  width: 50px;
  height: 42px;
  border: 0;
  border-radius: 5px;
  background: #20a384;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.slice-line {
  position: absolute;
  left: 140px;
  right: 140px;
  top: 250px;
  height: 9px;
  background: #00a8ff;
  border: 1px solid #9be6ff;
  cursor: ns-resize;
  border-radius: 5px;
}

.roi,
.scan-range {
  position: absolute;
  pointer-events: none;
  border: 4px solid #11d4d8;
  background: rgba(17, 212, 216, 0.18);
}

.scan-range-box {
  position: absolute;
  left: 250px;
  top: 190px;
  width: 460px;
  height: 330px;
  border: 4px solid #11d4d8;
  border-radius: 2px;
  background: rgba(17, 212, 216, 0.18);
  cursor: move;
  touch-action: none;
}

.resize-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid #c9fbff;
  background: #11d4d8;
  border-radius: 50%;
}

.resize-handle.nw {
  left: -13px;
  top: -13px;
  cursor: nwse-resize;
}

.resize-handle.ne {
  right: -13px;
  top: -13px;
  cursor: nesw-resize;
}

.resize-handle.sw {
  left: -13px;
  bottom: -13px;
  cursor: nesw-resize;
}

.resize-handle.se {
  right: -13px;
  bottom: -13px;
  cursor: nwse-resize;
}

.roi {
  border-radius: 50%;
}

.scan-range {
  border-radius: 2px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.38);
  z-index: 20;
}

.modal-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.protocol-modal {
  width: 1080px;
  min-height: 690px;
  padding: 58px 180px;
  text-align: center;
}

.protocol-modal h2,
.slice-modal h2 {
  margin: 0 0 48px;
  font-size: 30px;
}

.protocol-modal button {
  display: block;
  width: 720px;
  height: 74px;
  margin: 0 auto 22px;
  font-size: 24px;
}

.protocol-modal .cancel {
  margin-top: 70px;
  background: #2faee0;
}

.modal-close {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 76px !important;
  height: 76px !important;
  border-radius: 50% !important;
  background: #fff !important;
  color: #aaa !important;
  font-size: 34px !important;
}

.slice-modal {
  width: 980px;
  padding: 42px;
  text-align: center;
}

.slice-modal.ok {
  border: 8px solid #22b14c;
}

.slice-modal.bad {
  border: 8px solid #db2f2f;
}

.slice-modal img {
  display: block;
  width: 820px;
  height: 620px;
  margin: 0 auto 28px;
  object-fit: contain;
  background: #000;
}

.slice-modal > button {
  min-width: 180px;
  height: 58px;
  border: 0;
  border-radius: 5px;
  background: #20a384;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.slice-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.slice-options button {
  padding: 0;
  border: 8px solid transparent;
  background: #111;
  cursor: pointer;
}

.slice-options button.correct {
  border-color: #22b14c;
}

.slice-options button.wrong {
  border-color: #db2f2f;
}

.slice-options img {
  display: block;
  width: 100%;
  height: 430px;
  object-fit: contain;
}

.roi-modal {
  width: 1120px;
  padding: 28px;
  text-align: center;
}

.roi-modal h2 {
  margin: 0 0 14px;
  font-size: 26px;
}

.tool-row,
.roi-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.tool-row button,
.roi-actions button {
  border: 0;
  border-radius: 5px;
  padding: 12px 22px;
  background: #c8d1da;
  color: #21394f;
  font-weight: 700;
  cursor: pointer;
}

.roi-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.tool-row button.active,
.roi-actions button:last-child {
  background: #20a384;
  color: #fff;
}

.roi-canvas {
  position: relative;
  width: 900px;
  height: 620px;
  margin: 0 auto 18px;
  background: #000;
  overflow: hidden;
  cursor: crosshair;
}

.roi-canvas.has-roi {
  cursor: move;
}

.roi-canvas img,
.roi-canvas svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.debug-roi-zone {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  border: 3px dashed rgba(0, 255, 120, 0.95);
  border-radius: 50%;
  background: rgba(0, 255, 120, 0.12);
}

.debug-roi-zone-a {
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
}

.debug-roi-zone-b {
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
}

.roi-canvas img {
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.roi-canvas svg {
  z-index: 2;
}

.roi-shape {
  fill: rgba(17, 212, 216, 0.14);
  stroke: #11d4d8;
  stroke-width: 4;
  pointer-events: all;
  cursor: move;
}


.video-screen {
  display: grid;
  place-items: center;
  background: #050505;
}

.video-screen video {
  width: 1420px;
  height: 800px;
  background: #000;
}

.video-actions {
  position: absolute;
  right: 72px;
  bottom: 58px;
}

.video-actions button,
.final-screen button {
  border: 0;
  border-radius: 5px;
  background: #20a384;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  padding: 18px 36px;
  cursor: pointer;
}

.final-screen {
  display: grid;
  place-items: center;
  background: #000;
}

.result-card {
  width: 970px;
  min-height: 560px;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 76px 96px;
  border-radius: 42px;
  background: #fff;
  color: #050505;
}

.result-card h1 {
  margin: 0 0 72px;
  font-size: 48px;
  line-height: 1.45;
  text-align: center;
}

.result-card p {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
}

.final-screen button {
  position: absolute;
  right: 54px;
  bottom: 44px;
}
