:root{
  --thp-bg:#f5f7fb;
  --thp-card:#ffffff;
  --thp-border:#dbe3ee;
  --thp-border-soft:#e8edf5;
  --thp-text:#12233f;
  --thp-muted:#627089;
  --thp-accent:#0b1f4d;
  --thp-accent-soft:#eef3ff;
  --thp-positive:#147a56;
  --thp-positive-soft:#ecfaf4;
  --thp-tax:#be3f45;
  --thp-tax-soft:#fff2f3;
  --thp-ni:#b56f12;
  --thp-ni-soft:#fff7ea;
  --thp-student:#2b66c7;
  --thp-student-soft:#edf4ff;
  --thp-pension:#7b4ad9;
  --thp-pension-soft:#f4efff;
  --thp-sacrifice:#5b6477;
  --thp-other:#8591a7;
  --thp-shadow:0 8px 28px rgba(10,25,56,.06);
}

.tool-title{
  margin:0;
  font-family:"Cormorant Garamond",serif;
  font-size:clamp(2.5rem,3.8vw,4rem);
  line-height:.95;
  color:#091938;
}

.tool-subtitle{
  margin:12px 0 0;
  max-width:780px;
  color:var(--thp-muted);
  font-size:1.02rem;
  line-height:1.6;
}

.tool-stack {
    padding-bottom: 10px;
}

.tool-layout{
  display:grid;
  grid-template-columns:minmax(0,0.88fr) minmax(320px,1.12fr);
  gap:20px;
  align-items:start;
  padding-bottom: 10px;
}

.tool-card{se
  background:var(--thp-card);
  border:1px solid var(--thp-border);
  border-radius:18px;
  padding:20px;
  margin-bottom: 10px;
  box-shadow:var(--thp-shadow);
}

.tool-card h2{
  margin:0;
  font-family:"Cormorant Garamond",serif;
  font-size:1.95rem;
  line-height:1;
  color:#162847;
}

.card-intro{
  margin:8px 0 0;
  color:var(--thp-muted);
  font-size:.95rem;
  line-height:1.5;
}

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

.form-grid-3,
.compact-grid{
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
}

.form-group,
.form-group-full{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.form-group-full{grid-column:1/-1;}

.form-group label{
  font-weight:600;
  color:#31425d;
  font-size:.94rem;
}

.field-help{
  color:var(--thp-muted);
  font-size:.8rem;
  line-height:1.4;
}

.form-group input,
.form-group select{
  min-height:44px;
  border:1px solid var(--thp-border);
  border-radius:12px;
  padding:0 12px;
  font:inherit;
  color:#1f2e46;
  background:#fff;
  transition:border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
}

.form-group input:hover,
.form-group select:hover{
  border-color:#c8d3e2;
  background:#fcfdff;
}

.form-group input:focus,
.form-group select:focus{
  outline:none;
  border-color:#c6a15b;
  box-shadow:0 0 0 3px rgba(198,161,91,.15);
  transform:translateY(-1px);
}

.rule-table input:is([type="checkbox"]) {
    min-height: 24px;
}

.tool-actions{
  margin-top:16px;
  display:flex;
  align-items:center;
  gap:12px;
}

.tool-actions .btn{
  transition:transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.tool-actions .btn:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 22px rgba(9,25,56,.12);
}

.form-errors{
  margin:0 0 14px;
  padding:12px 14px;
  border:1px solid #efc2c2;
  background:#fff7f7;
  border-radius:12px;
  color:#8a2f2f;
}

.form-errors ul{margin:0;padding-left:18px;}

.form-section{
  border:1px solid var(--thp-border);
  border-left: 2px solid var(--gold);
  border-radius:16px;
  background:#fcfdff;
  margin-bottom:12px;
  transition:box-shadow .22s ease, border-color .22s ease, transform .22s ease;
}

.form-section:hover{
  border-color:#cfd9e6;
  box-shadow:0 4px 14px rgba(10,25,56,.04);
}

.form-section-toggle{
  width:100%;
  border:none;
  background:transparent;
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  cursor:pointer;
  font:inherit;
  font-weight:700;
  font-size:1rem;
  color:#1b2940;
}

.section-caret{
  transition:transform .2s ease;
}

.form-section.is-open .section-caret{transform:rotate(180deg);}

.form-section-body{
  display:none;
  padding:8px 16px 16px;
  border-top:1px solid var(--thp-border-soft);
}

.form-section.is-open .form-section-body{display:block;}

.inline-toggle-group{
  display:inline-flex;
  gap:8px;
  margin-bottom:12px;
  flex-wrap:wrap;
}

.toggle-pill{
  position:relative;
}

.toggle-pill input{
  position:absolute;
  opacity:0;
  inset:0;
}

.toggle-pill span,
.summary-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:38px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid var(--thp-border);
  background:#fff;
  color:#324562;
  font-weight:600;
  cursor:pointer;
  transition:all .18s ease;
}

.toggle-pill input:checked + span,
.summary-toggle.is-active{
  color:#0d234f;
  border-color:#c6a15b;
  background:#fff8ea;
  box-shadow:0 6px 16px rgba(198,161,91,.14);
}

.summary-toggle:hover,
.toggle-pill span:hover{
  transform:translateY(-1px);
}

.check-option{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  padding:0px 12px;
  border:1px solid var(--thp-border);
  border-radius:12px;
  background:#fff;
  color:#334560;
}

.checkbox-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin:14px 0;
}

.repeatable-row{
  position:relative;
  margin-bottom:12px;
  padding:12px;
  border:1px solid var(--thp-border-soft);
  border-radius:14px;
  background:#fff;
}

.row-remove{
  position:absolute;
  right:10px;
  top:10px;
  width:28px;
  height:28px;
  border-radius:50%;
  border:1px solid var(--thp-border);
  background:#f8fafc;
  color:#50617f;
  cursor:pointer;
  transition:all .18s ease;
}

.row-remove:hover{
  background:#fff0f1;
  color:var(--thp-tax);
  border-color:#f0c8cb;
}

.repeatable-actions{margin-top:10px;}
.is-hidden{display:none !important;}

.results-card{
  position:sticky;
  background:linear-gradient(180deg,#ffffff 0%,#fbfcff 100%);
}

.results-sticky-inner{display:flex;flex-direction:column;gap:14px;}
.results-heading-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.breakdown-period-label,
.muted-text,
.hero-caption,
.legend-share{
  color:var(--thp-muted);
  font-size:.86rem;
}

.results-hero{
  padding:16px;
  border-radius:16px;
  background:linear-gradient(135deg,#f9fbff 0%,#f5f8ff 45%,#eef7f2 100%);
  border:1px solid #dde6f4;
}

.results-period-switch{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:14px;
}


.hero-payline{display:flex;flex-direction:column;gap:4px;}
.hero-amount{
  font-size:clamp(2rem,3vw,3rem);
  line-height:1;
  color:var(--thp-positive);
}

.hero-metrics{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:14px;
}

.metric-pill,
.mini-card{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--thp-border-soft);
  background:#fff;
  transition:transform .18s ease, box-shadow .18s ease;
}
.metric-pill:hover,
.mini-card:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(12,24,50,.06);}
.metric-pill span,
.mini-card span{display:block;color:#6a7891;font-size:.82rem;margin-bottom:7px;}
.metric-pill strong,
.mini-card strong{display:block;color:var(--thp-text);font-size:1.15rem;}
.metric-pill--positive{background:var(--thp-positive-soft);border-color:#ccebdd;}
.metric-pill--positive strong{color:var(--thp-positive);}
.metric-pill--negative{background:var(--thp-tax-soft);border-color:#f1d4d7;}
.metric-pill--negative strong{color:var(--thp-tax);}
.mini-card--soft{background:#f9fbff;}

.visual-breakdown{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:14px;
}

.breakdown-card{
  padding:14px;
  border:1px solid var(--thp-border-soft);
  border-radius:16px;
  background:#fff;
}

.chart-card-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}
.chart-card-header h3{
  margin:0;
  font-size:1.02rem;
  color:#1a2f54;
}

.stacked-chart{
  display:flex;
  height:18px;
  border-radius:999px;
  overflow:hidden;
  background:#eef2f7;
  margin-bottom:14px;
}

.stacked-chart__segment{
  min-width:0;
  transition:width .28s ease, filter .18s ease, opacity .18s ease;
}
.stacked-chart__segment:hover{filter:brightness(.95);}
.is-net{background:var(--thp-positive);}
.is-tax{background:var(--thp-tax);}
.is-ni{background:var(--thp-ni);}
.is-student{background:var(--thp-student);}
.is-pension{background:var(--thp-pension);}
.is-sacrifice{background:var(--thp-sacrifice);}
.is-other{background:var(--thp-other);}

.legend-list{display:flex;flex-direction:column;gap:8px;}
.legend-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 10px;
  border-radius:12px;
  background:#fbfcff;
}
.legend-label-wrap{display:flex;align-items:center;gap:8px;min-width:0;}
.legend-label{font-weight:600;color:#334764;font-size:.9rem;}
.legend-swatch{width:12px;height:12px;border-radius:50%;flex:0 0 10px;}
.legend-values{text-align:right;display:flex;flex-direction:column;gap:2px;}
.legend-values strong{font-size:.92rem;color:#0f223f;}
.legend-values .is-negative{color:#7a3a40;}

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

.table-card .breakdown-table-wrap{margin-top:4px;}
.breakdown-table{width:100%;border-collapse:collapse;}
.breakdown-table th,
.breakdown-table td{
  text-align:left;
  padding:10px 0;
  border-bottom:1px solid var(--thp-border-soft);
  font-size:.92rem;
}
.breakdown-table th{color:#344863;font-weight:600;}
.breakdown-table td{text-align:right;font-weight:700;color:#132747;}
.breakdown-table .is-negative{color:#8c3840;}
.breakdown-table .total-row th,
.breakdown-table .total-row td{font-size:1rem;color:var(--thp-positive);}
.breakdown-subrow{background:ghostwhite;}
.breakdown-subrow th{padding-left:16px;font-weight:500;color:#71809b;font-size:.86rem;}
.breakdown-subrow td{padding-left:16px;font-weight:500;font-size:.86rem;}
.breakdown-subrow th::before{content:"↳ ";}
.is-hidden-row{display:none;}

.breakdown-table .breakdown-divider th,
.breakdown-table .breakdown-divider td {
  border-bottom: 3px solid #cfd8e6;
  padding-bottom: 14px;
}

.breakdown-table .breakdown-divider + tr th,
.breakdown-table .breakdown-divider + tr td {
  padding-top: 14px;
}

.results-empty-state{
  padding:16px;
  border-radius:16px;
  background:#f8fbff;
  border:1px dashed #cfd9e7;
}
.results-empty-state h3{margin:8px 0 6px;color:#1a2f54;font-size:1.1rem;}
.results-empty-state p{margin:0 0 12px;color:var(--thp-muted);line-height:1.5;}
.empty-state-badge{
  display:inline-flex;
  min-height:28px;
  padding:0 10px;
  align-items:center;
  border-radius:999px;
  background:#eef4ff;
  color:#35538f;
  font-size:.8rem;
  font-weight:700;
}

@media (max-width: 1120px){
  .tool-layout{grid-template-columns:1fr;}
  .results-card{position:static;}
}

@media (max-width: 780px){
  .tool-form .form-grid,
  .form-grid-3,
  .checkbox-grid,
  .hero-metrics,
  .visual-breakdown,
  .assumption-grid,
  .mini-breakdown-grid{
    grid-template-columns:1fr !important;
  }
  .results-heading-row,
  .chart-card-header{flex-direction:column;align-items:flex-start;}
}

.section-heading {
    text-align: center;
}

.section-light { 
    padding: 48px 0 24px;
}

.tool-subtitle {
    margin: 12px auto 0 !important;
}

.section-light-alt {
    padding: 0;
}

select {
    height: 40px;
}

.calculator-disclaimer{
  margin-top:18px;
  padding:14px 16px;
  border-left:4px solid var(--gold);
  background:#fff8eb;
  color:#5d6a80;
  line-height:1.6;
  border-radius:8px;
}
/* Premium refresh overrides */
.tool-layout,
.tool-card,
.tool-card h2,
.card-intro,
.form-group label,
.form-group input,
.form-group select,
.form-section-toggle,
.check-option,
.metric-pill,
.mini-card,
.chart-card-header h3,
.breakdown-table th,
.breakdown-table td,
.seo-article,
.faq-item,
.faq-question,
.calculator-disclaimer,
.copy-feedback,
.btn-quiet {
  font-family: "DM Sans", sans-serif;
}

.tool-card{ 
  position:relative;
  padding:24px;
  border-radius:22px;
}

.tool-card-inputs{
  box-shadow:0 10px 30px rgba(10,25,56,.05);
}

.tool-card h2{
  font-size:1.9rem;
  margin-bottom:10px;
}

.card-intro{font-size:1rem;}

.tool-form .form-grid{gap:16px 18px;}
.form-group,.form-group-full{gap:8px;}
.form-group label{
  display:flex;
  align-items:center;
  gap:8px;
  line-height:1.2;
  font-size:.95rem;
  color:#304463;
}

.form-group input,
.form-group select{
  min-height:50px;
  border-radius:14px;
  padding:0 15px;
  font-size:1rem;
}

.form-section{
  margin-bottom:16px;
  border-radius:18px;
  background:#ffffff;
}

.form-section-toggle{
  padding:16px 18px;
  font-size:1.02rem;
}

.section-toggle-main{
  display:inline-flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.section-title{
  font-weight:700;
}

.section-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:24px;
  padding:0 10px;
  border-radius:999px;
  background:#f2f5fb;
  color:#71809a;
  font-size:.78rem;
  font-weight:700;
}

.section-status.is-set{
  background:#eaf8f0;
  color:#29855a;
}

.section-caret,
.faq-caret{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  border-radius:999px;
  background:#f3f6fb;
  color:#70819b;
  font-size:1rem;
  transition:transform .22s ease, background .22s ease, color .22s ease;
}

.form-section.is-open .section-caret,
.faq-item.is-open .faq-caret{
  transform:rotate(180deg);
  background:#fff6e6;
  color:#b5882d;
}

.form-section-body,
.faq-answer{
  display:block;
  max-height:0;
  opacity:0;
  pointer-events:none;
  padding:0 18px;
  border-top:1px solid transparent;
  transition:max-height .28s ease, opacity .22s ease, padding .22s ease, border-color .22s ease;
}

.form-section.is-open .form-section-body,
.faq-item.is-open .faq-answer{
  max-height:2000px;
  opacity:1;
  pointer-events:auto;
  padding:10px 18px 18px;
  border-top-color:var(--thp-border-soft);
}

.refine-divider{
  display:flex;
  align-items:center;
  gap:14px;
  margin:10px 2px 16px;
  color:#7584a0;
  text-transform:uppercase;
  letter-spacing:.1em;
  font-size:.86rem;
  font-weight:700;
}

.refine-divider::before,
.refine-divider::after{
  content:"";
  flex:1;
  height:1px;
  background:#d8e1ec;
}

.info-dot,
.info-chip{
  border:none;
  cursor:pointer;
  position:relative;
  flex:0 0 auto;
}

.info-dot{
  width:18px;
  height:18px;
  border-radius:999px;
  background:#f2f5fa;
  color:#7888a3;
  font-size:.7rem;
  font-weight:700;
  line-height:18px;
  text-align:center;
  padding:0;
}

.info-chip-wrap{
  display:inline-flex;
  align-items:center;
  gap:8px;
}

.info-chip{
  width:18px;
  height:18px;
  border-radius:999px;
  background:#f2f5fa;
  color:#7888a3;
  font-size:.7rem;
  font-weight:700;
  line-height:18px;
  text-align:center;
  padding:0;
}

.info-dot::after,
.info-chip::after{
  content:attr(data-tooltip);
  position:absolute;
  left:50%;
  top:calc(100% + 10px);
  transform:translateX(-50%) translateY(4px);
  width:min(280px, 70vw);
  padding:12px 14px;
  border-radius:16px;
  background:#11244d;
  color:#fff;
  font-size:.88rem;
  line-height:1.45;
  box-shadow:0 18px 34px rgba(8,18,40,.18);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease, transform .18s ease;
  z-index:12;
  text-transform:none;
  letter-spacing:normal;
  font-weight:500;
}

.info-dot:hover::after,
.info-dot:focus-visible::after,
.info-chip:hover::after,
.info-chip:focus-visible::after{
  opacity:1;
  transform:translateX(-50%) translateY(0);
}

.repeatable-row{
  padding:14px;
  border-radius:16px;
}

.btn.btn-secondary.btn-small,
.btn-quiet{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:0 16px;
  border-radius:14px;
  border:1px solid #cfd8e6;
  background:#fff;
  color:#334764;
  font-weight:700;
  box-shadow:none;
}

.btn.btn-secondary.btn-small:hover,
.btn-quiet:hover{
  border-color:#bcc8da;
  background:#fbfcff;
}

.tool-actions{margin-top:20px;}

.results-hero{
  padding:20px;
  border-radius:20px;
  background:linear-gradient(135deg,#f8fbff 0%,#f3f7fc 56%,#eef7f2 100%);
}

.results-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.copy-feedback{
  color:#2f825c;
  font-size:.88rem;
  font-weight:700;
}

.legend-item,
.breakdown-card,
.metric-pill,
.mini-card{border-radius:18px;}

.seo-content{
  padding:32px 0 18px;
  background:#eef2f7;
}

.seo-content .container,
.faq-section .container{
  max-width:1080px;
}

.seo-article{
  max-width:980px;
  margin:0 auto;
  padding:24px 28px;
  border-radius:22px;
  background:#f8fbff;
  border:1px solid #dde6f2;
  color:#42516b;
  font-size:.95rem;
  line-height:1.75;
}

.seo-article h2,
.seo-article h3{
  color:#1a2d4e;
}

.seo-article ul{
  margin:0 0 16px 1.2rem;
}

.calculator-disclaimer{
  margin-top:24px;
  font-size:.92rem;
}

.faq-section{
  padding:18px 0 42px;
}

.faq-section .seo-article{
  background:transparent;
  border:none;
  padding:0;
}

.faq-item{
  margin-bottom:14px;
  border:1px solid #dde5f0;
  border-radius:18px;
  background:#fff;
  overflow:hidden;
  box-shadow:0 4px 14px rgba(10,25,56,.03);
}

.faq-question{
  width:100%;
  border:none;
  background:transparent;
  padding:20px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  color:#223653;
  font-size:1rem;
  font-weight:700;
  text-align:left;
  cursor:pointer;
}

.faq-answer p{
  margin:0;
  color:#50617c;
}

.check-option{
  min-height:52px;
  border-radius:14px;
}

@media print {
  .tool-card-inputs,
  .tool-hero,
  .seo-content,
  .faq-section,
  header,
  nav,
  footer,
  .site-header,
  .site-footer,
  .tool-actions,
  .results-actions {display:none !important;}
  .results-card{
    position:static;
    box-shadow:none;
    border:none;
    padding:0;
  }
  .tool-layout{display:block;}
}

@media (max-width: 780px){
  .tool-card,
  .seo-article{padding:20px;}
  .input-card-accent{display:none;}
  .faq-question{padding:18px;}
}

.info-chip{
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.table-scroll-x{
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}

.table-scroll-x table{
  min-width:720px;
}