:root {
  --cream: #FAF7F2;
  --warm-white: #FFFDF9;
  --sand: #E8E0D0;
  --tan: #C9BCA8;
  --brown: #8B6F4E;
  --dark-brown: #4A3728;
  --charcoal: #2D2417;
  --accent: #2C5F8A;
  --accent-light: #E0EDF7;
  --accent-dark: #1A3F61;
  --green: #3A6B4A;
  --green-light: #DFF0E6;
  --blue: #185FA5;
  --blue-light: #D6E8F7;
  --gold: #C9921A;
  --gold-light: #FDF3DC;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(74,55,40,0.10);
  --shadow-md: 0 4px 28px rgba(74,55,40,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── HEADER ── */
.site-header {
  background: var(--warm-white);
  border-bottom: 1.5px solid var(--sand);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
  color: var(--dark-brown);
  text-decoration: none;
}
.logo span { color: #ffffff; }
.badge-live {
  background: var(--green-light);
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #b3d9bf;
}

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, #1A2E3F 0%, #2C5F8A 55%, #1e4060 100%);
  border-bottom: none;
  padding: 3.5rem 2rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 1rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.hero h1 em { color: #7EC8E3; font-style: italic; }
.hero-sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.75);
  max-width: 560px;
  margin: 0 auto 1.75rem;
  font-weight: 300;
}
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.pill {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 5px;
}
.pill svg { width: 14px; height: 14px; color: #7EC8E3; flex-shrink: 0; }

/* ── MAIN LAYOUT ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  padding: 2rem 0 3rem;
  align-items: start;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

/* ── CARDS ── */
.card {
  background: var(--warm-white);
  border: 1.5px solid var(--sand);
  border-radius: var(--radius);
  overflow: hidden;
}
/* Projection chart card must not clip the SVG bars */
.projection-card { overflow: visible !important; }
.projection-card .card-header { border-radius: var(--radius) var(--radius) 0 0; }
#projection-chart { overflow: visible; }
.card-header {
  background: var(--charcoal);
  color: #fff;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header svg { width: 20px; height: 20px; opacity: 0.85; flex-shrink: 0; }
.card-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff !important;
  opacity: 1 !important;
}
#ptc-calculator-wrap .card-header h2,
#ptc-calculator-wrap .card-header h2 a,
#ptc-calculator-wrap .card-header * {
  color: #ffffff !important;
  text-decoration: none !important;
}
.card-body { padding: 1.5rem; }

/* ── TABS ── */
.tab-nav {
  display: flex;
  border-bottom: 1.5px solid var(--sand);
  background: var(--cream);
}
.tab-btn {
  padding: 0.7rem 1.25rem;
  font-size: 13px;
  font-weight: 500;
  color: #5a4030 !important;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn.active {
  color: #ffffff;
  border-bottom-color: var(--accent);
  background: var(--warm-white);
}
.tab-btn:hover:not(.active) { color: var(--dark-brown); background: var(--sand); }
.tab-pane { display: none; padding: 1.5rem; }
.tab-pane.active { display: block; }

/* ── FORM ELEMENTS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brown);
}
.input-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--tan);
  pointer-events: none;
}
input[type="number"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--charcoal);
  background: var(--cream);
  appearance: none;
  transition: border-color 0.2s;
}
.input-wrap input { padding-left: 22px; }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--warm-white);
}
.help-text { font-size: 11px; color: var(--tan); margin-top: 2px; }

/* ── TOOLTIP ── */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.tooltip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px;
  background: var(--tan); color: #fff;
  border-radius: 50%; font-size: 9px; font-weight: 700;
  cursor: help; flex-shrink: 0;
  transition: background 0.2s;
}
.tooltip-icon:hover { background: var(--accent); }
.tooltip-bubble {
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--charcoal); color: #fff;
  font-size: 11px; font-weight: 400; line-height: 1.5;
  padding: 7px 10px; border-radius: 6px;
  width: 220px; text-align: left;
  pointer-events: none; opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
  white-space: normal;
  text-transform: none; letter-spacing: 0;
}
.tooltip-bubble::after {
  content: '';
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--charcoal);
}
.tooltip-wrap:hover .tooltip-bubble,
.tooltip-wrap:focus-within .tooltip-bubble { opacity: 1; }

/* ── EXEMPTIONS SECTION ── */
.exemption-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 0.75rem; }
.exemption-card {
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.exemption-card:hover { border-color: var(--accent); background: var(--accent-light); }
.exemption-card.selected { border-color: var(--accent); background: var(--accent-light); }
.exemption-card input[type="checkbox"] { display: none; }
.exemption-title { font-size: 13px; font-weight: 600; color: var(--dark-brown); }
.exemption-desc { font-size: 11px; color: var(--brown); margin-top: 2px; }
.exemption-check {
  position: absolute; top: 8px; right: 8px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--tan);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.exemption-card.selected .exemption-check {
  background: var(--accent);
  border-color: var(--accent);
}
.exemption-check svg { width: 9px; height: 9px; color: #fff; display: none; }
.exemption-card.selected .exemption-check svg { display: block; }

/* ── CALC BUTTON ── */
.calc-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.25rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.02em;
}
.calc-btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.calc-btn:active { transform: translateY(0); }
.calc-btn svg { width: 18px; height: 18px; }

/* ── RESULTS ── */
#results-section { display: none; }
#results-section.visible { display: block; margin-top: 1.75rem; }

.results-hero {
  background: var(--charcoal);
  border-radius: var(--radius);
  padding: 1.75rem;
  color: #fff;
  text-align: center;
  margin-bottom: 1.25rem;
}
.results-state-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}
.results-annual {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.results-annual-label { font-size: 13px; opacity: 0.7; margin-bottom: 1.25rem; }

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.metric-box {
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.metric-box-label { font-size: 10px; opacity: 0.65; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 3px; }
.metric-box-val { font-size: 1.2rem; font-weight: 600; }

/* ── BREAKDOWN TABLE ── */
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.breakdown-table tr { border-bottom: 1px solid var(--sand); }
.breakdown-table tr:last-child { border-bottom: none; font-weight: 600; }
.breakdown-table td { padding: 9px 0; }
.breakdown-table td:last-child { text-align: right; }
.breakdown-table .muted { color: var(--brown); }
.breakdown-table .accent-val { color: #ffffff; font-weight: 600; }

/* ── PROGRESS BAR ── */
.progress-wrap { margin: 1rem 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--brown); margin-bottom: 5px; }
.progress-bg { background: var(--sand); border-radius: 4px; height: 8px; overflow: hidden; }
.progress-fill { height: 8px; border-radius: 4px; background: var(--accent); transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.progress-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--tan); margin-top: 3px; }

/* ── PROJECTION CHART ── */
.projection-bars { display: flex; align-items: flex-end; gap: 4px; height: 200px; margin: 1rem 0 0.5rem; }
.proj-bar {
  flex: 1;
  background: var(--sand);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  cursor: default;
  align-self: flex-end;
  transition: background 0.2s;
}
.proj-bar:hover { background: var(--accent-light); }
.proj-bar-fill {
  display: none;
}
.proj-bar-label { font-size: 9px; color: var(--tan); text-align: center; margin-top: 3px; }

/* ── COMPARISON SIDEBAR ── */
.compare-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--sand);
}
.compare-item:last-child { border-bottom: none; }
.compare-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--brown);
  flex-shrink: 0;
}
.compare-rank.highlight { background: var(--accent); color: #fff; }
.compare-state-name { font-size: 13px; font-weight: 500; flex: 1; }
.compare-state-name small { display: block; font-size: 11px; font-weight: 400; color: var(--brown); }
.compare-bar-wrap { width: 80px; }
.compare-bar-bg { background: var(--sand); border-radius: 3px; height: 6px; }
.compare-bar-fill { height: 6px; border-radius: 3px; background: var(--accent); }
.compare-amount { font-size: 12px; font-weight: 600; color: var(--dark-brown); text-align: right; min-width: 60px; }

/* ── ESCROW TABLE ── */
.escrow-box {
  background: var(--blue-light);
  border: 1px solid #b3cee0;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.escrow-box-title { font-size: 12px; font-weight: 600; color: var(--blue); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.5rem; }
.escrow-total { font-size: 1.75rem; font-weight: 700; color: var(--blue); }
.escrow-sub { font-size: 13px; color: var(--brown); margin-top: 2px; }

/* ── APPEAL SECTION ── */
.appeal-step {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--sand);
}
.appeal-step:last-child { border-bottom: none; }
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 2px solid var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-title { font-size: 13px; font-weight: 600; color: var(--dark-brown); margin-bottom: 2px; }
.step-desc { font-size: 12px; color: var(--brown); line-height: 1.5; }

/* ── FAQ SECTION ── */
.faq-section { padding: 3rem 1.25rem; border-top: 1.5px solid var(--sand); margin-top: 1rem; max-width: 820px; margin-left: auto; margin-right: auto; }
.faq-section h2 { font-family: 'DM Serif Display', serif; font-size: 1.8rem; color: var(--charcoal); margin-bottom: 1.5rem; }
.faq-item { border: 1.5px solid var(--sand); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--warm-white); overflow: hidden; }
.faq-question {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--dark-brown);
}
.faq-question svg { width: 16px; height: 16px; color: var(--tan); transition: transform 0.3s; flex-shrink: 0; }
.faq-item.open .faq-question svg { transform: rotate(180deg); }
.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  font-size: 14px;
  color: var(--brown);
  line-height: 1.7;
}
.faq-item.open .faq-answer { display: block; }

/* ── STATE TABLE SECTION ── */
.state-table-section { padding: 2rem 0; }
.state-table-section h2 { font-family: 'DM Serif Display', serif; font-size: 1.6rem; color: var(--charcoal); margin-bottom: 0.5rem; }
.state-table-section p { font-size: 14px; color: var(--brown); margin-bottom: 1.25rem; }
.table-scroll { overflow-x: auto; border-radius: var(--radius); border: 1.5px solid var(--sand); }
table.state-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--warm-white); }
.state-table thead { background: var(--charcoal); color: #fff; }
.state-table th { padding: 11px 14px; text-align: left; font-size: 11px; letter-spacing: 0.07em; font-weight: 600; white-space: nowrap; }
.state-table td { padding: 9px 14px; border-bottom: 1px solid var(--sand); }
.state-table tr:last-child td { border-bottom: none; }
.state-table tr:hover td { background: var(--cream); }
.state-table .rank-col { font-weight: 700; color: var(--tan); text-align: center; }
.state-table .rate-col { font-weight: 600; color: var(--dark-brown); }
.rate-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.rate-high { background: #fde8e3; color: #9b2c10; }
.rate-med { background: #fef3db; color: #7a5010; }
.rate-low { background: #dff0e6; color: #1e5c35; }

/* ── PDF BUTTON ── */
.pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--dark-brown);
  background: var(--warm-white);
  cursor: pointer;
  transition: all 0.2s;
}
.pdf-btn:hover { border-color: var(--accent); color: #ffffff; }
.pdf-btn svg { width: 16px; height: 16px; }

/* ── INFO BOX ── */
.info-box {
  background: var(--gold-light);
  border: 1px solid #e8cc8a;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 13px;
  color: #5c3e08;
  line-height: 1.6;
  margin-top: 1rem;
}
.info-box strong { display: block; margin-bottom: 3px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── FOOTER ── */
.site-footer {
  background: var(--charcoal);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 2rem 1.25rem;
  font-size: 12px;
  line-height: 1.8;
}
.site-footer a { color: rgba(255,255,255,0.5); text-decoration: none; }
.site-footer a:hover { color: #fff; }

/* ── ACCORDION PANELS ── */
.accordion-wrap { margin-top: 1.75rem; display: flex; flex-direction: column; gap: 10px; }
.accordion-panel {
  background: var(--warm-white);
  border: 1.5px solid var(--sand);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.accordion-panel.open { box-shadow: var(--shadow-md); border-color: var(--tan); }
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.1rem 1.5rem;
  background: var(--brown);
  border: none;
  cursor: pointer;
  text-align: left;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
}
.accordion-trigger:hover { background: var(--dark-brown); }
.accordion-trigger .trigger-icon { width: 20px; height: 20px; opacity: 0.85; flex-shrink: 0; }
.accordion-trigger h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  font-weight: 400;
  flex: 1;
  color: #fff;
}
.accordion-trigger .trigger-badge {
  font-size: 11px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 2px 10px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.accordion-trigger .chevron {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  opacity: 0.7;
}
.accordion-panel.open .chevron { transform: rotate(180deg); }
.accordion-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.4,0,0.2,1);
}
.accordion-panel.open .accordion-body { grid-template-rows: 1fr; }
.accordion-inner { overflow: hidden; }
.accordion-content { padding: 1.5rem; }


@media print {
  .site-header, .hero-pills, .calc-btn, .tab-nav, .pdf-btn, .faq-section, .state-table-section, .site-footer { display: none !important; }
  #results-section.visible { display: block !important; }
  body { background: #fff; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeUp 0.4s ease forwards; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .card-body, .tab-pane { padding: 1rem; }
  .hero { padding: 2rem 1rem 1.75rem; }
  .metric-row { grid-template-columns: 1fr 1fr; }
  .metric-row .metric-box:last-child { display: none; }
}
