/* Prisberegner */
.trin .card,
.resultat {
  scroll-margin-top: 84px;
}

.beregner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1.5rem;
  align-items: start;
}

.trin {
  display: grid;
  gap: 1.2rem;
  min-width: 0;
}

.trin .card > header {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 1rem;
}

.trin .nr {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--grad);
  color: var(--white);
  font-weight: 700;
}

.trin h2 {
  font-size: 1.25rem;
  margin: 0;
}

.trin .hjaelp {
  color: var(--muted);
  font-size: 0.92rem;
  margin: -0.4rem 0 1rem;
}

/* Kvadratmeter */
.m2-rad {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.m2-tal {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.3rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-weight: 600;
  color: var(--muted);
}

.m2-tal input {
  width: 3.2ch;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  text-align: right;
  background: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.m2-tal input::-webkit-outer-spin-button,
.m2-tal input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

input[type="range"] {
  --fill: 50%;
  flex: 1;
  min-width: 0;
  height: 44px;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary2) var(--fill), var(--line) var(--fill));
}

input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary2) var(--fill), var(--line) var(--fill));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -10px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background: var(--primary2);
  box-shadow: 0 3px 10px rgba(0, 91, 234, 0.45);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background: var(--primary2);
  box-shadow: 0 3px 10px rgba(0, 91, 234, 0.45);
}

.skala {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Valgkort */
.valg {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.valgkort {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 64px;
  padding: 0.8rem 1rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  font: inherit;
  font-weight: 600;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.valgkort small {
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
}

.valgkort:hover {
  border-color: var(--primary);
}

.valgkort[aria-pressed="true"] {
  border-color: var(--primary2);
  background: linear-gradient(135deg, rgba(0, 198, 251, 0.12), rgba(0, 91, 234, 0.08));
}

.valgkort[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grad);
  color: var(--white);
  font-size: 0.75rem;
}

.valgkort[disabled] {
  cursor: default;
  opacity: 1;
}

/* Hus */
.hus-rad {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.2rem;
  align-items: center;
}

.hus-rad .valg {
  grid-template-columns: 1fr;
}

#hus {
  display: block;
  width: 100%;
  height: auto;
}

#hus .tag,
#hus .sal,
#hus .kaelder,
#hus .saltekst,
#hus .kaeldertekst {
  transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.3s;
}

#hus .tag {
  transform: translateY(45px);
}

#hus .sal,
#hus .saltekst,
#hus .kaelder,
#hus .kaeldertekst {
  opacity: 0;
}

#hus.har-sal .tag {
  transform: none;
}

#hus.har-sal .sal,
#hus.har-sal .saltekst,
#hus.har-kaelder .kaelder,
#hus.har-kaelder .kaeldertekst {
  opacity: 1;
}

#etagetekst {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary2);
  margin: 0.3rem 0 0;
}

/* Badeværelser */
.badtyper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.bad {
  display: flex;
  flex-direction: column;
  padding: 0.7rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.bad.valgt {
  border-color: var(--primary2);
  background: linear-gradient(135deg, rgba(0, 198, 251, 0.1), rgba(0, 91, 234, 0.06));
}

.bad svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 170px;
}

.bad h3 {
  margin: 0.4rem 0 0;
  font-size: 1rem;
}

.bad p {
  flex: 1;
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
}

.plan .rum {
  fill: #fff;
  stroke: var(--navy);
  stroke-width: 3;
}

.plan .net {
  stroke: #d6e6fb;
  stroke-width: 1;
}

.plan .ting {
  fill: #e3f4ff;
  stroke: var(--primary2);
  stroke-width: 1.6;
}

.plan .vand {
  fill: rgba(0, 198, 251, 0.35);
  stroke: var(--primary2);
  stroke-width: 1.2;
}

.plan .doer {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
}

.plan .hul {
  stroke: #fff;
  stroke-width: 4;
}

.plan text {
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  fill: var(--muted);
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.stepper button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--grad);
  color: var(--white);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.stepper button:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: default;
}

.stepper .antal {
  min-width: 1.6ch;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
}

.maalestok {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.maalestok i {
  display: block;
  width: 40px;
  height: 6px;
  border: 1.5px solid var(--muted);
  border-top: 0;
}

/* Resultat */
.resultat {
  position: sticky;
  top: 88px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(17, 16, 77, 0.22);
  background: var(--white);
}

.resultat .top {
  position: relative;
  padding: 1.5rem;
  background: var(--grad-navy);
  color: var(--white);
  overflow: hidden;
}

.resultat .top::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--grad);
  opacity: 0.3;
}

.resultat .top > * {
  position: relative;
  z-index: 1;
}

.resultat .label {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 600;
}

.pris {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-weight: 700;
  line-height: 1.1;
}

.pris .fra {
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.8;
}

.pris .tal {
  font-size: 3.4rem;
  font-variant-numeric: tabular-nums;
}

.pris .kr {
  font-size: 1.2rem;
}

.resultat .top small {
  display: block;
  opacity: 0.75;
  font-size: 0.82rem;
}

.tilbud {
  display: none;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0.3rem 0;
}

body:not(.over-max) .tilbud {
  display: none !important;
}

.over-max .tilbud {
  display: block;
}

.over-max .pris,
.over-max .kun-pris {
  display: none !important;
}

.resultat .krop {
  padding: 1.2rem 1.5rem 1.5rem;
}

#linjer {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

#linjer li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--line);
}

#linjer small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

#linjer b {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

#linjer b.minus {
  color: #0a8a4a;
}

#linjer li.sum {
  border-bottom: 0;
  font-weight: 600;
}

.fradrag {
  margin: 0 0 1.2rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--soft);
}

.fradrag p {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}

.kontakt {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
}

.kontakt .spor {
  position: relative;
  flex: none;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #c5cde0;
  transition: background 0.2s;
}

.kontakt .spor::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}

.kontakt[aria-checked="true"] .spor {
  background: var(--primary2);
}

.kontakt[aria-checked="true"] .spor::after {
  transform: translateX(22px);
}

.resultat .btn {
  width: 100%;
  margin-top: 0.6rem;
}

.resultat .fin {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Bundlinje på mobil */
.bundlinje {
  display: none;
}

/* Klassisk skema */
.skema {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.skema th,
.skema td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.skema th:first-child,
.skema td:first-child {
  text-align: left;
}

.skema thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

details.card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
  font-size: 1.1rem;
}

@media (max-width: 980px) {
  .beregner {
    grid-template-columns: 1fr;
  }

  .resultat {
    position: static;
  }

  .bundlinje {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 16px calc(0.6rem + env(safe-area-inset-bottom));
    background: var(--grad-navy);
    color: var(--white);
    box-shadow: 0 -8px 24px rgba(6, 5, 52, 0.35);
    transition: transform 0.25s ease;
  }

  .bundlinje.skjult {
    transform: translateY(110%);
  }

  .bundlinje .pris .tal {
    font-size: 1.8rem;
  }

  .bundlinje .pris .fra,
  .bundlinje .pris .kr {
    font-size: 0.85rem;
  }

  .bundlinje .tilbud {
    font-size: 1.1rem;
    margin: 0;
  }

  .bundlinje .btn {
    min-height: 44px;
    padding: 0.4rem 1.1rem;
    font-size: 0.95rem;
  }

  body.har-bundlinje {
    padding-bottom: 76px;
  }
}

@media (max-width: 600px) {
  .hus-rad {
    grid-template-columns: 1fr;
  }

  #hus {
    max-width: 220px;
    margin: 0 auto;
  }

  .hus-rad .valg {
    grid-template-columns: 1fr 1fr;
  }

  .badtyper {
    gap: 0.4rem;
  }

  .bad {
    padding: 0.5rem 0.3rem;
  }

  .bad h3 {
    font-size: 0.9rem;
  }

  .bad p {
    font-size: 0.74rem;
  }

  .stepper {
    gap: 0.15rem;
  }

  .stepper button {
    width: 40px;
    height: 40px;
  }
}
