:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b6270;
  --border: #dde1e8;
  --accent: #1d4ed8;
  --accent-text: #ffffff;
  --accent-soft: #e8eefc;
  --warn: #b45309;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b21;
    --text: #e8eaee;
    --muted: #9aa2b1;
    --border: #2c313b;
    --accent: #6d9bff;
    --accent-text: #0b1020;
    --accent-soft: #1c2640;
    --warn: #f0a04b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-size: .875rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header and footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.brand-icon { width: 30px; height: 30px; flex: none; }
.brand-accent { color: var(--accent); }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-header nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.site-header nav a[aria-current="page"], .site-header nav a:hover { color: var(--accent); }
.site-footer { margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }

/* Page content */
main { padding-top: 16px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.2; margin: 8px 0 8px; }
h2 { font-size: 1.25rem; margin: 32px 0 8px; }
.lead { color: var(--muted); font-size: 1.05rem; margin-top: 0; }
.breadcrumb { font-size: .875rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.content, .faq, .related, .template-cta { max-width: 720px; }
.faq details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; }

.tool-cards { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tool-cards a {
  display: block; height: 100%; padding: 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.tool-cards a:hover { border-color: var(--accent); }
.tool-cards span { display: block; margin-top: 4px; color: var(--muted); font-size: .9rem; }

/* Calculator card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.card h2 { margin-top: 0; font-size: 1.05rem; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
input, select, button { font: inherit; }
input, select {
  width: 100%; min-height: 40px; padding: 6px 8px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input:disabled { opacity: .5; }

.settings { border: 0; padding: 0; margin: 0 0 16px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.settings legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.two-col { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.result { font-size: 1.1rem; margin: 16px 0 0; }
.result output { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Time card table */
.timecard-table { width: 100%; border-collapse: collapse; }
.timecard-table th, .timecard-table td { padding: 6px 4px; text-align: left; vertical-align: middle; }
.timecard-table thead th { font-size: .8rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.timecard-table tbody tr + tr { border-top: 1px solid var(--border); }
.timecard-table tbody th { font-weight: 600; white-space: nowrap; }
.timecard-table input[name^="break"] { max-width: 7rem; }
.day-result { white-space: nowrap; font-variant-numeric: tabular-nums; }
.day-result .warn, .day-result output.warn { color: var(--warn); }

@media (max-width: 640px) {
  .timecard-table thead { display: none; }
  .timecard-table tbody tr { display: grid; grid-template-columns: 1fr 1fr 5.5rem; gap: 6px; padding: 10px 0; }
  .timecard-table tbody th { grid-column: 1 / 2; padding: 0; }
  .timecard-table td.day-result { grid-column: 2 / 4; grid-row: 1; text-align: right; padding: 0; }
  .timecard-table td { padding: 0; }
}

/* Totals */
.summary { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 16px; }
.summary > div { background: var(--accent-soft); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; }
.summary span { font-size: .8rem; color: var(--muted); }
.summary output { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary small { color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.2em; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
button {
  min-height: 40px; padding: 8px 14px; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent); font-weight: 600;
}
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.status { color: var(--muted); font-size: .9rem; }

/* Chart */
.chart { border-collapse: collapse; width: 100%; max-width: 520px; font-variant-numeric: tabular-nums; }
.chart th, .chart td { border: 1px solid var(--border); padding: 4px 6px; text-align: right; font-size: .9rem; }
.chart td:nth-child(odd) { color: var(--muted); }

/* Print only the time card itself */
@media print {
  .site-header, .site-footer, .breadcrumb, .lead, .content, .faq, .related, .template-cta, .actions, .settings select, .sr-only { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; padding: 0; }
  input, select { border: 0; background: transparent; padding: 0; min-height: 0; }
  .summary > div { background: #fff; border: 1px solid #999; }
}

.template-cta { margin: 32px 0; padding: 18px 20px; background: var(--accent-soft); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); }
.template-cta h2 { margin: 0 0 8px; font-size: 1.15rem; }
.template-cta p { margin: 0 0 10px; }
.template-cta p:last-child { margin-bottom: 0; }
.template-cta-btn { display: inline-block; padding: 9px 16px; background: var(--accent); color: var(--accent-text); border-radius: 8px; font-weight: 600; text-decoration: none; margin-right: 8px; }
.template-cta-btn:hover { filter: brightness(1.08); }

/* ---------- Comparison page ---------- */
.disclosure { max-width: 720px; }
.quick-picks li { margin: 4px 0; }
.table-scroll { overflow-x: auto; margin: 16px 0; }
.compare { border-collapse: collapse; width: 100%; min-width: 640px; font-size: .95rem; }
.compare.compact { min-width: 0; max-width: 720px; }
.compare th, .compare td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.compare thead th { background: var(--accent-soft); font-size: .85rem; }
.compare tbody th { white-space: nowrap; }
.app-review h3 { font-size: 1rem; margin: 8px 0 4px; }
.pros-cons { display: grid; gap: 0 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.pros-cons ul { margin: 0; padding-left: 1.2em; }
.app-btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--accent); color: var(--accent); border-radius: 8px; font-weight: 600; text-decoration: none; }
.app-btn:hover { background: var(--accent-soft); }
