/* Free tool pages. Builds on landing.css and blog.css. No inline styles (strict CSP). */
.tool-page { padding: 2rem 0 var(--section-y); }
.tool-page > .container { max-width: 52rem; }
.tool-page h1 { font-size: clamp(2rem, 1.5rem + 2.4vw, 2.75rem); margin-bottom: 0.75rem; }
.tool-page .lead { font-size: 1.125rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.tool { padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-soft); box-shadow: var(--shadow); }
.tool-h { font-size: 1.1875rem; margin: 1.5rem 0 0.5rem; }
.tool .tiny { margin-bottom: 0.75rem; }

.field-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.875rem; margin: 0 0 0.5rem; }
@media (min-width: 640px) { .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.875rem; min-width: 0; }
.field-grid .field { margin-top: 0; }
.field-label { font-weight: 600; font-size: 0.9375rem; }
.field-hint { color: var(--text-muted); font-size: 0.8125rem; }
.tool input[type="text"], .tool input[type="date"], .tool select, .tool textarea {
  width: 100%; min-height: 44px; padding: 0.5rem 0.625rem; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg); border: 1px solid #b9cbbf; border-radius: 0.5rem;
}
.tool textarea { min-height: 4.25rem; resize: vertical; }
.tool input:focus, .tool select:focus, .tool textarea:focus { outline: 3px solid var(--green-600); outline-offset: 0; border-color: var(--green-600); }
.tool [aria-invalid] { border-color: #b45309; background: var(--flag-bg); }
.tool input[type="checkbox"], .tool input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--green-600); }
.choice { border: 0; padding: 0; margin: 0 0 0.875rem; display: flex; flex-direction: column; gap: 0.25rem; }
.choice label { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; }

/* Row tables: scroll sideways on phones instead of squeezing the inputs. */
.tool .table-wrap { position: relative; margin: 0 0 0.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
table.rows, table.grid { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
table.rows { min-width: 34rem; }
.tool-receipt-tracker-template table.rows { min-width: 62rem; }
.tool-mileage-reimbursement-calculator table.rows { min-width: 48rem; }
table.rows th, table.grid th { text-align: left; font-weight: 600; padding: 0.5rem; background: var(--bg-soft); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.rows td, table.grid td { padding: 0.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.rows td input[type="date"] { min-width: 9.5rem; }
table.rows td.center { text-align: center; }
table.rows tr.flag td { background: var(--flag-bg); }
table.grid input { min-width: 5.5rem; text-align: right; }
table.grid tbody th { white-space: nowrap; }
table.grid tr.miles th { color: var(--text-muted); }
table.grid .num { text-align: right; white-space: nowrap; padding: 0.5rem; font-variant-numeric: tabular-nums; font-weight: 600; }
table.grid tfoot th, table.grid tfoot td { border-top: 2px solid var(--border); background: var(--bg-soft); }
.row-remove { width: 2.75rem; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; font-size: 1.375rem; line-height: 1; color: var(--text-muted); background: transparent; border: 1px solid transparent; border-radius: 0.5rem; cursor: pointer; }
.icon-button:hover { color: #b91c1c; background: #fef2f2; }
.icon-button:disabled { opacity: 0.35; cursor: not-allowed; }
.tool .button.small { min-height: 44px; padding: 0.375rem 1rem; font-size: 0.9375rem; margin-bottom: 1rem; }

/* Results: the "aha" moment, right above the call to action. */
.tool-result { position: relative; margin: 1.25rem 0 0; overflow-x: auto; }
.summary { width: 100%; border-collapse: collapse; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.summary th, .summary td { padding: 0.5rem 0.625rem; border-bottom: 1px solid var(--border); text-align: left; }
.summary td { text-align: right; white-space: nowrap; }
.summary thead th { background: var(--bg-soft); font-size: 0.875rem; }
.summary thead th:not(:first-child) { text-align: right; }
.summary tr.total th, .summary tr.total td { font-weight: 600; }
.summary tr.grand th, .summary tr.grand td { font-family: var(--head); font-size: 1.125rem; color: var(--green-700); border-bottom: 0; background: var(--green-50); }
.summary tr.grand td { font-size: 1.375rem; }
@media (min-width: 640px) { .summary tr.grand th { font-size: 1.375rem; } }
.summary.days { margin-bottom: 0.75rem; border: 0; }
.summary tfoot th, .summary tfoot td { font-weight: 600; background: var(--bg-soft); }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0 0.5rem; border-radius: 999px; background: var(--flag-bg); color: var(--flag-text); }
.formula { margin-top: 0.75rem; font-family: var(--mono); font-size: 0.9375rem; color: var(--text-muted); overflow-wrap: anywhere; }
.warn { margin-top: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--radius); background: var(--flag-bg); color: var(--flag-text); }
.ok { margin-top: 0.75rem; color: var(--green-700); font-weight: 600; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 1.25rem; }
.tool-actions .button { flex: 1 1 12rem; }

/* Bill splitter */
.people { display: grid; gap: 0.5rem; margin-bottom: 0.625rem; }
@media (min-width: 640px) { .people { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.person { display: flex; gap: 0.25rem; }
.items { display: grid; gap: 0.625rem; margin-bottom: 0.625rem; }
.item { padding: 0.625rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.item-top { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem 44px; gap: 0.375rem; }
.who { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-top: 0.25rem; }
.who label { display: inline-flex; align-items: center; gap: 0.375rem; min-height: 44px; }

/* Receipt preview, also what gets printed. */
.receipt-preview { padding: 1.5rem; background: #fff; color: #111; border: 1px solid var(--border); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.rp-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 2px solid #111; }
.rp-biz { font-family: var(--head); font-weight: 700; font-size: 1.375rem; }
.rp-title { font-family: var(--head); font-weight: 700; font-size: 1.375rem; text-transform: uppercase; letter-spacing: 0.08em; }
.rp-meta { text-align: right; }
.rp-small { font-size: 0.875rem; color: #444; }
.rp-to { margin: 1rem 0; }
.rp-lines, .rp-totals { width: 100%; border-collapse: collapse; }
.rp-lines th, .rp-lines td { padding: 0.5rem 0.375rem; border-bottom: 1px solid #ddd; text-align: right; }
.rp-lines th:first-child, .rp-lines td:first-child { text-align: left; }
.rp-totals { margin-top: 0.5rem; max-width: 18rem; margin-left: auto; }
.rp-totals th, .rp-totals td { padding: 0.25rem 0.375rem; text-align: right; }
.rp-totals tr.grand th, .rp-totals tr.grand td { font-weight: 700; font-size: 1.125rem; border-top: 2px solid #111; }
.rp-paid { margin: 1rem 0 0.5rem; font-weight: 600; }

/* Call to action right after the result */
.tool-cta { margin: 1.5rem 0 2.5rem; padding: 1.25rem 1.5rem; border: 2px solid var(--green-600); border-radius: var(--radius-lg); background: var(--green-50); }
.tool-cta h2 { font-size: 1.375rem; margin-bottom: 0.375rem; }
.tool-cta p { margin-bottom: 1rem; }
.tool-cta .actions { flex-direction: row; flex-wrap: wrap; }

/* Tool cards on the hub and in "Related tools" */
.tool-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .tool-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tool-list a { display: block; height: 100%; padding: 1rem 1.125rem; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); background: var(--bg); }
.tool-list a:hover { border-color: var(--green-600); background: var(--green-50); color: var(--text); }
.tool-list .card-title { display: block; font-family: var(--head); font-weight: 700; font-size: 1.125rem; line-height: 1.25; margin-bottom: 0.25rem; }
.tool-list .card-desc { display: block; color: var(--text-muted); font-size: 0.9375rem; }
.hub-group { margin-top: 2rem; }
.hub-group h2 { font-size: 1.375rem; margin-bottom: 0.75rem; }

@media print {
  body:has(.print-area) header.site, body:has(.print-area) footer.site { display: none; }
  body:has(.print-area) .tool-page > .container > :not(.tool), body:has(.print-area) .tool > :not(.print-area) { display: none; }
  body:has(.print-area) .tool-page { padding: 0; }
  body:has(.print-area) .tool, body:has(.print-area) .print-area { padding: 0; border: 0; box-shadow: none; background: #fff; }
}
