:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --charcoal: #1e293b;
  --charcoal-dark: #0f172a;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft: #eff6ff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --success: #059669;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Compact Header so Tool Sits Above the Fold */
header {
  background: var(--charcoal-dark);
  color: #fff;
  padding: 0.65rem 1rem;
  border-bottom: 3px solid var(--blue);
}
.nav-wrap {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand span { color: #60a5fa; }
nav { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.88rem; }
nav a { color: #cbd5e1; text-decoration: none; font-weight: 500; }
nav a:hover, nav a.active { color: #fff; text-decoration: underline; }

.container { max-width: 1040px; margin: 0 auto; padding: 0.75rem 1rem 2.5rem; }

/* Dedicated Ad Slots (Non-intrusive, fixed spacing) */
.ad-slot {
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.65rem 0;
}

/* Tool Card - Immediately Visible Without Scrolling */
.tool-header { margin-bottom: 0.6rem; }
.tool-header h1 { font-size: 1.45rem; color: var(--charcoal-dark); line-height: 1.2; }
.tool-header p { font-size: 0.92rem; color: var(--muted); }

.tool-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0.85rem; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--charcoal); margin-bottom: 0.25rem; }
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: transparent; }

/* Line Items Table */
.items-table { width: 100%; border-collapse: collapse; margin: 0.85rem 0; }
.items-table th {
  text-align: left;
  font-size: 0.78rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.items-table td { padding: 0.35rem 0.25rem 0.35rem 0; vertical-align: middle; }
.items-table td:last-child { padding-right: 0; text-align: right; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-secondary { background: #e2e8f0; color: var(--charcoal-dark); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #fee2e2; color: #b91c1c; padding: 0.4rem 0.65rem; font-size: 0.82rem; }

.actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  align-items: center;
  justify-content: space-between;
}

.totals-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  max-width: 320px;
  margin-left: auto;
}
.total-row { display: flex; justify-content: space-between; font-size: 0.92rem; margin-bottom: 0.35rem; }
.total-row.grand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--charcoal-dark);
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
  margin-bottom: 0;
}

/* Monetization & "What I Use" Cards Below Result */
.promo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin: 1rem 0;
}
@media (min-width: 720px) { .promo-grid { grid-template-columns: 1.1fr 1fr; } }

.my-product-card {
  background: var(--blue-soft);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 1rem;
}
.my-product-card .badge {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.my-product-card h3 { font-size: 1.05rem; margin-bottom: 0.3rem; color: var(--charcoal-dark); }
.my-product-card p { font-size: 0.88rem; color: var(--charcoal); margin-bottom: 0.75rem; }

.what-i-use-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.what-i-use-card h3 { font-size: 0.98rem; margin-bottom: 0.5rem; color: var(--charcoal-dark); }
.rec-list { list-style: none; }
.rec-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}
.rec-list li:last-child { border-bottom: none; padding-bottom: 0; }
.rec-list a { color: var(--blue); font-weight: 600; text-decoration: none; }
.rec-list a:hover { text-decoration: underline; }

/* Content Sections Below Tool */
.content-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 1rem;
}
.content-section h2 { font-size: 1.2rem; color: var(--charcoal-dark); margin-bottom: 0.65rem; }
.content-section h3 { font-size: 1rem; color: var(--charcoal-dark); margin: 0.85rem 0 0.25rem; }
.content-section p, .content-section li { font-size: 0.94rem; color: var(--charcoal); margin-bottom: 0.5rem; }
.content-section ul, .content-section ol { padding-left: 1.25rem; }

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.tool-link-card {
  display: block;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  background: var(--bg);
}
.tool-link-card:hover { border-color: var(--blue); background: var(--blue-soft); }
.tool-link-card strong { display: block; color: var(--charcoal-dark); font-size: 0.98rem; margin-bottom: 0.2rem; }
.tool-link-card span { font-size: 0.83rem; color: var(--muted); }

footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
footer a { color: var(--charcoal); margin: 0 0.5rem; }

/* Clean Print / PDF Output */
@media print {
  header, .ad-slot, .promo-grid, .content-section, footer, .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; padding: 0; }
  .tool-box { border: none; box-shadow: none; padding: 0; }
  input, textarea, select { border: none !important; padding: 0 !important; background: transparent !important; appearance: none; }
}