*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #00366d;
  color: #fff;
  font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button,
input,
textarea {
  font-family: inherit;
}

button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: #00366d;
}

.app {
  --app-bg: #00366d;
  --block-shadow:
    6px 10px 18px rgba(0, 0, 0, 0.5),
    2px 3px 6px rgba(0, 0, 0, 0.32);
  width: 1920px;
  height: 1200px;
  background: var(--app-bg);
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -960px;
  transform-origin: top center;
  padding: 0 52px 36px;
}

.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 140px;
  min-height: 140px;
}

.brand {
  display: flex;
  align-items: flex-end;
  margin-left: -52px;
  height: 140px;
}

.brand-logo {
  height: 140px;
  width: auto;
  display: block;
}

.header-right {
  display: flex;
  align-items: stretch;
  gap: 40px;
  height: auto;
  padding-top: 0;
}

.header-icons {
  display: flex;
  align-items: stretch;
  gap: 25px;
  padding-top: 0;
}

.icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 115px;
  padding: 0;
  color: #fff;
}

.icon-btn span {
  font-size: 23px;
  letter-spacing: 0.04em;
  font-weight: 500;
  white-space: nowrap;
}

.icon-btn img {
  width: 65px;
  height: 65px;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.15));
}

.staff-card {
  width: 220px;
  min-height: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  box-sizing: border-box;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08);
}

.staff-switch {
  width: 100%;
  height: 42px;
  background: #00366d;
  color: #fff;
  border-radius: 999px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.staff-person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 1px;
  color: #12324f;
}

.staff-person img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.staff-person span {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.clock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 36px;
  padding-right: 4px;
}

.clock {
  font-size: 57px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.voice-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.06em;
  opacity: 1;
}

.voice-status.is-off {
  opacity: 0.45;
}

.voice-wave {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.voice-status.is-on .voice-wave {
  animation: wavePulse 1.1s ease-in-out infinite;
}

@keyframes wavePulse {
  0%,
  100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.75; }
}

.patient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 22px 28px;
  gap: 32px;
  background: var(--app-bg);
  border-radius: 22px;
  box-shadow: var(--block-shadow);
}

.patient-info {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.patient-info p {
  margin: 0;
}

.patient-id-line {
  opacity: 0.95;
  font-weight: 300;
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Sans", sans-serif;
}

.patient-main-line {
  font-size: 36px;
}

.visit-sep {
  margin-left: 0;
}

.patient-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.combo-pill {
  background: #fff;
  border-radius: 999px;
  padding: 12px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.combo-pill button {
  background: none;
  box-shadow: none;
  color: #0d3a5c;
  min-height: 0;
  padding: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  white-space: nowrap;
}

.combo-pill button:disabled {
  opacity: 1;
  color: #0d3a5c;
}

.pill {
  background: #fff;
  color: #0d3a5c;
  border-radius: 999px;
  min-height: 54px;
  padding: 0 30px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.pill:active,
.icon-btn:active,
.vital:active,
.save-btn:active {
  transform: translateY(1px);
}

.pill.ghost {
  background: #d9e6f2;
  color: #0d3a5c;
}

.pill-wide {
  min-width: 268px;
}

.pill.is-on {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35), 0 3px 0 rgba(0, 0, 0, 0.08);
}

.vitals {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
  margin-top: 48px;
}

.vital {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  min-width: 0;
  color: #fff;
  background: var(--app-bg);
  border-radius: 22px;
  padding: 16px 14px 28px;
  box-shadow: var(--block-shadow);
  container-type: inline-size;
  min-height: 460px;
}

.vital-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 128px;
  flex-shrink: 0;
}

.vital-head img {
  width: 120px;
  height: 120px;
  border-radius: 30px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
}

.vital-label {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  min-height: 2.4em;
  display: flex;
  align-items: center;
}

.vital-value {
  margin-top: 14px;
  font-size: 88px;
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: -0.06em;
  font-family: Arial, "Segoe UI", "Yu Gothic UI", sans-serif;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.vital[data-key="temperature"] .vital-value,
.vital[data-key="pulse"] .vital-value,
.vital[data-key="spo2"] .vital-value,
.vital[data-key="cough"] .vital-value {
  font-size: min(135px, 51cqi);
}

.vital-value-stack {
  display: flex;
  flex-direction: column;
  font-size: 117px;
  line-height: 0.88;
  margin-top: 8px;
}

.vital-value-lung {
  font-size: 72px;
  letter-spacing: 0.02em;
  font-family: "Yu Gothic UI", "Yu Gothic", sans-serif;
  font-weight: 800;
  line-height: 1.05;
  margin-top: 10px;
  white-space: normal;
}

.vital-unit {
  margin-top: auto;
  padding-top: 12px;
  font-size: 50px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  opacity: 0.95;
  text-align: left;
}

.save-btn {
  display: block;
  margin: 36px 0 0 auto;
  width: calc((100% - 90px) / 6 * 2 + 18px);
  min-height: 120px;
  background: var(--app-bg);
  color: #fff;
  border-radius: 22px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  box-shadow: var(--block-shadow);
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 16, 36, 0.55);
  z-index: 20;
}

.modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1140px, 90%);
  max-height: 90%;
  overflow-y: auto;
  background: #fff;
  color: #12324f;
  border-radius: 24px;
  padding: 54px 60px 42px;
  z-index: 21;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

#modalSettings {
  transform: translate(-50%, -50%) scale(0.85);
}

.modal h2 {
  margin: 0 0 32px;
  font-size: 48px;
}

.modal textarea,
.modal input[type="text"],
.modal input[type="number"] {
  width: 100%;
  border: 2px solid #c5d4e2;
  border-radius: 18px;
  padding: 18px 22px;
  font-size: 36px;
  color: #12324f;
  background: #f7fbff;
}

.modal textarea {
  resize: vertical;
  min-height: 330px;
}

.form-grid {
  display: grid;
  gap: 22px;
}

.form-grid label,
.keypad-extra label {
  display: grid;
  gap: 10px;
  font-size: 36px;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 36px;
}

.modal .pill {
  min-height: 80px;
  padding: 0 44px;
  font-size: 32px;
}

.modal-camera {
  width: min(1470px, 92%);
}

.camera-view {
  width: 100%;
  height: 630px;
  background: #10263a;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-view video,
.camera-view img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #10263a;
}

.camera-status {
  min-height: 42px;
  margin: 18px 0 0;
  font-size: 36px;
}

.staff-list {
  display: grid;
  gap: 16px;
}

.staff-list button {
  background: #eef5fb;
  color: #12324f;
  border-radius: 24px;
  min-height: 96px;
  font-size: 40px;
  font-weight: 700;
  text-align: left;
  padding: 0 30px;
}

.staff-list button.is-current {
  background: #003a70;
  color: #fff;
}

.keypad-display {
  background: #eef5fb;
  border-radius: 22px;
  min-height: 126px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 30px;
  font-size: 72px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.keypad button {
  background: #eef5fb;
  color: #12324f;
  border-radius: 22px;
  min-height: 108px;
  font-size: 48px;
  font-weight: 700;
}

.keypad-extra {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.lung-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.lung-choices button {
  background: #eef5fb;
  color: #12324f;
  border-radius: 22px;
  min-height: 102px;
  font-size: 36px;
  font-weight: 700;
}

.lung-choices button.is-on {
  background: #003a70;
  color: #fff;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  background: #fff;
  color: #12324f;
  border-radius: 999px;
  padding: 24px 48px;
  font-size: 36px;
  font-weight: 700;
  z-index: 30;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.25);
}

.hidden {
  display: none !important;
}

@media (max-height: 900px) {
  .app {
    box-shadow: none;
  }
}
