:root {
  --calc-max: 980px;
}

.calculator-content {
  max-width: var(--calc-max);
  margin: 0 auto;
  padding: 96px 24px 64px;
}

.calculator-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(180, 205, 245, 0.92);
  font-size: 14px;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}
.back-link:hover { border-color: rgba(79, 140, 255, 0.28); background: rgba(79, 140, 255, 0.07); }

.calculator-hero {
  margin: 8px 0 18px;
  padding: 18px 18px 16px;
  border-radius: 16px;
  border: 1px solid rgba(79, 140, 255, 0.18);
  background:
    radial-gradient(ellipse 80% 70% at 10% 0%, rgba(79, 140, 255, 0.14), transparent 60%),
    linear-gradient(135deg, rgba(30, 58, 100, 0.16), rgba(9, 15, 30, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.calculator-hero h1 {
  font-size: clamp(1.5rem, 3.6vw, 2.125rem);
  line-height: 1.14;
  margin: 8px 0 8px;
  font-weight: 900;
  letter-spacing: 0.01em;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .calculator-hero h1 {
    background: linear-gradient(90deg, #7dd3fc 0%, #60a5fa 35%, #a78bfa 70%, #c4b5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}
.calculator-hero__subtitle {
  margin: 0 0 8px;
  font-size: clamp(1.375rem, 3.1vw, 1.875rem);
  line-height: 1.18;
  font-weight: 700;
  color: rgba(236, 243, 255, 0.96);
}
.calculator-hero__tagline {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(214, 226, 245, 0.86);
}
.calculator-hero__divider {
  height: 1px;
  margin: 12px 0 14px;
  background: linear-gradient(90deg, transparent, rgba(79, 140, 255, 0.28), rgba(255, 255, 255, 0.10), rgba(139, 92, 255, 0.20), transparent);
}
.calculator-hero__divider--top { margin: 4px 0 14px; }

.calculator-section { scroll-margin-top: 90px; margin-top: 18px; }
.calculator-section-title { margin-bottom: 14px; }

.calculator-card { padding: 20px 18px; }

.calculator-subsection {
  display: grid;
  gap: 12px;
  padding-top: 10px;
}
.calculator-subsection + .calculator-subsection {
  margin-top: 16px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.calculator-subsection__title {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(180, 205, 245, 0.92);
}
html[data-theme="light"] .calculator-subsection + .calculator-subsection {
  border-top-color: rgba(15, 23, 42, 0.10);
}
html[data-theme="light"] .calculator-subsection__title {
  color: rgba(15, 23, 42, 0.72);
}

.calculator-gate {
  display: grid;
  gap: 10px;
}
.calculator-gate__text { margin: 0; }
.calculator-gate__btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.calculator-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 720px) {
  .calculator-content { padding: 92px 16px 56px; }
  .calculator-form-grid { grid-template-columns: 1fr; }
}

/* Business parameters single column layout */
.calculator-form-grid--business {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.calculator-form-grid--business .calculator-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}
.calculator-form-grid--business .calculator-field--vertical {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.calculator-form-grid--business .calculator-field__label {
  flex: 0 0 280px;
  text-align: right;
  margin: 0;
  font-weight: 700;
  font-size: 14px;
  color: rgba(245, 247, 255, 0.92);
}
.calculator-form-grid--business .calculator-field--vertical .calculator-field__label {
  text-align: left;
  margin: 0;
}
.calculator-form-grid--business .calculator-input {
  flex: 1;
  margin: 0;
}
.calculator-form-grid--business .calculator-field--vertical .calculator-input {
  margin: 0;
}
.calculator-form-grid--business .calculator-range {
  flex: 1;
  margin: 0;
  width: 100%;
}
.calculator-form-grid--business .calculator-field__value {
  flex: 1;
}
.calculator-alloc {
  width: 100%;
}
.calculator-alloc .calculator-range {
  width: 100%;
}
.calculator-alloc__row {
  width: 100%;
}
.calculator-form-grid--business .calculator-field__hint {
  flex: 2 1 100%;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(163, 173, 199, 0.92);
  line-height: 1.5;
}
.calculator-form-grid--business .calculator-field--vertical .calculator-field__hint {
  margin-top: 4px;
}

.calculator-field { display: flex; flex-direction: column; gap: 8px; }
.calculator-field--wide { grid-column: 1 / -1; }
.calculator-field__label { font-weight: 700; font-size: 14px; color: rgba(245, 247, 255, 0.92); }
.calculator-field__label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: nowrap; }
.calculator-field__label-row > .calculator-field__label { flex: 1 1 1%; min-width: 0; }
.calculator-field__label-row > .calculator-field__value { flex: 0 0 auto; white-space: nowrap; }
.calculator-field__value { font-size: 13px; color: rgba(180, 205, 245, 0.92); font-weight: 800; display: flex; align-items: center; gap: 8px; }
.calculator-field__hint { font-size: 12px; color: rgba(163, 173, 199, 0.92); line-height: 1.5; }

/* Benchmarks: reference vs actual overlay slider */
.calculator-refslider {
  gap: 10px;
  grid-column: 1 / -1;
}
.calculator-refslider__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.calculator-refslider__top .calculator-field__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.calculator-refslider__meta {
  font-size: 12px;
  color: rgba(163, 173, 199, 0.92);
  font-weight: 800;
}
.calculator-refslider__refvalue {
  color: rgba(245, 247, 255, 0.96);
}
.calculator-refslider__meta .calculator-dev--good { color: rgba(16, 185, 129, 0.95); }
.calculator-refslider__meta .calculator-dev--warn { color: rgba(251, 191, 36, 0.98); }
.calculator-refslider__meta .calculator-dev--bad { color: rgba(239, 68, 68, 0.98); }
.calculator-refslider__meta .calculator-dev--na { color: inherit; opacity: 0.85; }
.calculator-refslider__track {
  position: relative;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 30px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.calculator-refslider__bar {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
  z-index: 1;
}
.calculator-refslider__bar--ref {
  height: 16px;
  background: rgba(148, 163, 184, 0.16); /* unfilled */
  overflow: hidden;
}
.calculator-refslider__bar--ref::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.36), rgba(148, 163, 184, 0.52)); /* filled */
  -webkit-clip-path: inset(0 calc(100% - var(--ref-pct, 0%)) 0 0);
  clip-path: inset(0 calc(100% - var(--ref-pct, 0%)) 0 0);
}

/* Range corridor: fill between ref-from and ref-to */
.calculator-refslider--range .calculator-refslider__bar--ref::before {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.28), rgba(16, 185, 129, 0.42));
  -webkit-clip-path: inset(0 calc(100% - var(--ref-to-pct, 0%)) 0 var(--ref-from-pct, 0%));
  clip-path: inset(0 calc(100% - var(--ref-to-pct, 0%)) 0 var(--ref-from-pct, 0%));
}
.calculator-refslider__bar--actual {
  height: 8px;
  background: rgba(79, 140, 255, 0.16); /* unfilled */
  box-shadow:
    0 0 0 1px rgba(79, 140, 255, 0.16),
    0 10px 18px rgba(79, 140, 255, 0.10);
  z-index: 2;
  overflow: hidden;
}
.calculator-refslider__bar--actual::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(79, 140, 255, 0.92), rgba(139, 92, 246, 0.82)); /* filled */
  -webkit-clip-path: inset(0 calc(100% - var(--actual-pct, 0%)) 0 0);
  clip-path: inset(0 calc(100% - var(--actual-pct, 0%)) 0 0);
}
.calculator-refslider__delta {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.98);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
  pointer-events: none;
  z-index: 3;
}
.calculator-refslider__delta.calculator-dev--good {
  background: rgba(16, 185, 129, 0.98);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.calculator-refslider__delta.calculator-dev--warn {
  background: rgba(251, 191, 36, 0.99);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.calculator-refslider__delta.calculator-dev--bad {
  background: rgba(239, 68, 68, 1.0);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.calculator-refslider__delta.calculator-dev--na {
  opacity: 0.55;
}
.calculator-refslider__thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 999px;
  z-index: 4;
}
.calculator-refslider__thumb--ref {
  background: rgba(236, 243, 255, 0.92);
  border: 2px solid rgba(148, 163, 184, 0.75);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.42);
}
.calculator-refslider__thumb--actual {
  width: 13px;
  height: 13px;
  background: rgba(79, 140, 255, 0.95);
  border: 2px solid rgba(236, 243, 255, 0.92);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.42);
}
.calculator-refslider__labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(163, 173, 199, 0.92);
  padding: 0 4px;
}

html[data-theme="light"] .calculator-refslider__meta { color: rgba(15, 23, 42, 0.72); }
html[data-theme="light"] .calculator-refslider__refvalue { color: rgba(15, 23, 42, 0.92); }
html[data-theme="light"] .calculator-refslider__meta .calculator-dev--good { color: rgba(5, 150, 105, 0.95); }
html[data-theme="light"] .calculator-refslider__meta .calculator-dev--warn { color: rgba(202, 138, 4, 0.95); }
html[data-theme="light"] .calculator-refslider__meta .calculator-dev--bad { color: rgba(220, 38, 38, 0.95); }
html[data-theme="light"] .calculator-refslider__track {
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.90);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.60),
    0 12px 30px rgba(15, 23, 42, 0.10);
}
html[data-theme="light"] .calculator-refslider__bar--ref {
  background: rgba(15, 23, 42, 0.08); /* unfilled */
}
html[data-theme="light"] .calculator-refslider__bar--ref::before {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0.30)); /* filled */
}
html[data-theme="light"] .calculator-refslider--range .calculator-refslider__bar--ref::before {
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.22), rgba(5, 150, 105, 0.34));
}
html[data-theme="light"] .calculator-refslider__bar--actual {
  background: rgba(37, 99, 235, 0.10); /* unfilled */
}
html[data-theme="light"] .calculator-refslider__bar--actual::before {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.90), rgba(99, 102, 241, 0.78)); /* filled */
}
html[data-theme="light"] .calculator-refslider__delta {
  background: rgba(220, 38, 38, 0.98);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14);
}
html[data-theme="light"] .calculator-refslider__delta.calculator-dev--good {
  background: rgba(5, 150, 105, 0.95);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14);
}
html[data-theme="light"] .calculator-refslider__delta.calculator-dev--warn {
  background: rgba(202, 138, 4, 0.95);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14);
}
html[data-theme="light"] .calculator-refslider__delta.calculator-dev--bad {
  background: rgba(220, 38, 38, 0.98);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14);
}
html[data-theme="light"] .calculator-refslider__labels { color: rgba(15, 23, 42, 0.70); }

/* Profile validation highlight */
.calculator-input.is-invalid,
.calculator-range.is-invalid {
  border-color: rgba(251, 146, 60, 0.70) !important;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.18) !important;
}
.calculator-input.is-invalid {
  background: rgba(251, 146, 60, 0.08) !important;
}
html[data-theme="light"] .calculator-input.is-invalid {
  background: rgba(251, 146, 60, 0.10) !important;
  border-color: rgba(217, 119, 6, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.16) !important;
}

.calculator-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-weight: 800;
  color: rgba(236, 243, 255, 0.92);
}
.calculator-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: rgba(79, 140, 255, 0.95);
}

.calculator-switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.calculator-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex: 0 0 auto;
}
.calculator-switch__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
}
.calculator-switch__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background 160ms ease, border-color 160ms ease;
  pointer-events: none;
}
.calculator-switch__thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(236, 243, 255, 0.92);
  border: 2px solid rgba(79, 140, 255, 0.80);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
  transition: left 160ms ease, border-color 160ms ease, background 160ms ease;
  pointer-events: none;
  z-index: 2;
}
.calculator-switch__input:checked ~ .calculator-switch__track {
  background: rgba(79, 140, 255, 0.22);
  border-color: rgba(79, 140, 255, 0.35);
}
.calculator-switch__input:checked ~ .calculator-switch__thumb {
  left: 21px;
  border-color: rgba(79, 140, 255, 0.95);
}
.calculator-switch__input:focus-visible ~ .calculator-switch__track {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.20);
}
.calculator-switch__text {
  font-weight: 900;
  color: rgba(236, 243, 255, 0.92);
}

html[data-theme="light"] .calculator-switch__track {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.16);
}
html[data-theme="light"] .calculator-switch__thumb {
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.16);
}
html[data-theme="light"] .calculator-switch__input:checked ~ .calculator-switch__track {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.28);
}
html[data-theme="light"] .calculator-switch__text {
  color: rgba(15, 23, 42, 0.92);
}

.calculator-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(245, 247, 255, 0.95);
  padding: 12px 12px;
  outline: none;
}
.calculator-input--compact {
  padding: 10px 10px;
  font-size: 13px;
  border-radius: 12px;
}

.calculator-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.calculator-mode {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.calculator-mode__label {
  font-size: 12px;
  color: rgba(163, 173, 199, 0.92);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.calculator-input:focus-visible {
  border-color: rgba(79, 140, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}
html[data-theme="light"] .calculator-input {
  background: rgba(15, 23, 42, 0.03);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.10);
}

.calculator-range { width: 100%; }

.calculator-info {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(236, 243, 255, 0.92);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
}
.calculator-info:hover { border-color: rgba(79, 140, 255, 0.45); }

.calculator-alloc {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}
.calculator-alloc__row {
  display: grid;
  gap: 8px;
}
.calculator-alloc__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.calculator-alloc__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: rgba(245, 247, 255, 0.92);
}
.calculator-alloc__value {
  font-size: 13px;
  font-weight: 900;
  color: rgba(180, 205, 245, 0.92);
}

.calculator-range--mgmt { accent-color: rgba(79, 140, 255, 0.95); }
.calculator-range--ops { accent-color: rgba(16, 185, 129, 0.95); }
.calculator-range--support { accent-color: rgba(251, 191, 36, 0.98); }
.calculator-range--dev { accent-color: rgba(239, 68, 68, 0.95); }

/* Allocation sliders: keep 0..100 scale, but show available cap */
.calculator-range--mgmt { --allocColor: rgba(79, 140, 255, 0.95); }
.calculator-range--ops { --allocColor: rgba(16, 185, 129, 0.95); }
.calculator-range--support { --allocColor: rgba(251, 191, 36, 0.98); }
.calculator-range--dev { --allocColor: rgba(239, 68, 68, 0.95); }

.calculator-alloc .calculator-range {
  --val: 0%;
  --avail: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  background: transparent;
  border-radius: 999px;
}

.calculator-alloc .calculator-range::-webkit-slider-runnable-track {
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(
      90deg,
      var(--allocColor) 0%,
      var(--allocColor) var(--val),
      rgba(148,163,184,0.20) var(--val),
      rgba(148,163,184,0.20) var(--avail),
      rgba(148,163,184,0.34) var(--avail),
      rgba(148,163,184,0.34) 100%
    );
}

/* invalid range: emphasize track border */
.calculator-range.is-invalid::-webkit-slider-runnable-track,
.calculator-range.is-invalid::-moz-range-track {
  border-color: rgba(251, 146, 60, 0.70) !important;
}
html[data-theme="light"] .calculator-range.is-invalid::-webkit-slider-runnable-track,
html[data-theme="light"] .calculator-range.is-invalid::-moz-range-track {
  border-color: rgba(217, 119, 6, 0.55) !important;
}

.calculator-alloc .calculator-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -3px;
  border-radius: 999px;
  background: rgba(236, 243, 255, 0.95);
  border: 2px solid var(--allocColor);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

/* Firefox */
.calculator-alloc .calculator-range::-moz-range-track {
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(
    90deg,
    var(--allocColor) 0%,
    var(--allocColor) var(--val),
    rgba(148,163,184,0.20) var(--val),
    rgba(148,163,184,0.20) var(--avail),
    rgba(148,163,184,0.34) var(--avail),
    rgba(148,163,184,0.34) 100%
  );
}

/* Light theme: increase contrast between available/unavailable */
html[data-theme="light"] .calculator-alloc .calculator-range::-webkit-slider-runnable-track,
html[data-theme="light"] .calculator-alloc .calculator-range::-moz-range-track {
  border-color: rgba(15, 23, 42, 0.18);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--allocColor) 98%, white) 0%,
    color-mix(in srgb, var(--allocColor) 98%, white) var(--val),
    rgba(15, 23, 42, 0.16) var(--val),
    rgba(15, 23, 42, 0.16) var(--avail),
    rgba(15, 23, 42, 0.30) var(--avail),
    rgba(15, 23, 42, 0.30) 100%
  );
}
html[data-theme="light"] .calculator-alloc .calculator-range::-webkit-slider-thumb,
html[data-theme="light"] .calculator-alloc .calculator-range::-moz-range-thumb {
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
}
.calculator-alloc .calculator-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(236, 243, 255, 0.95);
  border: 2px solid var(--allocColor);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.calculator-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.calculator-subtitle {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(152, 222, 185, 0.92);
}

.calculator-axis-code {
  display: inline-block;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.calculator-factor-list { display: grid; gap: 10px; }
.calculator-factor {
  display: block;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.calculator-factor.is-invalid {
  border-color: rgba(251, 146, 60, 0.85);
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.22);
  background: rgba(251, 146, 60, 0.10);
}
.calculator-factor.is-invalid .calculator-badge {
  border-color: rgba(251, 146, 60, 0.70);
  background: rgba(251, 146, 60, 0.08);
}
.calculator-factor.is-invalid .calculator-selection-text {
  color: rgba(217, 119, 6, 0.95);
}
.calculator-factor__top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}
.calculator-factor.is-factor-selected {
  border-color: rgba(79, 140, 255, 0.30);
  background: rgba(79, 140, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(79, 140, 255, 0.12),
    0 16px 40px rgba(0, 0, 0, 0.40);
}

/* Axis card highlight when all factors are chosen */
.calculator-card.is-axis-complete {
  border-color: rgba(52, 211, 153, 0.22);
  box-shadow:
    0 18px 70px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(52, 211, 153, 0.12);
}
.calculator-factor__meta { display: grid; gap: 2px; }
.calculator-factor__title { font-weight: 800; font-size: 14px; color: rgba(245, 247, 255, 0.94); }
.calculator-factor__desc { font-size: 12px; color: rgba(163, 173, 199, 0.92); line-height: 1.35; }

.calculator-factor__divider {
  height: 1px;
  margin: 10px 0 8px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), rgba(79, 140, 255, 0.18), rgba(255, 255, 255, 0.10), transparent);
}

.calculator-factor__selection {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}
.calculator-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(236, 243, 255, 0.98);
  font-weight: 900;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  flex: 0 0 auto;
}
.calculator-selection-text {
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(190, 24, 93, 0.92); /* burgundy prompt until chosen */
}
.calculator-factor.is-factor-selected .calculator-selection-text {
  color: rgba(245, 247, 255, 0.95);
}

.calculator-scale { display: inline-flex; gap: 6px; }
.calculator-scale button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(245, 247, 255, 0.92);
  cursor: pointer;
  font-weight: 800;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.calculator-scale button:hover { border-color: rgba(79, 140, 255, 0.28); background: rgba(79, 140, 255, 0.07); }
.calculator-scale button.is-selected {
  border-color: rgba(236, 243, 255, 0.35);
  box-shadow:
    0 0 0 3px rgba(79, 140, 255, 0.22),
    0 14px 34px rgba(0, 0, 0, 0.55);
  transform: translateY(-2px) scale(1.04);
  color: rgba(236, 243, 255, 0.98);
}

/* Score colors:
   - FS axis: 1 (good/green) -> 5 (bad/red)
   - MS/RS/AS axes: 1 (bad/red) -> 5 (good/green)
*/
.calculator-scale[data-axis="fs"] button[data-score="1"] { background: rgba(16, 185, 129, 0.22); border-color: rgba(16, 185, 129, 0.28); }
.calculator-scale[data-axis="fs"] button[data-score="2"] { background: rgba(34, 197, 94, 0.20);  border-color: rgba(34, 197, 94, 0.26); }
.calculator-scale[data-axis="fs"] button[data-score="3"] { background: rgba(251, 191, 36, 0.22);  border-color: rgba(251, 191, 36, 0.28); }
.calculator-scale[data-axis="fs"] button[data-score="4"] { background: rgba(251, 146, 60, 0.24);  border-color: rgba(251, 146, 60, 0.30); }
.calculator-scale[data-axis="fs"] button[data-score="5"] { background: rgba(239, 68, 68, 0.22);   border-color: rgba(239, 68, 68, 0.30); }

.calculator-scale[data-axis="ms"] button[data-score="1"],
.calculator-scale[data-axis="rs"] button[data-score="1"],
.calculator-scale[data-axis="as"] button[data-score="1"] { background: rgba(239, 68, 68, 0.22); border-color: rgba(239, 68, 68, 0.30); }

.calculator-scale[data-axis="ms"] button[data-score="2"],
.calculator-scale[data-axis="rs"] button[data-score="2"],
.calculator-scale[data-axis="as"] button[data-score="2"] { background: rgba(251, 146, 60, 0.24); border-color: rgba(251, 146, 60, 0.30); }

.calculator-scale[data-axis="ms"] button[data-score="3"],
.calculator-scale[data-axis="rs"] button[data-score="3"],
.calculator-scale[data-axis="as"] button[data-score="3"] { background: rgba(251, 191, 36, 0.22); border-color: rgba(251, 191, 36, 0.28); }

.calculator-scale[data-axis="ms"] button[data-score="4"],
.calculator-scale[data-axis="rs"] button[data-score="4"],
.calculator-scale[data-axis="as"] button[data-score="4"] { background: rgba(34, 197, 94, 0.20); border-color: rgba(34, 197, 94, 0.26); }

.calculator-scale[data-axis="ms"] button[data-score="5"],
.calculator-scale[data-axis="rs"] button[data-score="5"],
.calculator-scale[data-axis="as"] button[data-score="5"] { background: rgba(16, 185, 129, 0.22); border-color: rgba(16, 185, 129, 0.28); }

/* Badge: mirror the same color scale as buttons */
.calculator-factor[data-axis="fs"] .calculator-badge[data-score="1"] { background: rgba(16, 185, 129, 0.26); border-color: rgba(16, 185, 129, 0.35); }
.calculator-factor[data-axis="fs"] .calculator-badge[data-score="2"] { background: rgba(34, 197, 94, 0.24);  border-color: rgba(34, 197, 94, 0.32); }
.calculator-factor[data-axis="fs"] .calculator-badge[data-score="3"] { background: rgba(251, 191, 36, 0.26);  border-color: rgba(251, 191, 36, 0.34); }
.calculator-factor[data-axis="fs"] .calculator-badge[data-score="4"] { background: rgba(251, 146, 60, 0.28);  border-color: rgba(251, 146, 60, 0.36); }
.calculator-factor[data-axis="fs"] .calculator-badge[data-score="5"] { background: rgba(239, 68, 68, 0.26);   border-color: rgba(239, 68, 68, 0.35); }

.calculator-factor[data-axis="ms"] .calculator-badge[data-score="1"],
.calculator-factor[data-axis="rs"] .calculator-badge[data-score="1"],
.calculator-factor[data-axis="as"] .calculator-badge[data-score="1"] { background: rgba(239, 68, 68, 0.26); border-color: rgba(239, 68, 68, 0.35); }

.calculator-factor[data-axis="ms"] .calculator-badge[data-score="2"],
.calculator-factor[data-axis="rs"] .calculator-badge[data-score="2"],
.calculator-factor[data-axis="as"] .calculator-badge[data-score="2"] { background: rgba(251, 146, 60, 0.28); border-color: rgba(251, 146, 60, 0.36); }

.calculator-factor[data-axis="ms"] .calculator-badge[data-score="3"],
.calculator-factor[data-axis="rs"] .calculator-badge[data-score="3"],
.calculator-factor[data-axis="as"] .calculator-badge[data-score="3"] { background: rgba(251, 191, 36, 0.26); border-color: rgba(251, 191, 36, 0.34); }

.calculator-factor[data-axis="ms"] .calculator-badge[data-score="4"],
.calculator-factor[data-axis="rs"] .calculator-badge[data-score="4"],
.calculator-factor[data-axis="as"] .calculator-badge[data-score="4"] { background: rgba(34, 197, 94, 0.24); border-color: rgba(34, 197, 94, 0.32); }

.calculator-factor[data-axis="ms"] .calculator-badge[data-score="5"],
.calculator-factor[data-axis="rs"] .calculator-badge[data-score="5"],
.calculator-factor[data-axis="as"] .calculator-badge[data-score="5"] { background: rgba(16, 185, 129, 0.26); border-color: rgba(16, 185, 129, 0.35); }

.calculator-scale button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.25);
}

.calculator-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 980px) { .calculator-results-grid { grid-template-columns: 1fr; } }

.calculator-results-grid--single {
  grid-template-columns: 1fr;
}

.calculator-kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 6px;
}
.calculator-kpi-grid--two {
  grid-template-columns: 1fr 1fr;
}
.calculator-kpi-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 860px) {
  .calculator-kpi-grid--two { grid-template-columns: 1fr; }
  .calculator-kpi-grid--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .calculator-kpi-grid--four { grid-template-columns: 1fr; }
}
.calculator-kpi {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 12px;
}
.calculator-kpi__label { font-size: 12px; color: rgba(163, 173, 199, 0.92); margin: 0 0 2px; }
.calculator-kpi__value { font-size: 22px; font-weight: 900; margin: 0; letter-spacing: 0.01em; }
.calculator-muted { margin-top: 10px; font-size: 13px; }

/* Gauge KPI */
.calculator-kpi--gauge {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}
@media (max-width: 620px) {
  .calculator-kpi--gauge { grid-template-columns: 1fr; }
}
.calculator-kpi__meta {
  display: grid;
  gap: 2px;
}
.calculator-kpi__title {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(180, 205, 245, 0.92);
}
.calculator-kpi__hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(163, 173, 199, 0.92);
}
.calculator-kpi__big {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.01em;
}
.calculator-gauge {
  width: 260px;
  max-width: 100%;
}
.calculator-gauge svg { width: 100%; height: auto; display: block; }

/* Bullet + Thermometer */
.calculator-kpi--bullet,
.calculator-kpi--thermo {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}
.calculator-kpi--bullet {
  /* фиксируем левую колонку, чтобы все bullet были одинаковой длины */
  grid-template-columns: 180px 1fr;
}
@media (max-width: 620px) {
  .calculator-kpi--bullet,
  .calculator-kpi--thermo { grid-template-columns: 1fr; }
}
.calculator-bullet { width: 100%; max-width: 100%; }
.calculator-kpi--bullet .calculator-bullet { min-width: 0; }
.calculator-thermo { width: 180px; max-width: 100%; }
.calculator-bullet svg,
.calculator-thermo svg { width: 100%; height: auto; display: block; }
.calculator-bullet svg { height: 46px; }

/* Horizontal slider indicator */
.calculator-kpi--hslider {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 10px;
}
.calculator-hslider {
  width: 100%;
  max-width: 100%;
  padding: 0 20px;
  display: grid;
  gap: 8px;
}
.calculator-hslider__labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(163, 173, 199, 0.92);
}
.calculator-hslider__track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background-image: var(--hslider-pale);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 34px rgba(0, 0, 0, 0.28);
}
.calculator-hslider__track::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--hslider-filled);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-clip-path: inset(0 calc(100% - var(--pct, 0%)) 0 0);
  clip-path: inset(0 calc(100% - var(--pct, 0%)) 0 0);
}
.calculator-hslider__thumb {
  position: absolute;
  top: 50%;
  left: calc(var(--pct, 0%) - 7.5px);
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: rgba(236, 243, 255, 0.92);
  border: 2px solid rgba(79, 140, 255, 0.85);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* Vertical slider indicator */
.calculator-kpi--vslider {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 10px;
}
@media (max-width: 620px) {
  .calculator-kpi--vslider { grid-template-columns: 1fr; }
}
.calculator-vslider {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: stretch;
  gap: 6px;
  padding-bottom: 20px;
  padding-left: 20px;
  padding-right: 20px;
}
.calculator-vslider__labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 11px;
  color: rgba(163, 173, 199, 0.92);
  min-width: 24px;
}
.calculator-vslider__track {
  position: relative;
  width: 10px;
  height: 240px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background-image: var(--vslider-pale);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: bottom;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 34px rgba(0, 0, 0, 0.35);
}
.calculator-vslider__track::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--vslider-filled);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: bottom;
  /* Keep full gradient mapping, just reveal bottom part */
  -webkit-clip-path: inset(calc(100% - var(--pct, 0%)) 0 0 0);
  clip-path: inset(calc(100% - var(--pct, 0%)) 0 0 0);
  opacity: 1;
}
.calculator-vslider__thumb {
  position: absolute;
  left: 50%;
  bottom: calc(var(--pct, 0%) - 7.5px);
  transform: translateX(-50%);
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: rgba(236, 243, 255, 0.92);
  border: 2px solid rgba(79, 140, 255, 0.85);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}


.calculator-exec {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.calculator-exec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  font-size: 14px;
}
.calculator-exec-row strong { color: rgba(245, 247, 255, 0.95); }
.calculator-exec-row span { color: rgba(180, 205, 245, 0.92); font-weight: 800; }

.calculator-chart { width: 100%; overflow: hidden; }
.calculator-chart svg { width: 100%; height: auto; display: block; }


.calculator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

html[data-theme="light"] .calculator-hero__subtitle { color: #0f172a; }
html[data-theme="light"] .calculator-hero__tagline { color: rgba(15, 23, 42, 0.78); }
html[data-theme="light"] .calculator-factor__title { color: #0f172a; }
html[data-theme="light"] .calculator-factor__desc { color: rgba(15, 23, 42, 0.72); }
html[data-theme="light"] .calculator-field__label { color: #0f172a; }
html[data-theme="light"] .calculator-field__value { color: rgba(15, 23, 42, 0.86); }
html[data-theme="light"] .calculator-scale button { border-color: rgba(15, 23, 42, 0.12); background: rgba(15, 23, 42, 0.03); color: #0f172a; }
html[data-theme="light"] .calculator-scale button.is-selected { border-color: rgba(37, 99, 235, 0.45); background: rgba(37, 99, 235, 0.10); }

/* Light theme: keep color chips vivid */
html[data-theme="light"] .calculator-scale[data-axis="fs"] button[data-score="1"] { background: rgba(16, 185, 129, 0.18); border-color: rgba(16, 185, 129, 0.28); }
html[data-theme="light"] .calculator-scale[data-axis="fs"] button[data-score="5"] { background: rgba(239, 68, 68, 0.18); border-color: rgba(239, 68, 68, 0.30); }

/* Light theme: improve overall contrast */
html[data-theme="light"] .calculator-card {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(15, 23, 42, 0.10);
}
html[data-theme="light"] .calculator-muted { color: rgba(15, 23, 42, 0.74); }
html[data-theme="light"] .calculator-field__hint { color: rgba(15, 23, 42, 0.72); }
html[data-theme="light"] .calculator-axis-code { color: rgba(37, 99, 235, 0.92); }

html[data-theme="light"] .calculator-kpi {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(15, 23, 42, 0.10);
}
html[data-theme="light"] .calculator-kpi__title { color: rgba(30, 64, 175, 0.95); }
html[data-theme="light"] .calculator-kpi__hint { color: rgba(15, 23, 42, 0.78); }
html[data-theme="light"] .calculator-kpi__big { color: rgba(15, 23, 42, 0.96); }

html[data-theme="light"] .calculator-exec-row {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(15, 23, 42, 0.10);
}
html[data-theme="light"] .calculator-exec-row strong { color: rgba(15, 23, 42, 0.96); }
html[data-theme="light"] .calculator-exec-row span { color: rgba(15, 23, 42, 0.84); }

html[data-theme="light"] .calculator-checkbox { color: rgba(15, 23, 42, 0.92); }
html[data-theme="light"] .calculator-alloc__label { color: rgba(15, 23, 42, 0.92); }
html[data-theme="light"] .calculator-alloc__value { color: rgba(15, 23, 42, 0.84); }

/* Light theme: make charts more readable */
html[data-theme="light"] .calculator-chart svg,
html[data-theme="light"] .calculator-gauge svg,
html[data-theme="light"] .calculator-bullet svg {
  filter: none;
}

/* Light theme: designer pass (surfaces, typography, controls) */
html[data-theme="light"] .calculator-content {
  color: #0f172a;
}
html[data-theme="light"] .back-link {
  color: rgba(15, 23, 42, 0.86);
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.72);
}
html[data-theme="light"] .back-link:hover {
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(37, 99, 235, 0.06);
}

html[data-theme="light"] .calculator-hero {
  border-color: rgba(37, 99, 235, 0.18);
  background:
    radial-gradient(ellipse 80% 70% at 10% 0%, rgba(37, 99, 235, 0.14), transparent 60%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 16px 40px rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .calculator-hero__divider {
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.22), rgba(15, 23, 42, 0.10), rgba(139, 92, 246, 0.18), transparent);
}

html[data-theme="light"] .card-label {
  color: rgba(15, 23, 42, 0.62);
}
html[data-theme="light"] .card-text {
  color: rgba(15, 23, 42, 0.78);
}

html[data-theme="light"] .calculator-input {
  background: rgba(255, 255, 255, 0.90);
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}
html[data-theme="light"] .calculator-input:focus-visible {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

html[data-theme="light"] .calculator-info {
  border-color: rgba(15, 23, 42, 0.14);
  background: rgba(15, 23, 42, 0.04);
  color: rgba(15, 23, 42, 0.84);
}
html[data-theme="light"] .calculator-info:hover { border-color: rgba(37, 99, 235, 0.26); }

html[data-theme="light"] .calculator-kpi {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .calculator-exec-row {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .calculator-chart svg,
html[data-theme="light"] .calculator-gauge svg,
html[data-theme="light"] .calculator-bullet svg,
html[data-theme="light"] .calculator-hslider svg,
html[data-theme="light"] .calculator-vslider svg {
  filter: none;
}

