:root {
  --bg: #eef4ef;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-border: rgba(14, 62, 39, 0.12);
  --text: #143224;
  --muted: #557565;
  --accent: #1d7a52;
  --accent-dark: #115238;
  --shadow: 0 24px 50px rgba(20, 50, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(29, 122, 82, 0.16), transparent 32%),
    linear-gradient(135deg, #f6fbf6 0%, var(--bg) 55%, #ddebe2 100%);
}

.app-shell {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero {
  position: relative;
  margin-bottom: 1.5rem;
}

.auth-shell {
  max-width: 640px;
}

.auth-card,
.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-error {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  color: #7a261d;
  background: rgba(207, 80, 63, 0.12);
}

.logout-form {
  position: absolute;
  top: 0;
  right: 0;
}

.settings-admin-login {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(29, 122, 82, 0.06);
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 0.75rem;
  font-size: clamp(2.5rem, 5vw, 4.4rem);
  line-height: 0.95;
}

.intro,
.hint,
.secondary p {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.6;
}

.card {
  margin-bottom: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.tab-nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.4rem;
  border: 1px solid rgba(20, 50, 36, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
}

.tab-button {
  width: auto;
  padding: 0.9rem 1.1rem;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.tab-button.active {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 12px 28px rgba(17, 82, 56, 0.18);
}

.tab-button.disabled {
  color: rgba(85, 117, 101, 0.55);
  background: rgba(20, 50, 36, 0.04);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.8;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.calculator {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.field span {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
  cursor: pointer;
}

.toggle-row input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}

.toggle-row span {
  margin: 0;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(20, 50, 36, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
}

input {
  width: 100%;
  border: 0;
  padding: 1rem 1.1rem;
  font: inherit;
  color: var(--text);
  background: transparent;
}

input:focus {
  outline: none;
}

input[readonly] {
  color: var(--accent-dark);
  background: rgba(29, 122, 82, 0.06);
}

.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(29, 122, 82, 0.12);
}

select {
  border: 0;
  padding: 1rem 1.1rem;
  font: inherit;
  color: var(--text);
  background: rgba(29, 122, 82, 0.06);
}

select:focus {
  outline: none;
}

.unit {
  display: inline-flex;
  align-items: center;
  padding: 0 1rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(29, 122, 82, 0.08);
}

button {
  width: fit-content;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.4rem;
  font: inherit;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
  box-shadow: 0 14px 30px rgba(17, 82, 56, 0.22);
}

button:hover {
  transform: translateY(-1px);
}

.result {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 18px;
  background: rgba(29, 122, 82, 0.08);
}

.result-grid {
  display: grid;
  gap: 0.75rem;
}

.result-hero-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  color: white;
  background: linear-gradient(135deg, #1b7a52, #114d35);
  box-shadow: 0 16px 36px rgba(17, 82, 56, 0.18);
}

.result-hero-item {
  display: grid;
  gap: 0.35rem;
}

.result-hero-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

.result-hero-value {
  font-size: clamp(1.2rem, 2vw, 1.75rem);
  line-height: 1.05;
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(20, 50, 36, 0.08);
}

.result-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.result-scale-row {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(20, 50, 36, 0.08);
}

.result-action-row {
  padding-top: 0.35rem;
}

.action-button {
  width: 100%;
}

.result-label {
  color: var(--muted);
}

.result-value {
  font-weight: 700;
}

.result-value.accent {
  color: var(--accent-dark);
  font-size: 1.15rem;
}

.helper-panel {
  padding: 1.2rem;
  border: 1px solid rgba(20, 50, 36, 0.1);
  border-radius: 20px;
  background: rgba(244, 250, 246, 0.92);
}

.helper-panel.hidden {
  display: none;
}

.helper-head h3 {
  margin-bottom: 0.35rem;
}

.helper-intro,
.helper-hint,
.helper-summary,
.helper-assessment p {
  color: var(--muted);
  line-height: 1.6;
}

.helper-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.helper-info-list {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(29, 122, 82, 0.08);
}

.helper-info-list p {
  margin: 0 0 0.55rem;
  color: var(--muted);
  line-height: 1.5;
}

.helper-info-list p:last-child {
  margin-bottom: 0;
}

.input-row-select {
  grid-template-columns: minmax(0, 1fr) auto;
}

.select-row {
  overflow: hidden;
  border: 1px solid rgba(20, 50, 36, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
}

.select-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(29, 122, 82, 0.12);
}

.select-row select {
  width: 100%;
  background: transparent;
}

.helper-error {
  display: none;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  color: #7a261d;
  background: rgba(207, 80, 63, 0.12);
}

.helper-error.visible {
  display: block;
}

.helper-result {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.helper-result-hero {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, #1b7a52, #114d35);
}

.helper-result-kicker {
  font-size: 0.92rem;
  opacity: 0.92;
}

.helper-result-hero strong {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 0.95;
}

.helper-result-hero span:last-child {
  opacity: 0.92;
}

.helper-assessment {
  padding: 1rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 18px;
}

.helper-assessment.good {
  color: #61451f;
  background: rgba(216, 143, 46, 0.14);
  border-color: rgba(216, 143, 46, 0.2);
}

.helper-assessment.ok {
  color: #355f41;
  background: rgba(63, 143, 88, 0.14);
  border-color: rgba(63, 143, 88, 0.18);
}

.helper-assessment.warning {
  color: #6f4d19;
  background: rgba(216, 143, 46, 0.2);
  border-color: rgba(216, 143, 46, 0.26);
}

.helper-assessment.fast,
.helper-assessment.critical {
  color: #6b261c;
  background: rgba(207, 80, 63, 0.12);
  border-color: rgba(207, 80, 63, 0.18);
}

.helper-assessment.neutral {
  color: var(--text);
  background: rgba(29, 122, 82, 0.08);
  border-color: rgba(20, 50, 36, 0.08);
}

.placeholder-card {
  padding: 1.2rem;
  border: 1px dashed rgba(20, 50, 36, 0.18);
  border-radius: 18px;
  background: rgba(29, 122, 82, 0.06);
}

.placeholder-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.settings-list {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(29, 122, 82, 0.06);
}

.settings-reactors {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(29, 122, 82, 0.06);
}

.settings-section-head {
  margin-bottom: 1rem;
}

.reactor-settings-grid {
  display: grid;
  gap: 0.75rem;
}

.reactor-settings-row {
  display: grid;
  grid-template-columns: minmax(100px, 1.1fr) repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: center;
}

.pump-settings-grid .reactor-settings-row {
  grid-template-columns: minmax(100px, 1.1fr) repeat(5, minmax(0, 1fr));
}

.reactor-settings-row input {
  border: 1px solid rgba(20, 50, 36, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.option-settings-head,
.option-settings-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.option-settings-row input {
  border: 1px solid rgba(20, 50, 36, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.reactor-settings-head {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.reactor-settings-head span {
  line-height: 1.3;
}

.settings-hint {
  margin: 0.9rem 0 0;
  color: var(--muted);
}

.settings-hint.error {
  color: #7a261d;
}

.settings-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.9rem;
}

.secondary-action-button {
  width: auto;
  color: var(--accent-dark);
  background: rgba(29, 122, 82, 0.12);
  box-shadow: none;
}

.pricing-panel {
  margin-top: 1.25rem;
}

.pricing-receipt {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
  border: 1px dashed rgba(20, 50, 36, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 245, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.pricing-receipt-head,
.pricing-subtotal,
.pricing-selected-head,
.pricing-grand-total,
.pricing-line,
.pricing-selected-line,
.pricing-option-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.pricing-receipt-head {
  padding-bottom: 0.9rem;
  border-bottom: 1px dashed rgba(20, 50, 36, 0.22);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.pricing-summary-box,
.pricing-options-card,
.pricing-selected-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem 1.05rem;
  border-radius: 16px;
  background: rgba(29, 122, 82, 0.05);
}

.pricing-summary-box {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pricing-summary-item {
  display: grid;
  gap: 0.2rem;
}

.pricing-summary-item span,
.pricing-line span,
.pricing-option-price,
.pricing-selected-line span,
.pricing-subtotal span,
.pricing-selected-head span {
  color: var(--muted);
}

.pricing-summary-item strong,
.pricing-line strong,
.pricing-option-price,
.pricing-selected-line strong,
.pricing-subtotal strong,
.pricing-selected-head strong,
.pricing-grand-total strong {
  font-variant-numeric: tabular-nums;
}

.pricing-receipt-lines,
.pricing-options-list,
.pricing-selected-lines {
  display: grid;
  gap: 0.75rem;
}

.pricing-line,
.pricing-selected-line,
.pricing-option-row {
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed rgba(20, 50, 36, 0.16);
}

.pricing-line:last-child,
.pricing-selected-line:last-child,
.pricing-option-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.pricing-line div {
  display: grid;
  gap: 0.16rem;
}

.pricing-options-card h3 {
  margin-bottom: 0;
}

.pricing-option-row {
  cursor: pointer;
}

.pricing-option-toggle {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.pricing-option-toggle input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.1rem 0 0;
}

.pricing-option-toggle span {
  display: block;
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.pricing-subtotal {
  padding-top: 0.2rem;
  border-top: 1px dashed rgba(20, 50, 36, 0.22);
}

.pricing-selected-lines p {
  margin: 0;
  color: var(--muted);
}

.pricing-grand-total {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, #1b7a52, #114d35);
}

.pricing-grand-total span {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

.pricing-grand-total strong {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.treatment-scale {
  margin-top: 0.6rem;
  padding-bottom: 4rem;
}

.treatment-scale-bar {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      #d94a38 0%,
      #d94a38 12%,
      #e8a33b 22%,
      #d8bf53 28%,
      #4aa35f 40%,
      #2d7d46 100%
    );
  box-shadow: inset 0 0 0 1px rgba(20, 50, 36, 0.08);
}

.treatment-scale-marker {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 4px 14px rgba(20, 50, 36, 0.24);
  transform: translate(-50%, -50%);
}

.treatment-scale-value {
  position: absolute;
  top: 42px;
  left: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  transform: translateX(-50%);
}

.scale-point {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.scale-line {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 2px;
  height: 10px;
  border-radius: 999px;
  background: rgba(20, 50, 36, 0.24);
  transform: translateX(-50%);
}

.scale-label {
  position: absolute;
  top: 24px;
  left: 50%;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  transform: translateX(-50%);
}

.scale-point-low .scale-label {
  left: 50%;
  transform: translateX(-50%);
}

.scale-point-max .scale-label {
  left: 50%;
  transform: translateX(-50%);
}

.tertiary {
  background: rgba(244, 250, 246, 0.92);
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-footer p {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 1rem, 960px);
    padding: 1rem 0 2rem;
  }

  .card {
    padding: 1.1rem;
    border-radius: 20px;
  }

  .tab-nav {
    flex-direction: column;
  }

  .logout-form {
    position: static;
    margin-bottom: 1rem;
  }

  .tab-button {
    width: 100%;
  }

  .result-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .reactor-settings-row {
    grid-template-columns: 1fr;
  }

  .option-settings-row {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    display: block;
  }

  .reactor-settings-head {
    display: none;
  }

  .option-settings-head {
    display: none;
  }

  .result-hero-box {
    grid-template-columns: 1fr;
  }

  .pricing-summary-box {
    grid-template-columns: 1fr;
  }

  .pricing-receipt-head,
  .pricing-subtotal,
  .pricing-selected-head,
  .pricing-grand-total,
  .pricing-line,
  .pricing-selected-line,
  .pricing-option-row {
    flex-direction: column;
  }

  .toggle-row {
    align-items: flex-start;
  }

  .input-row-select {
    grid-template-columns: 1fr;
  }

  .input-row-select select {
    border-top: 1px solid rgba(20, 50, 36, 0.1);
  }

  .result-scale-row {
    padding-bottom: 1rem;
  }

  .treatment-scale-labels {
    display: none;
  }

  .treatment-scale {
    padding-bottom: 5.6rem;
  }

  .scale-point-low .scale-label,
  .scale-point-warning .scale-label,
  .scale-point-good .scale-label,
  .scale-point-max .scale-label {
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
  }

  button {
    width: 100%;
  }

  .app-footer {
    flex-direction: column;
    gap: 0.2rem;
  }
}
