:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --brand: #1a365d;
  --brand-strong: #102a4c;
  --accent: #2f80ed;
  --line: #d8e0ea;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --success: #238553;
  --success-soft: #edfdf4;
  --shadow: 0 18px 45px rgba(16, 42, 76, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
  background: #eef3f8;
  overflow-x: hidden;
}

body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(26, 54, 93, 0.12), rgba(238, 243, 248, 0) 42%),
    #eef3f8;
  overflow-x: hidden;
}

@media (display-mode: standalone) {
  .app-shell {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: max(2px, env(safe-area-inset-top)) 14px max(2px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.calculator {
  width: min(100%, 480px);
  background: var(--surface);
  border: 1px solid rgba(26, 54, 93, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.install-panel {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin: -6px 0 18px;
  border: 1px solid #c9d8ea;
  border-radius: 8px;
  background: #eef6ff;
}

.install-panel:not([hidden]) {
  display: flex;
}

.install-panel div {
  display: grid;
  gap: 2px;
}

.install-panel strong {
  color: var(--brand);
  font-size: 14px;
  font-weight: 850;
}

.install-panel span {
  color: #55677f;
  font-size: 12px;
  line-height: 1.35;
}

.install-panel button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--brand);
  font-size: clamp(26px, 9vw, 34px);
  line-height: 1.05;
  margin-top: 9px;
}

h2,
.field-label {
  display: block;
  color: #45556d;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.price-panel {
  text-align: center;
  margin-bottom: 24px;
}

.price-input-wrap {
  width: min(100%, 290px);
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 18px;
  padding-bottom: 7px;
  border-bottom: 2px solid var(--line);
}

#priceDisplay {
  width: 220px;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  color: var(--brand);
  background: transparent;
  font-size: clamp(31px, 11vw, 42px);
  font-weight: 850;
  line-height: 1;
  text-align: right;
}

.price-input-wrap span {
  color: var(--brand);
  font-size: clamp(22px, 7vw, 28px);
  font-weight: 850;
}

.price-slider {
  width: 100%;
  cursor: pointer;
  accent-color: var(--brand);
}

.deal-type {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 14px;
  margin-bottom: 25px;
  border: 1px solid #e4eaf1;
  border-radius: 8px;
  background: var(--soft);
}

.type-label {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: #9aa7b8;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.type-label.active {
  color: var(--brand);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 54px;
  height: 30px;
  flex: 0 0 auto;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--brand);
  transition: background 160ms ease;
}

.switch-thumb {
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 160ms ease;
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(24px);
}

.discount-section {
  margin-bottom: 24px;
}

.discount-buttons {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.discount-button {
  min-height: 42px;
  border: 1px solid #dfe6ef;
  border-radius: 7px;
  background: #fff;
  color: #41516a;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.discount-button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.discount-button[hidden] {
  display: none;
}

.results {
  display: grid;
  gap: 10px;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 15px 17px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}

.result-row span {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-row strong {
  color: #78c4ff;
  font-size: clamp(21px, 7vw, 27px);
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.result-total {
  background: var(--brand-strong);
}

.result-total strong {
  color: #fff;
}

.savings {
  margin-top: 22px;
  padding: 14px;
  border: 1px solid #bfe9cf;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success);
  text-align: center;
}

.savings span {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.savings strong {
  font-size: 22px;
  font-weight: 850;
}

.note {
  margin: 24px 0 0;
  color: #8794a6;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 390px) {
  .calculator {
    padding: 16px;
  }

  .discount-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .deal-type {
    gap: 9px;
  }

  .install-panel {
    align-items: stretch;
    flex-direction: column;
  }
}
