:root {
  --ink: #14213d;
  --accent: #0b6e4f;
  --accent-dark: #095c42;
  --bg: #f7f8fa;
  --card: #ffffff;
  --line: #dfe3ea;
  --muted: #5b6577;
  --result-bg: #eef7f2;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
a { color: var(--accent-dark); }
header.site {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
header.site .wrap, main .wrap, footer.site .wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}
.logo { font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.logo span { color: var(--accent); }
nav.main a { margin-left: 18px; text-decoration: none; font-weight: 600; color: var(--muted); }
nav.main a:hover { color: var(--ink); }
main .wrap { padding-top: 24px; padding-bottom: 40px; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 8px 0 6px; }
h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.lede { color: var(--muted); font-size: 1.05rem; margin: 0 0 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label:first-child { margin-top: 0; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
input[type="time"], input[type="number"], select {
  width: 100%;
  font-size: 1.1rem;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  min-height: 52px;
}
input:focus, select:focus { outline: 3px solid rgba(11, 110, 79, 0.25); border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr; } }
.result {
  background: var(--result-bg);
  border: 1.5px solid var(--accent);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}
.result .big { font-size: 2rem; font-weight: 800; line-height: 1.15; }
.result .sub { color: var(--muted); }
table.breakdown { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.breakdown td, table.breakdown th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.breakdown td.num, table.breakdown th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.breakdown tr.total td { font-weight: 800; border-bottom: none; }
button.print, button.action {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 14px 22px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 52px;
  width: 100%;
}
button.print:hover, button.action:hover { background: var(--accent-dark); }
.toolgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .toolgrid { grid-template-columns: 1fr; } }
.toolcard {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
}
.toolcard:hover { border-color: var(--accent); }
.toolcard .t { font-weight: 800; font-size: 1.1rem; }
.toolcard .d { color: var(--muted); margin-top: 4px; }
.dayrow { display: grid; grid-template-columns: 64px 1fr 1fr 84px 74px; gap: 8px; align-items: end; margin-bottom: 10px; }
.dayrow .dayname { font-weight: 700; padding-bottom: 14px; }
.dayrow .daytotal { font-weight: 700; text-align: right; padding-bottom: 14px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .dayrow { grid-template-columns: 44px 1fr 1fr 70px; }
  .dayrow .daytotal { display: none; }
}
.small { font-size: 0.9rem; color: var(--muted); }
.disclaimer { font-size: 0.88rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: 28px; padding-top: 12px; }
footer.site { border-top: 1px solid var(--line); background: var(--card); }
footer.site .wrap { padding-top: 18px; padding-bottom: 26px; color: var(--muted); font-size: 0.92rem; }
footer.site a { margin-right: 16px; }
@media print {
  header.site, footer.site, .noprint, nav.main { display: none !important; }
  body { background: #fff; }
  .card, .result { border: none; padding: 0; }
}

/* Print: show only the result block */
@media print {
  body * { visibility: hidden; }
  .result, .result * { visibility: visible; }
  .result { position: absolute; left: 0; top: 0; width: 100%; background: #fff !important; }
  .no-print { display: none !important; }
}

/* Direction 1: answer always visible.
   Desktop: inputs and result side by side, result sticks while scrolling.
   Mobile: a slim result bar fixed to the bottom (built by result-viz.js). */
@media (min-width: 1024px) {
  .calc-split { display: grid; grid-template-columns: 1.12fr 0.88fr; gap: 22px; align-items: start; }
  .calc-split .result { position: sticky; top: 14px; margin-top: 0; }
}
#fwStickyBar {
  display: none;
}
@media (max-width: 900px) {
  #fwStickyBar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--ink); color: #fff; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    font-size: 0.95rem; cursor: pointer; box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
  }
  #fwStickyBar .fw-sb-value { font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
  #fwStickyBar.hidden { display: none; }
  body.fw-has-bar { padding-bottom: 58px; }
}
@media print { #fwStickyBar { display: none !important; } }
