.gr-calc {
  margin: 6px 0 22px;
  padding-top: 18px;
  border-top: 1px solid #d2d9e3;
}

.gr-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gr-field {
  padding: 6px 20px 16px;
  border-left: 1px solid #d7dee8;
  box-shadow: inset 0 0 0 0 transparent;
  transition: box-shadow 0.15s ease;
}

.gr-field:first-child {
  padding-left: 2px;
  border-left: 0;
}

.gr-field.is-calculated {
  box-shadow: inset 4px 0 0 #2f6a53;
  padding-left: 24px;
}

.gr-field:first-child.is-calculated {
  padding-left: 20px;
}

.gr-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.gr-field-head label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}

.gr-calc-badge[hidden] {
  display: none;
}

.gr-calc-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(47, 106, 83, 0.12);
  color: #2f6a53;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.gr-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gr-input {
  flex: 1 1 90px;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #c7cfdb;
  border-radius: 9px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.gr-input:focus-visible {
  outline: 2px solid rgba(192, 35, 24, 0.35);
  outline-offset: 1px;
}

.gr-unit-pills {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid #c7cfdb;
  border-radius: 999px;
  padding: 2px;
  background: #f0f3f6;
}

.gr-unit-pills button {
  border: 0;
  background: transparent;
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #52627d;
  cursor: pointer;
}

.gr-unit-pills button[aria-pressed="true"] {
  background: #ffffff;
  color: #24324b;
  box-shadow: 0 1px 0 rgba(36, 50, 75, 0.08);
}

.gr-unit-pills button:focus-visible {
  outline: 2px solid rgba(192, 35, 24, 0.35);
  outline-offset: 1px;
}

.gr-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #d7dee8;
  flex-wrap: wrap;
}

.gr-status {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.gr-status.is-ok {
  color: #2f6a53;
  font-weight: 600;
}

.gr-status.is-error {
  color: #9a2039;
  font-weight: 600;
}

.gr-reset-btn {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 16px;
  border: 1px solid #c7cfdb;
  border-radius: 999px;
  background: #ffffff;
  color: #314663;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.gr-reset-btn:hover,
.gr-reset-btn:focus-visible {
  background: #f0f3f6;
  outline: none;
}

.gr-diagram-wrap {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #d7dee8;
}

.gr-diagram {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto;
}

.gr-diagram-line {
  stroke: #24324b;
  stroke-width: 2;
  stroke-linecap: round;
}

.gr-diagram-hyp {
  stroke: #C02318;
  stroke-width: 2.5;
}

.gr-diagram-arc {
  fill: none;
  stroke: #52627d;
  stroke-width: 1.5;
}

.gr-diagram.is-empty .gr-diagram-line,
.gr-diagram.is-empty .gr-diagram-arc {
  stroke-dasharray: 4 4;
  opacity: 0.55;
}

.gr-diagram-label {
  font-size: 11px;
  font-weight: 700;
  fill: #314663;
  font-family: inherit;
  transition: font-size 0.15s ease, fill 0.15s ease;
}

.gr-diagram-angle-label {
  fill: #C02318;
}

.gr-diagram-line,
.gr-diagram-arc {
  transition: stroke 0.15s ease, stroke-width 0.15s ease, opacity 0.15s ease;
}

.gr-diagram-line.is-focus {
  stroke: #1f5fa8;
  stroke-width: 4.5;
  opacity: 1;
}

.gr-diagram-hyp.is-focus {
  stroke: #C02318;
  stroke-width: 4.5;
  opacity: 1;
}

.gr-diagram-arc.is-focus {
  stroke: #C02318;
  stroke-width: 2.5;
  opacity: 1;
}

.gr-diagram-label.is-focus {
  font-size: 14px;
}

.gr-diagram-label.is-focus:not(.gr-diagram-angle-label) {
  fill: #1f5fa8;
}

.gr-diagram-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #7c8aa0;
  text-align: center;
}

@media (max-width: 640px) {
  .gr-field-grid {
    grid-template-columns: 1fr;
  }

  .gr-field {
    padding: 12px 2px;
    border-left: 0;
    border-top: 1px solid #d7dee8;
    box-shadow: none;
  }

  .gr-field:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .gr-field.is-calculated {
    box-shadow: inset 4px 0 0 #2f6a53;
    padding-left: 14px;
  }

  .gr-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .gr-reset-btn {
    width: 100%;
  }
}
