:root {
  color-scheme: light;
  --ink: #1e2329;
  --muted: #657180;
  --line: #d7dee7;
  --paper: #ffffff;
  --bg: #eef3f2;
  --green: #2e7d5b;
  --gold: #c78923;
  --blue: #3c78a8;
  --rose: #c85858;
  --teal: #3d9a9a;
  --shadow: 0 24px 60px rgba(31, 45, 61, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(46, 125, 91, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(199, 137, 35, 0.15), transparent 32%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(215, 222, 231, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(31, 45, 61, 0.08);
}

.site-nav div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 6px;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 850;
  text-decoration: none;
}

.site-nav a:hover {
  background: #eef3f2;
}

.site-nav .brand-link {
  padding-left: 0;
  color: var(--green);
}

.site-nav .nav-donate {
  background: #0070ba;
  color: #fff;
}

.site-nav .nav-donate:hover {
  background: #005ea6;
}

.site-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
  padding: 30px;
  border: 1px solid rgba(215, 222, 231, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.site-hero h1 {
  max-width: 780px;
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 5vw, 4.7rem);
}

.site-hero p:not(.eyebrow) {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.admin-open-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 18px;
  border-radius: 6px;
  background: #1e2329;
  color: #fff;
  padding: 0 16px;
  font-weight: 850;
  text-decoration: none;
}

.admin-open-button:hover {
  background: #000;
}

.donate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 18px;
  border-radius: 6px;
  background: #0070ba;
  color: #fff;
  padding: 0 18px;
  font-weight: 850;
  text-decoration: none;
}

.donate-button:hover {
  background: #005ea6;
}

.donate-button.compact {
  min-height: 38px;
  margin-top: 0;
  padding: 0 14px;
}

.hero-metrics {
  display: grid;
  gap: 10px;
}

.hero-metrics div {
  display: grid;
  align-content: center;
  min-height: 92px;
  border-radius: 8px;
  background: #1e2329;
  color: #fff;
  padding: 16px;
}

.hero-metrics strong {
  font-size: 1.7rem;
  line-height: 1;
}

.hero-metrics span {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.85rem;
  font-weight: 750;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid rgba(215, 222, 231, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.tab-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 18px;
  font-weight: 800;
}

.tab-button.active {
  background: var(--green);
  color: #fff;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.calculator.tab-panel {
  display: none;
}

.calculator.tab-panel.active {
  display: grid;
}

.content-band,
.article-studio {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid rgba(215, 222, 231, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.large-heading {
  align-items: start;
  margin-bottom: 18px;
}

.large-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.large-heading > p {
  max-width: 430px;
}

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

.feature-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 18px;
}

.feature-grid h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.feature-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.articles-index {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid rgba(215, 222, 231, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.featured-articles {
  margin-bottom: 18px;
}

.article-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.article-card-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 18px;
}

.article-card-grid p {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.article-card-grid h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  line-height: 1.25;
}

.article-card-grid a {
  color: var(--ink);
  text-decoration: none;
}

.article-card-grid a:hover {
  color: var(--green);
}

.article-card-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.public-article {
  max-width: 820px;
  margin: 0 auto;
  border: 1px solid rgba(215, 222, 231, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 34px;
}

.public-article h1 {
  margin-bottom: 18px;
  font-size: clamp(2.1rem, 4vw, 3.8rem);
}

.public-article h2 {
  margin: 28px 0 10px;
  font-size: 1.35rem;
}

.public-article p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.back-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--green);
  font-weight: 850;
  text-decoration: none;
}

.code-block {
  overflow-x: auto;
  border-radius: 8px;
  background: #1e2329;
  color: #fff;
  padding: 14px;
  line-height: 1.5;
}

.article-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.article-actions .back-link {
  margin-bottom: 0;
}

.article-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
}

.article-tabs {
  display: grid;
  align-content: start;
  gap: 8px;
}

.article-tab {
  width: 100%;
  min-height: 48px;
  border: 1px solid #1e2329;
  border-radius: 6px;
  background: #1e2329;
  color: #fff;
  padding: 0 14px;
  text-align: left;
  font-weight: 850;
}

.article-tab.active {
  background: #000;
  border-color: #000;
  box-shadow: inset 4px 0 0 var(--gold);
}

.article-panel {
  display: none;
  gap: 14px;
}

.article-panel.active {
  display: grid;
}

textarea {
  width: 100%;
  min-height: 46px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfc;
  color: var(--ink);
  outline: none;
  padding: 12px;
  font: inherit;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(46, 125, 91, 0.18);
}

.short-text {
  min-height: 88px;
}

.article-body {
  min-height: 260px;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(215, 222, 231, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.inputs-panel,
.results-panel {
  padding: 24px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

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

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

.home-mark {
  position: relative;
  flex: 0 0 82px;
  height: 82px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2e7d5b 0%, #69a878 100%);
  overflow: hidden;
}

.home-mark::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 24px;
  width: 48px;
  height: 40px;
  background: #fff8ef;
  clip-path: polygon(50% 0, 100% 38%, 100% 100%, 0 100%, 0 38%);
}

.home-mark span {
  position: absolute;
  left: 37px;
  top: 46px;
  width: 13px;
  height: 18px;
  border-radius: 4px 4px 0 0;
  background: var(--gold);
}

.car-mark {
  position: relative;
  flex: 0 0 82px;
  height: 82px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3c78a8 0%, #69a878 100%);
  overflow: hidden;
}

.car-mark::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 35px;
  width: 54px;
  height: 22px;
  border-radius: 8px 8px 5px 5px;
  background: #fff8ef;
}

.car-mark::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 25px;
  width: 34px;
  height: 20px;
  border-radius: 12px 12px 0 0;
  background: #fff8ef;
}

.car-mark span,
.car-mark span::after {
  position: absolute;
  top: 53px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
}

.car-mark span {
  left: 22px;
}

.car-mark span::after {
  content: "";
  left: 27px;
  top: 0;
}

.card-mark {
  position: relative;
  flex: 0 0 82px;
  height: 82px;
  border-radius: 8px;
  background: linear-gradient(135deg, #c85858 0%, #c78923 100%);
  overflow: hidden;
}

.card-mark::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 23px;
  width: 56px;
  height: 36px;
  border-radius: 7px;
  background: #fff8ef;
}

.card-mark::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 33px;
  width: 56px;
  height: 8px;
  background: var(--ink);
}

.card-mark span {
  position: absolute;
  left: 22px;
  top: 48px;
  width: 22px;
  height: 5px;
  border-radius: 999px;
  background: var(--gold);
}

.personal-mark {
  position: relative;
  flex: 0 0 82px;
  height: 82px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2e7d5b 0%, #3c78a8 100%);
  overflow: hidden;
}

.personal-mark::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 17px;
  width: 42px;
  height: 52px;
  border-radius: 7px;
  background: #fff8ef;
}

.personal-mark::after {
  content: "$";
  position: absolute;
  left: 31px;
  top: 20px;
  color: var(--green);
  font-size: 28px;
  font-weight: 900;
}

.personal-mark span,
.personal-mark span::before,
.personal-mark span::after {
  position: absolute;
  left: 28px;
  width: 27px;
  height: 4px;
  border-radius: 999px;
  background: var(--gold);
}

.personal-mark span {
  top: 49px;
}

.personal-mark span::before {
  content: "";
  left: 0;
  top: 9px;
}

.personal-mark span::after {
  content: "";
  left: 0;
  top: -9px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  font-size: 0.88rem;
  font-weight: 750;
}

label small {
  min-height: 1.8em;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.25;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfc;
  color: var(--ink);
  outline: none;
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(46, 125, 91, 0.18);
}

.results-panel {
  display: grid;
  gap: 18px;
}

.payment-card {
  display: grid;
  gap: 8px;
  padding: 22px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #24352e, #2e7d5b);
}

.payment-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.payment-card strong {
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.auto-breakdown {
  grid-template-columns: repeat(4, 1fr);
}

.credit-breakdown {
  grid-template-columns: repeat(4, 1fr);
}

.personal-breakdown {
  grid-template-columns: repeat(4, 1fr);
}

.breakdown div,
.summary-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.breakdown p,
.summary-grid p,
.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
}

.breakdown strong,
.summary-grid strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 1.03rem;
}

.swatch {
  display: block;
  width: 18px;
  height: 7px;
  margin-bottom: 10px;
  border-radius: 999px;
}

.principal {
  background: var(--green);
}

.taxes {
  background: var(--gold);
}

.insurance {
  background: var(--blue);
}

.pmi {
  background: var(--rose);
}

.hoa {
  background: var(--teal);
}

.bar {
  display: flex;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebef;
}

.bar span {
  min-width: 0;
  transition: width 180ms ease;
}

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

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.amortization,
.payoff {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: right;
}

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

th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 900px) {
  .site-hero,
  .calculator {
    grid-template-columns: 1fr;
  }

  .breakdown,
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .feature-grid,
  .article-card-grid,
  .article-shell {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-tab {
    text-align: center;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .inputs-panel,
  .results-panel,
  .site-hero,
  .content-band,
  .articles-index,
  .public-article,
  .article-studio {
    padding: 16px;
  }

  .tabs {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .site-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .site-nav div {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .field-grid,
  .breakdown,
  .summary-grid,
  .feature-grid,
  .article-card-grid,
  .article-shell,
  .article-tabs {
    grid-template-columns: 1fr;
  }

  .title-row,
  .section-heading {
    align-items: flex-start;
  }

  .home-mark {
    flex-basis: 58px;
    height: 58px;
  }

  .car-mark {
    flex-basis: 58px;
    height: 58px;
  }

  .card-mark {
    flex-basis: 58px;
    height: 58px;
  }

  .personal-mark {
    flex-basis: 58px;
    height: 58px;
  }

  .home-mark::before {
    left: 12px;
    top: 17px;
    width: 34px;
    height: 29px;
  }

  .home-mark span {
    left: 27px;
    top: 33px;
    width: 9px;
    height: 13px;
  }

  .car-mark::before {
    left: 10px;
    top: 25px;
    width: 38px;
    height: 16px;
  }

  .car-mark::after {
    left: 16px;
    top: 18px;
    width: 25px;
    height: 15px;
  }

  .car-mark span,
  .car-mark span::after {
    top: 38px;
    width: 10px;
    height: 10px;
  }

  .car-mark span {
    left: 15px;
  }

  .car-mark span::after {
    left: 20px;
  }

  .card-mark::before {
    left: 9px;
    top: 16px;
    width: 40px;
    height: 26px;
  }

  .card-mark::after {
    left: 9px;
    top: 23px;
    width: 40px;
    height: 6px;
  }

  .card-mark span {
    left: 16px;
    top: 35px;
    width: 16px;
    height: 4px;
  }

  .personal-mark::before {
    left: 14px;
    top: 12px;
    width: 30px;
    height: 37px;
  }

  .personal-mark::after {
    left: 22px;
    top: 13px;
    font-size: 19px;
  }

  .personal-mark span,
  .personal-mark span::before,
  .personal-mark span::after {
    left: 20px;
    width: 19px;
    height: 3px;
  }

  .personal-mark span {
    top: 35px;
  }

  .personal-mark span::before {
    top: 7px;
  }

  .personal-mark span::after {
    top: -7px;
  }

  table {
    font-size: 0.78rem;
  }

  th,
  td {
    padding: 10px 4px;
  }
}
