:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #1e3a8a;
  --primary-light: #2563eb;
  --accent: #059669;
  --accent-bg: #ecfdf5;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.45rem;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
}

nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
}

nav a:hover, nav a.active {
  color: var(--primary-light);
}

/* AdSense Compliant Ad Slot */
.ad-container {
  background: var(--surface-alt);
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  margin: 24px 0;
  text-align: center;
  min-height: 95px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  margin-bottom: 4px;
}

/* Hero Section */
.hero {
  padding: 40px 0 24px;
  text-align: center;
}

.hero-pill {
  display: inline-block;
  background: #dbeafe;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 5px 14px;
  border-radius: 99px;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--text);
}

.hero p {
  max-width: 680px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1.08rem;
}

/* Main Grid & Cards */
.calc-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 28px;
  margin: 28px 0;
}

@media (max-width: 880px) {
  .calc-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.85rem; }
  nav { gap: 14px; font-size: 0.85rem; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form Elements */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

input[type="number"], select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  transition: border 0.2s;
}

input.has-prefix { padding-left: 28px; }

input:focus, select:focus {
  outline: none;
  border-color: var(--primary-light);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Results & Metrics */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-box {
  background: var(--surface-alt);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.kpi-box.highlight {
  background: var(--accent-bg);
  border-color: #a7f3d0;
}

.kpi-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
}

.kpi-box.highlight .kpi-value { color: var(--accent); }

.breakdown-list {
  list-style: none;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.breakdown-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.94rem;
  border-bottom: 1px solid #f1f5f9;
}

/* Unique Feature: Audit Risk Gauge */
.audit-box {
  margin-top: 20px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.meter-bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0;
}

.meter-fill {
  height: 100%;
  width: 30%;
  background: var(--accent);
  transition: width 0.35s ease, background 0.35s ease;
}

/* S-Corp Banner */
.scorp-box {
  margin-top: 16px;
  padding: 15px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 0.92rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.2s;
}

.btn:hover { background: var(--primary-light); }

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover { background: #eff6ff; }

/* Content & Guides Styling */
.article-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin: 28px 0;
}

.article-section h2 { font-size: 1.55rem; margin-bottom: 14px; color: var(--primary); }
.article-section h3 { font-size: 1.2rem; margin: 22px 0 10px; }
.article-section p { margin-bottom: 14px; color: #334155; }
.article-section ul { margin: 0 0 16px 22px; color: #334155; }
.article-section li { margin-bottom: 8px; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.92rem;
}

table.data-table th, table.data-table td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}

table.data-table th { background: var(--surface-alt); font-weight: 700; }

/* Footer */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 0 28px;
  margin-top: 50px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { text-decoration: none; color: var(--text-muted); }
.footer-links a:hover { color: var(--primary); }

.copyright {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}