.csh {
  padding: 1rem;
  border: 1px solid #d7ddd8;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(247, 144, 9, 0.08), transparent 32%),
    linear-gradient(225deg, rgba(48, 86, 211, 0.08), transparent 36%),
    #fbfcfa;
  color: #15191d;
  box-shadow: 0 18px 48px rgba(26, 31, 38, 0.1);
}

.csh__warning {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e45b52;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff0ee, #fff8f1);
  box-shadow: inset 4px 0 0 #c92a20;
}

.csh__warning-mark {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  background: #c92a20;
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
}

.csh__warning strong,
.csh__warning span {
  display: block;
}

.csh__warning strong {
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

.csh__warning span {
  line-height: 1.45;
}

.csh__layout {
  display: grid;
  grid-template-columns: minmax(18rem, 0.9fr) minmax(18rem, 1.2fr);
  gap: 1.1rem;
}

.csh__rule,
.csh__panel {
  min-width: 0;
}

.csh__rule {
  display: grid;
  min-height: 27rem;
  grid-template-columns: 4.5rem 1fr;
  gap: 1.2rem;
  padding: 0.35rem 0.1rem 0.2rem 0;
}

.csh__glucose-rail {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(180deg, #cf3f3a, #f59e0b 46%, #2f7f72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 10px 24px rgba(39, 48, 56, 0.13);
}

.csh__glucose-rail span {
  position: absolute;
  left: 50%;
  z-index: 2;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  transform: translateX(-50%);
}

.csh__glucose-rail span:nth-child(1) { bottom: 5%; }
.csh__glucose-rail span:nth-child(2) { bottom: 46%; }
.csh__glucose-rail span:nth-child(3) { bottom: 92%; }

.csh__glucose-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(255, 255, 255, 0.38);
}

.csh__glucose-dot {
  position: absolute;
  left: 50%;
  width: 1.4rem;
  height: 1.4rem;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #15191d;
  transform: translate(-50%, 50%);
}

.csh__sodium-stage {
  position: relative;
  overflow: visible;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(42, 99, 184, 0.13), transparent 38%),
    linear-gradient(90deg, transparent 41%, rgba(45, 132, 112, 0.18) 42%, rgba(45, 132, 112, 0.18) 64%, transparent 65%),
    linear-gradient(90deg, transparent 66%, rgba(194, 74, 61, 0.13)),
    #eef2ee;
  box-shadow: inset 0 0 0 1px #d7ddd8;
}

.csh__sodium-band {
  position: absolute;
  top: 0;
  bottom: 0;
}

.csh__sodium-band--low {
  left: 0;
  width: 44%;
  background-image: repeating-linear-gradient(90deg, rgba(47, 83, 150, 0.08) 0 1px, transparent 1px 28px);
}

.csh__sodium-band--normal {
  left: 44%;
  width: 22%;
  background: rgba(61, 126, 109, 0.1);
}

.csh__sodium-band--high {
  right: 0;
  width: 34%;
  background-image: repeating-linear-gradient(90deg, rgba(160, 65, 56, 0.08) 0 1px, transparent 1px 28px);
}

.csh__pin {
  position: absolute;
  top: 18%;
  display: grid;
  width: 6.9rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(26, 31, 38, 0.16);
  transform: translateX(-50%);
  z-index: 3;
}

.csh__pin::after {
  position: absolute;
  bottom: -12rem;
  left: 50%;
  width: 2px;
  height: 12rem;
  background: currentcolor;
  content: "";
}

.csh__pin--corrected {
  top: 56%;
  color: #8d5a00;
}

.csh__pin--measured {
  color: #2f56b3;
}

.csh__pin b {
  overflow: hidden;
  font-size: 0.7rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.csh__pin span {
  font-size: 1.35rem;
  font-weight: 900;
}

.csh__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.25rem 0 0.2rem;
}

.csh__inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.csh__field span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 800;
}

.csh__input-shell {
  display: flex;
  min-height: 3rem;
  align-items: center;
  border: 1px solid #ccd5d4;
  border-radius: 8px;
  background: #fff;
}

.csh__input-shell input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  outline: 0;
  padding: 0.75rem;
}

.csh__input-shell small {
  padding-right: 0.75rem;
  color: #5d6670;
  white-space: nowrap;
}

.csh__input-shell--toggle {
  align-items: stretch;
}

.csh__toggle,
.csh__factor {
  display: flex;
  gap: 0.35rem;
}

.csh__toggle {
  align-items: center;
  padding-right: 0.35rem;
}

.csh__toggle-btn,
.csh__factor-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.csh__toggle-btn {
  padding: 0.45rem 0.55rem;
  background: #edf0f2;
  font-size: 0.78rem;
  font-weight: 800;
}

.csh__toggle-btn--active,
.csh__factor-btn--active {
  border-color: #3056d3;
  background: #e8edff;
}

.csh__converted {
  display: block;
  min-height: 1.1rem;
  margin-top: 0.25rem;
  color: #626c76;
  font-size: 0.8rem;
}

.csh__factor {
  margin: 1rem 0;
}

.csh__factor-btn {
  flex: 1;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px #e2e7e5;
  text-align: left;
}

.csh__factor-btn strong,
.csh__factor-btn span {
  display: block;
}

.csh__factor-btn span {
  margin-top: 0.25rem;
  color: #626c76;
  font-size: 0.82rem;
  line-height: 1.3;
}

.csh__results {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 0.6rem;
}

.csh__result {
  min-height: 7rem;
  padding: 0.8rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px #e2e7e5;
}

.csh__result span,
.csh__result small {
  display: block;
  color: #626c76;
  font-size: 0.78rem;
  font-weight: 800;
}

.csh__result strong {
  display: block;
  margin: 0.4rem 0;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  line-height: 1;
}

.csh__result--main {
  background: linear-gradient(135deg, #243f90, #3056d3);
  color: #fff;
  box-shadow: none;
}

.csh__result--main span,
.csh__result--main small {
  color: rgba(255, 255, 255, 0.82);
}

.csh__formula,
.csh__interpretation {
  margin-top: 0.75rem;
  padding: 0.8rem;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2e7e5;
}

.csh__formula span,
.csh__interpretation strong,
.csh__interpretation span {
  display: block;
}

.csh__formula span {
  margin-bottom: 0.35rem;
  color: #626c76;
  font-size: 0.78rem;
  font-weight: 800;
}

.csh__formula code {
  white-space: normal;
}

.csh__interpretation {
  border-left: 5px solid #e29500;
}

.csh__interpretation span {
  margin-top: 0.25rem;
  color: #626c76;
  line-height: 1.4;
}

.theme-dark .csh {
  border-color: #283245;
  background:
    linear-gradient(135deg, rgba(204, 118, 31, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(88, 113, 214, 0.15), transparent 38%),
    #0b1020;
  color: #edf1f7;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

.theme-dark .csh__warning {
  border-color: #ff8178;
  background: linear-gradient(135deg, #3a171a, #291721);
  box-shadow: inset 4px 0 0 #ff6258;
}

.theme-dark .csh__sodium-stage,
.theme-dark .csh__result,
.theme-dark .csh__toggle-btn,
.theme-dark .csh__factor-btn {
  background-color: #121a2a;
}

.theme-dark .csh__input-shell,
.theme-dark .csh__pin,
.theme-dark .csh__formula,
.theme-dark .csh__interpretation {
  border-color: #303a4d;
  background: #0d1422;
}

.theme-dark .csh__toggle-btn--active,
.theme-dark .csh__factor-btn--active {
  border-color: #8ea2ff;
  background: #202b52;
}

.theme-dark .csh__sodium-stage {
  background:
    linear-gradient(90deg, rgba(73, 103, 181, 0.2), transparent 38%),
    linear-gradient(90deg, transparent 41%, rgba(116, 108, 87, 0.2) 42%, rgba(116, 108, 87, 0.2) 64%, transparent 65%),
    linear-gradient(90deg, transparent 66%, rgba(181, 83, 75, 0.18)),
    #111827;
  box-shadow: inset 0 0 0 1px #303a4d;
}

.theme-dark .csh__result,
.theme-dark .csh__factor-btn,
.theme-dark .csh__formula {
  box-shadow: inset 0 0 0 1px #283245;
}

.theme-dark .csh__result--main {
  background: linear-gradient(135deg, #405cc7, #7b5cff);
}

.theme-dark .csh__pin--corrected {
  color: #f2b84b;
}

.theme-dark .csh__pin--measured {
  color: #91a8ff;
}

.theme-dark .csh__input-shell small,
.theme-dark .csh__converted,
.theme-dark .csh__factor-btn span,
.theme-dark .csh__result span,
.theme-dark .csh__result small,
.theme-dark .csh__formula span,
.theme-dark .csh__interpretation span {
  color: #b3bdca;
}

@media (max-width: 760px) {
  .csh__layout,
  .csh__inputs,
  .csh__results {
    grid-template-columns: 1fr;
  }

  .csh__rule {
    min-height: 22rem;
  }

  .csh__factor {
    flex-direction: column;
  }
}
