:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1b1f1d;
  --muted: #5d6662;
  --line: #e2e0d8;
  --accent: #0f7b5f;
  --accent-ink: #ffffff;
  --accent-soft: #e3f2ec;
  --warn: #b5530f;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo svg { color: var(--accent); }
.site-head nav a { color: var(--muted); text-decoration: none; font-size: 14px; margin-left: 18px; }
.site-head nav a:hover { color: var(--ink); }

/* Hero */
.hero { padding-top: 32px; padding-bottom: 8px; }
.hero h1 { font-size: clamp(28px, 4.5vw, 42px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 680px; }

/* Layout */
.tool { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin: 24px 0 48px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* Settings */
.settings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; padding: 16px; border-bottom: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
input, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 22px; }

/* Table */
.sheet { width: 100%; border-collapse: collapse; }
.sheet th, .sheet td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.sheet thead th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: #fbfaf7; }
.sheet .day { font-weight: 600; white-space: nowrap; width: 150px; }
.sheet .day .date { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.sheet td input[type="number"] { max-width: 90px; }
.sheet .total { font-family: var(--mono); font-weight: 600; white-space: nowrap; text-align: right; }
.sheet .total small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.sheet tr.overnight .total::after { content: "overnight"; display: block; font: 600 10px var(--sans); color: var(--warn); text-transform: uppercase; letter-spacing: 0.05em; }
.week-head th { background: var(--accent-soft); color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.week-sub td { font-weight: 600; background: #fbfaf7; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
button {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
button:hover { border-color: var(--ink); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); }
button.ghost { margin-left: auto; color: var(--muted); }

/* Summary */
.summary { position: sticky; top: 16px; padding: 20px; }
.summary h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 6px; }
.big { font: 700 44px/1 var(--mono); letter-spacing: -0.03em; }
.big-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.kv { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv span:last-child { font-family: var(--mono); font-weight: 600; }
.summary .kv:first-of-type { margin-top: 16px; }
.pay { margin-top: 16px; background: var(--accent-soft); border-radius: 10px; padding: 14px; }
.pay .big { font-size: 32px; color: var(--accent); }
.pay .big-sub { font-size: 12px; }

.converter { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.converter h3 { font-size: 13px; margin: 0 0 8px; }
.converter .row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; }
.converter .row span { color: var(--muted); }

/* Content */
.content { max-width: 760px; padding-bottom: 48px; }
.content h2 { font-size: 26px; letter-spacing: -0.01em; margin: 40px 0 10px; line-height: 1.25; }
.content h3 { font-size: 18px; margin: 24px 0 6px; }
.content table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 15px; background: var(--surface); }
.content table th, .content table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.content table th { background: #fbfaf7; }
.content code { font-family: var(--mono); background: #eceae3; padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 8px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 8px 0 0; color: var(--muted); }

.site-foot { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: 14px; }
.foot-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.site-foot nav a { color: var(--muted); text-decoration: none; margin-right: 16px; }
.site-foot nav a:hover { color: var(--ink); text-decoration: underline; }

/* Ad slots: collapse to nothing until AdSense fills them, so no empty boxes before approval */
.ad-slot:empty, .ad-slot:not(:has(ins)) { display: none; }
.ad-slot { margin: 16px 0; text-align: center; }
.ad-wide { min-height: 100px; }
.ad-side { min-height: 250px; margin-top: 16px; }

/* Breadcrumbs */
.crumbs { font-size: 13px; color: var(--muted); padding-top: 16px; }
.crumbs a { color: var(--muted); }
.crumbs + .hero { padding-top: 8px; }

/* Single-purpose tools (converter, duration) */
.mini-wrap { margin: 24px auto 8px; }
.mini-tool { padding: 20px; max-width: 760px; }
.mini-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.mini-fields.three { grid-template-columns: repeat(3, 1fr); }
.mini-fields input { font-size: 18px; padding: 10px 12px; }
.mini-out { margin-top: 16px; background: var(--accent-soft); border-radius: 10px; padding: 16px; min-height: 92px; }
.mini-out .big { color: var(--accent); }
.mini-hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.warn { color: var(--warn); font-weight: 600; }

/* Related tools */
.related { margin-top: 40px; }
.related ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.related li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.related li a { font-weight: 600; text-decoration: none; display: block; }
.related li a:hover { text-decoration: underline; }
.related li span { font-size: 14px; color: var(--muted); }
.disclaimer { margin-top: 24px; color: var(--muted); font-size: 14px; }
@media (max-width: 640px) {
  .related ul, .mini-fields.three { grid-template-columns: 1fr; }
}

/* Static pages */
.page { padding-top: 32px; }
.page h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 8px; }
.page .updated, .muted { color: var(--muted); font-size: 14px; }
.contact-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 12px; margin: 20px 0; }
.contact-card h2 { margin-top: 16px; font-size: 20px; }

/* Responsive */
@media (max-width: 900px) {
  .tool { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .site-head nav { display: none; }
  .sheet thead { display: none; }
  .sheet, .sheet tbody { display: block; }
  .sheet tr[data-i] {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 60px; gap: 6px 6px;
    padding: 12px 16px; border-bottom: 1px solid var(--line);
  }
  .sheet tr[data-i] th, .sheet tr[data-i] td { border: 0; padding: 0; }
  .sheet tr[data-i] .day { grid-column: 1 / 3; width: auto; display: flex; gap: 8px; align-items: baseline; }
  .sheet tr[data-i] .day .date { display: inline; }
  .sheet tr[data-i] .total { grid-column: 3; grid-row: 1; }
  .sheet tr[data-i] .total small { display: none; }
  .sheet tr[data-i] td[data-label]:not(.total)::before {
    content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px;
  }
  .sheet td input[type="number"] { max-width: none; }
  .sheet td input { padding: 8px 6px; }
  .content table { font-size: 13px; display: block; overflow-x: auto; }
  .content table th, .content table td { padding: 4px 6px; }
  .week-head, .week-sub { display: block; }
  .week-head th, .week-sub td { display: block; }
  .week-sub td:last-child { text-align: left; padding-top: 0; }
  .big { font-size: 38px; }
}

/* Print: just the timesheet */
@media print {
  .site-head, .hero p, .actions, .settings, .converter, .content, .site-foot { display: none !important; }
  body { background: #fff; }
  .tool { display: block; margin: 0; }
  .card { border: 0; }
  input { border: 0; padding: 0; }
  .summary { position: static; padding: 16px 0; }
}

.made-by { flex-basis: 100%; margin: 4px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.made-by span { color: #e25555; }
.made-by a { color: var(--ink); font-weight: 600; text-decoration: none; }
.made-by a:hover { text-decoration: underline; }
