:root {
  color-scheme: light;
  --ink: #10231f;
  --muted: #65736f;
  --soft: #f5f0e6;
  --paper: #fffcf4;
  --panel: rgba(255, 252, 244, 0.94);
  --panel-strong: #ffffff;
  --line: rgba(16, 35, 31, 0.12);
  --line-strong: rgba(16, 35, 31, 0.22);
  --forest: #0f3d35;
  --forest-2: #18584d;
  --mint: #dcefdc;
  --gold: #f4d06f;
  --coral: #d97059;
  --sky: #d7ebf3;
  --shadow: 0 24px 70px rgba(16, 35, 31, 0.16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--soft);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(244, 208, 111, 0.28), transparent 30rem),
    radial-gradient(circle at 100% 12%, rgba(215, 235, 243, 0.9), transparent 28rem),
    linear-gradient(140deg, #fffaf0 0%, #eef6ef 45%, #f5f0e6 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
summary {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 22px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(330px, 430px);
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.topbar,
.hero-panel {
  grid-column: 1 / -1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff7da;
  background: var(--forest);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 61, 53, 0.24);
  font-weight: 900;
}

.kicker {
  margin: 0 0 2px;
  color: var(--forest-2);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 2.65rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.install-button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 16px;
  color: white;
  background: var(--forest);
  box-shadow: 0 12px 28px rgba(15, 61, 53, 0.18);
  font-weight: 850;
}

.install-button:hover {
  background: var(--forest-2);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(310px, 0.8fr);
  gap: 18px;
  padding: 24px;
  overflow: hidden;
  color: white;
  background:
    linear-gradient(135deg, rgba(244, 208, 111, 0.26), transparent 34%),
    linear-gradient(135deg, var(--forest), #12372f 64%, #0b2420);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-label {
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  font-weight: 800;
}

#heroNetPay {
  display: block;
  font-size: clamp(3rem, 10vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

#heroEffectiveRate {
  display: block;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.74);
  font-weight: 760;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-actions button,
.history-actions button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 850;
}

.hero-actions button:first-child {
  color: var(--forest);
  background: var(--gold);
}

.hero-actions button:last-child {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-self: end;
  gap: 10px;
}

.hero-stats > div {
  display: grid;
  min-height: 92px;
  gap: 8px;
  align-content: end;
  padding: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: var(--radius);
}

.hero-stats span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.82rem;
  font-weight: 800;
}

.hero-stats strong {
  font-size: clamp(1.05rem, 3vw, 1.35rem);
}

.calculator,
.results {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.calculator {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 252, 244, 0.72);
  backdrop-filter: blur(18px);
}

.form-section {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-number {
  display: grid;
  width: 34px;
  height: 28px;
  place-items: center;
  color: var(--forest);
  background: var(--mint);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 900;
}

fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  border: 0;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 780;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
  background: #fffcf4;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--forest) 50%),
    linear-gradient(135deg, var(--forest) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 12px) 20px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

input:focus,
select:focus {
  border-color: var(--forest);
  outline: 4px solid rgba(47, 143, 114, 0.18);
}

.toggles {
  display: grid;
  grid-column: 1 / -1;
  gap: 9px;
}

.check-row {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 11px;
  padding: 10px 12px;
  background: #f7fbf7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.check-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--forest);
}

.results {
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 14px;
  position: sticky;
  top: 18px;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
}

.net-card {
  display: grid;
  gap: 5px;
  padding: 20px;
  color: white;
  background:
    linear-gradient(145deg, rgba(244, 208, 111, 0.25), transparent 38%),
    #174b3e;
  border-radius: var(--radius);
}

.net-card span,
.net-card small {
  color: rgba(255, 255, 255, 0.76);
  font-weight: 760;
}

.net-card strong {
  font-size: clamp(2.3rem, 7vw, 3.35rem);
  line-height: 1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-grid > div {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary-grid > div:nth-child(2) {
  background: #fff4ed;
}

.summary-grid > div:nth-child(4) {
  background: #eef8fb;
}

.summary-grid span,
.breakdown dt,
.assumptions li {
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-grid strong {
  font-size: 1.18rem;
}

.breakdown,
.assumptions,
.projection-panel,
.paystub-panel,
.install-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.projection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.projection-grid > div {
  display: grid;
  gap: 6px;
  min-height: 82px;
  align-content: end;
  padding: 13px;
  background: #f7fbf7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.projection-grid span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 780;
}

.projection-grid strong {
  font-size: 1.24rem;
}

.install-panel {
  background: #fff8dc;
}

.install-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.deduction-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

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

dd {
  margin: 0;
  font-weight: 850;
}

summary {
  cursor: pointer;
  color: var(--forest);
  font-weight: 850;
}

ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

a {
  color: var(--forest-2);
  font-weight: 760;
}

.history-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 18px;
  background: rgba(255, 252, 244, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.history-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.history-item {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-item > div:first-child {
  display: grid;
  gap: 4px;
}

.history-item strong {
  font-size: 1.35rem;
}

.history-item span,
.empty-history {
  color: var(--muted);
  font-size: 0.9rem;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.history-actions button {
  flex: 1;
  color: var(--forest);
  background: var(--mint);
  border-color: var(--line);
}

.history-actions button:last-child {
  color: var(--ink);
  background: #fff4ed;
}

.empty-history {
  margin: 0;
}

.mobile-result-bar {
  display: none;
}

@media (max-width: 930px) {
  .app-shell {
    padding: 14px 14px 92px;
  }

  .workspace,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    padding: 20px;
  }

  .results {
    position: static;
  }

  .mobile-result-bar {
    position: fixed;
    right: 14px;
    bottom: 14px;
    left: 14px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 62px;
    padding: 10px 16px;
    color: white;
    background: rgba(15, 61, 53, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    box-shadow: 0 18px 45px rgba(15, 61, 53, 0.26);
  }

  .mobile-result-bar span {
    color: rgba(255, 255, 255, 0.72);
    font-weight: 800;
  }

  .mobile-result-bar strong {
    font-size: 1.45rem;
  }

  .history-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }

  .install-button {
    min-height: 38px;
    padding: 0 11px;
    font-size: 0.88rem;
  }

  .hero-stats,
  .projection-grid,
  fieldset,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .form-section,
  .results,
  .calculator {
    padding: 12px;
  }

  #heroNetPay {
    font-size: clamp(2.9rem, 15vw, 4.5rem);
  }
}
