/* Reset and base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #1e2d35;
  --text-muted: #5c6b73;
  --accent: #c9a84c;
  --accent-dark: #a88a3a;
  --border: #d9d3c7;
  --border-light: #ece7dc;
  --danger: #b33a3a;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--accent-dark); color: #fff; padding: 8px 16px;
  border-radius: var(--radius); z-index: 1000;
}
.skip-link:focus { top: 16px; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; gap: 16px; flex-wrap: wrap;
}
.site-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem;
}
.logo-accent { color: var(--accent-dark); }
.site-nav ul { display: flex; list-style: none; gap: 20px; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; color: var(--text-muted); font-size: 0.9rem;
  padding: 4px 0; border-bottom: 2px solid transparent; transition: border-color 0.2s;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  border-bottom-color: var(--accent); color: var(--text);
}

/* Main */
main { flex: 1; }

/* Worksheet section */
.worksheet-section {
  max-width: 1200px; margin: 0 auto; padding: 32px 24px 48px;
}
.worksheet-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  align-items: start;
}

.worksheet-inputs h1 {
  font-size: 1.8rem; margin-bottom: 6px; color: var(--text);
}
.worksheet-subtitle {
  color: var(--text-muted); margin-bottom: 24px; font-size: 0.95rem;
}

/* Preset bar */
.preset-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 24px;
  flex-wrap: wrap;
}
.preset-bar label { font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.preset-bar select {
  flex: 1; min-width: 200px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.9rem; background: var(--bg);
}

/* Fieldsets */
fieldset {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 20px; background: var(--surface);
}
legend {
  font-weight: 700; font-size: 0.95rem; padding: 0 8px;
}
.input-row {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px;
}
.input-row label { font-size: 0.85rem; color: var(--text-muted); }
.input-row input, .input-row select {
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.95rem;
  background: var(--bg); width: 100%;
}
.input-row input:focus, .input-row select:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}

/* Exempt checkboxes */
.checkbox-row {
  display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px;
}
.checkbox-row label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--accent-dark);
}
.exempt-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Profile row */
.profile-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px;
  margin-bottom: 20px;
}

/* Sliders */
.slider-row { margin-bottom: 16px; }
.slider-row label { font-size: 0.9rem; font-weight: 600; display: block; margin-bottom: 4px; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--accent-dark); }
.slider-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); }

/* Buttons */
.button-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px;
}
button {
  padding: 10px 20px; border: none; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  background: var(--accent-dark); color: #fff;
  transition: background 0.2s, transform 0.1s;
}
button:hover { background: #8c722e; }
button:active { transform: scale(0.97); }
button.secondary-btn {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
button.secondary-btn:hover { background: var(--border-light); }

/* Results panel */
.worksheet-results { position: sticky; top: 80px; }
.results-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-md); margin-bottom: 20px;
}
.results-card h2 { font-size: 1rem; color: var(--text-muted); margin-bottom: 8px; }
.result-big {
  font-size: 2.8rem; font-weight: 800; color: var(--accent-dark);
  margin-bottom: 16px; letter-spacing: -0.5px;
}
.result-details { display: flex; flex-direction: column; gap: 8px; }
.detail-row {
  display: flex; justify-content: space-between;
  font-size: 0.85rem; padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}
.detail-row.emphasis { font-weight: 700; border-bottom: none; font-size: 0.9rem; }
.result-empty {
  margin-top: 12px; padding: 12px; background: #f7f3e8;
  border-radius: var(--radius); font-size: 0.85rem; color: var(--text-muted);
}

/* Comparison card */
.comparison-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.comparison-card h3 { font-size: 0.95rem; margin-bottom: 12px; }
.comparison-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.comparison-item {
  border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 12px; font-size: 0.82rem;
}
.comparison-item .comp-tax { font-weight: 800; color: var(--accent-dark); font-size: 1.1rem; }

/* Info sections */
.info-section, .tips-section, .walkthrough-section, .faq-section {
  border-top: 1px solid var(--border);
}
.info-inner {
  max-width: 900px; margin: 0 auto; padding: 48px 24px;
}
.info-inner h2 { font-size: 1.4rem; margin-bottom: 24px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.info-card h3 { font-size: 1rem; margin-bottom: 8px; }
.info-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

/* Tips list */
.tips-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.tips-list li {
  padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.9rem; line-height: 1.6;
}
.tips-list li strong { color: var(--accent-dark); }

/* Walkthrough */
.walkthrough-section p { font-size: 0.95rem; line-height: 1.7; margin-bottom: 14px; color: var(--text-muted); }

/* FAQ */
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 10px; background: var(--surface);
}
.faq-item summary {
  padding: 14px 18px; font-weight: 600; cursor: pointer;
  font-size: 0.95rem; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { padding: 0 18px 14px; font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

/* Footer */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 24px; text-align: center; margin-top: auto;
}
.footer-inner { max-width: 900px; margin: 0 auto; }
.footer-inner p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.footer-version { display: block; font-size: 0.75rem; }
.footer-nav { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.footer-nav a { font-size: 0.8rem; color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--accent-dark); text-decoration: underline; }

/* Responsive */
@media (max-width: 900px) {
  .worksheet-layout { grid-template-columns: 1fr; gap: 32px; }
  .worksheet-results { position: static; }
  .profile-row { grid-template-columns: 1fr 1fr; }
  .result-big { font-size: 2.2rem; }
}
@media (max-width: 560px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .site-nav ul { gap: 12px; }
  .profile-row { grid-template-columns: 1fr; }
  .button-row { flex-direction: column; }
  .button-row button { width: 100%; }
  .info-grid { grid-template-columns: 1fr; }
  .worksheet-section { padding: 20px 12px 32px; }
  .info-inner { padding: 32px 12px; }
  h1 { font-size: 1.4rem; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
