/* =====================================================================
   COMPONENTS — cards, fields, results
   ===================================================================== */

/* ---- Warning banner ---- */
.warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
  padding: 14px 18px;
  border: 1px solid var(--coral);
  border-left: 4px solid var(--coral);
  border-radius: var(--r);
  background: var(--sand);
  color: var(--ink);
  font-size: .86rem;
  line-height: 1.45;
}
.warning-ico {
  flex: 0 0 auto;
  color: var(--coral);
  margin-top: 1px;
}
.warning strong {
  color: var(--coral);
}

/* ---- Card ---- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.card-head {
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-head h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
}
.card-head .pill {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ocean-900);
  background: rgba(0, 157, 255, .14);
  padding: 5px 11px;
  border-radius: 99px;
}
.card-body {
  padding: 24px 26px;
}

/* ---- Segmented control ---- */
.seg {
  display: flex;
  background: rgba(34, 34, 34, .05);
  border-radius: var(--r);
  padding: 4px;
  gap: 4px;
  margin-bottom: 22px;
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  padding: 9px 8px;
  border-radius: var(--r);
  transition: .25s;
  font-size: .9rem;
}
.seg button.on {
  background: #fff;
  color: var(--ocean-800);
  box-shadow: var(--shadow-sm);
}

/* ---- Fields ---- */
.field {
  margin-bottom: 20px;
}
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ocean-800);
  margin-bottom: 7px;
  letter-spacing: .01em;
}
.field .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: .76rem;
}
.inputbox {
  position: relative;
  display: flex;
  align-items: center;
}
.inputbox input {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  padding: 14px 52px 14px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--paper);
  transition: .2s;
  font-variant-numeric: tabular-nums;
}
.inputbox input:focus {
  outline: none;
  border-color: var(--lagoon);
  box-shadow: 0 0 0 4px var(--lagoon-glow);
  background: #fff;
}
.inputbox .unit {
  position: absolute;
  right: 16px;
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
  pointer-events: none;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ---- Switch line + toggle ---- */
.switchline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  margin-bottom: 14px;
}
.switchline .txt {
  font-size: .88rem;
}
.switchline .txt small {
  display: block;
  color: var(--muted);
  font-size: .74rem;
  margin-top: 2px;
}
.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  cursor: pointer;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle .track {
  position: absolute;
  inset: 0;
  background: rgba(34, 34, 34, .18);
  border-radius: 99px;
  transition: .25s;
}
.toggle .track::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .25s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.toggle input:checked + .track {
  background: var(--lagoon);
}
.toggle input:checked + .track::before {
  transform: translateX(20px);
}

/* ---- Rates (collapsible) ---- */
details.rates {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
details.rates summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 600;
  font-size: .86rem;
  color: var(--ocean-800);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
}
details.rates summary::-webkit-details-marker {
  display: none;
}
details.rates summary .chev {
  transition: .25s;
  color: var(--muted);
}
details.rates[open] summary .chev {
  transform: rotate(180deg);
}
.ratesgrid {
  padding: 8px 16px 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.ratesgrid .ri {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ratesgrid .ri span {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
}
.ratesgrid .ri input {
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  padding: 8px 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r);
  background: #fff;
  color: var(--ink);
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.ratesgrid .ri input:focus {
  outline: none;
  border-color: var(--lagoon);
  box-shadow: 0 0 0 3px var(--lagoon-glow);
}
.ratesgrid .full {
  grid-column: 1 / -1;
}

/* ---- Hero amounts ---- */
.hero-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 22px;
}
.ha {
  background: var(--paper-2);
  padding: 20px;
}
.ha.net {
  background: var(--ocean-800);
  color: #fff;
}
.ha .lab {
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: .72;
  margin-bottom: 8px;
}
.ha .val {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ha .val .cur {
  font-size: .62em;
  opacity: .65;
  margin-left: 3px;
}
.ha.net .lab {
  color: var(--lagoon-soft);
  opacity: 1;
}

/* ---- Composition bar ---- */
.compo {
  margin: 6px 0 24px;
}
.compo .bar {
  display: flex;
  height: 40px;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.compo .seg-net {
  background: var(--ocean-700);
}
.compo .seg-employee {
  background: var(--coral-soft);
}
.compo .seg-employer {
  background: var(--sand-deep);
}
.compo .bar > div {
  transition: flex-basis .5s cubic-bezier(.4, 0, .2, 1);
  min-width: 2px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: .78rem;
  color: var(--muted);
}
.legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}
.lg-net i { background: var(--ocean-600); }
.lg-employee i { background: var(--coral-soft); }
.lg-employer i { background: var(--sand-deep); }

/* ---- Breakdown tables ---- */
.bd {
  margin-top: 4px;
}
.bd h3 {
  font-size: .76rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ocean-700);
  font-weight: 700;
  margin: 22px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bd h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: .9rem;
}
.line:last-child {
  border-bottom: 0;
}
.line .l {
  color: var(--ink);
}
.line .l small {
  color: var(--muted);
  font-weight: 500;
}
.line .v {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-family: var(--mono);
  font-size: .86rem;
}
.line.tot {
  margin-top: 4px;
  padding-top: 11px;
  border-top: 2px solid var(--ink);
  border-bottom: 0;
  font-weight: 700;
}
.line.tot .v {
  font-size: .98rem;
}
.line.neg .v {
  color: var(--coral);
}
.line.add .v {
  color: var(--ocean-600);
}

/* ---- Cost box ---- */
.costbox {
  margin-top: 24px;
  background: var(--sand);
  border-radius: var(--r);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.costbox .lab {
  font-size: .74rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ocean-800);
}
.costbox .lab small {
  display: block;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--ocean-700);
  font-size: .78rem;
  margin-top: 3px;
  opacity: .8;
}
.costbox .val {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ocean-900);
  font-variant-numeric: tabular-nums;
}

/* ---- Note ---- */
.note {
  font-size: .74rem;
  color: var(--muted);
  margin-top: 18px;
  line-height: 1.5;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.note b {
  color: var(--ocean-700);
}

/* ---- Animated amounts ---- */
.val,
.v,
.costbox .val {
  transition: none;
}

/* ---- Responsive ---- */
@media (max-width: 520px) {
  .row2,
  .hero-amounts,
  .ratesgrid {
    grid-template-columns: 1fr;
  }

  .card-head {
    padding: 18px 18px 14px;
  }
  .card-body {
    padding: 20px 18px;
  }
  .warning {
    padding: 13px 15px;
    font-size: .84rem;
  }
  .costbox {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* 16px min = no auto-zoom on focus on iOS */
  .ratesgrid .ri input {
    font-size: 16px;
  }
}
