/* Holdfast Invoice — jobsite tool, phone-first, sunlight-readable */
:root {
  --asphalt: #1c1814;
  --dirt: #2a241c;
  --plank: #3a3228;
  --orange: #e85d04;
  --orange-dk: #c44d03;
  --hi-vis: #d6e600;
  --cream: #f4efe6;
  --cream-dim: #cfc6b8;
  --paper: #fffdf8;
  --ink: #1a1510;
  --ink-soft: #4a4036;
  --line: #d8d0c4;
  --danger: #c0392b;
  --ok: #2d6a4f;
  --pad: 16px;
  --tap: 52px;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; max-width: 100%; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--asphalt);
  color: var(--cream);
  font-family: var(--font);
  line-height: 1.45;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--hi-vis); }
a:hover { color: #f4ff66; }

.wrap {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: var(--pad);
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
  padding-bottom: 96px;
  overflow-x: hidden;
}
.wrap-wide {
  max-width: 720px;
  padding-bottom: max(var(--pad), env(safe-area-inset-bottom));
}

.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0 20px;
  flex-wrap: nowrap;
  min-width: 0;
}
.mast .btn {
  width: auto;
  margin: 0;
  flex-shrink: 0;
  padding: 10px 12px;
  min-height: 44px;
  white-space: nowrap;
}
.mast .badge { flex-shrink: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  color: var(--cream);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
}
.brand > span:not(.mark) { min-width: 0; }
.mark {
  width: 40px;
  height: 40px;
  background: var(--orange);
  color: #1a1008;
  font-weight: 900;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 0.85rem;
  letter-spacing: -0.04em;
}
.subbrand {
  display: block;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--cream-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  font-size: 1.85rem;
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}
h2 { font-size: 1.2rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
p { margin: 0 0 12px; color: var(--cream-dim); }
.lede { font-size: 1.05rem; color: var(--cream); }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--plank);
  color: var(--hi-vis);
  padding: 4px 8px;
  border-radius: 4px;
}
.badge.warn { background: #5c3a12; color: #ffd166; }
.badge.bad { background: #4a1c18; color: #ffb4a8; }

.card {
  background: var(--dirt);
  border: 1px solid #4a4034;
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  min-width: 0;
  max-width: 100%;
}
.card h2 { margin-top: 0; }
#calculator,
#calculator.card,
.calc-out,
.calc-grid,
.calc-grid div {
  min-width: 0;
  max-width: 100%;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin: 12px 0 6px;
}
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  background: var(--asphalt);
  color: var(--cream);
  border: 2px solid #5a5044;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 1.05rem;
  font-family: inherit;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--orange);
  border-color: var(--orange);
}
input[type="checkbox"] {
  width: 28px;
  height: 28px;
  min-height: 28px;
  accent-color: var(--orange);
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  margin: 4px 0;
}
.check label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cream);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 12px 18px;
  border: 0;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  margin: 8px 0;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--orange);
  color: #1a1008;
}
.btn-primary:hover { background: #ff6d14; }
.btn-ghost {
  background: transparent;
  color: var(--cream);
  border: 2px solid #6a6054;
}
.btn-paper {
  background: var(--paper);
  color: var(--ink);
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.nav-bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #120f0c;
  border-top: 2px solid #3a3228;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-bottom a {
  color: var(--cream-dim);
  text-decoration: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 4px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-bottom a.on, .nav-bottom a:hover { color: var(--orange); }
.nav-bottom .ico { display: block; font-size: 1.2rem; margin-bottom: 2px; }

.totals {
  background: #120f0c;
  border: 2px solid var(--orange);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
}
.totals .line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  font-variant-numeric: tabular-nums;
}
.totals .line span { min-width: 0; }
.totals .line strong {
  font-family: var(--mono);
  flex-shrink: 0;
  white-space: nowrap;
}
.totals .due {
  border-top: 2px solid #4a4034;
  margin-top: 8px;
  padding-top: 10px;
  font-size: 1.2rem;
  color: var(--hi-vis);
}
.muted { color: var(--cream-dim); font-size: 0.92rem; }
.warn-box {
  background: #3a2a10;
  border: 1px solid #c9a227;
  color: #ffe8a3;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  margin: 12px 0;
}
.fine {
  font-size: 0.78rem;
  color: #c4b8a8;
  margin-top: 24px;
}

.job-list { list-style: none; margin: 0; padding: 0; }
.job-list li {
  background: var(--dirt);
  border: 1px solid #4a4034;
  border-radius: 8px;
  margin: 10px 0;
}
.job-list a {
  display: block;
  padding: 16px;
  color: var(--cream);
  text-decoration: none;
  min-height: var(--tap);
}
.job-list .meta { color: var(--cream-dim); font-size: 0.88rem; }

table.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin: 12px 0 8px;
  max-width: 100%;
  padding-bottom: 10px;
}
table.sheet th, table.sheet td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #4a4034;
  vertical-align: top;
  overflow-wrap: break-word;
}
table.sheet th { color: var(--hi-vis); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
table.sheet a { color: var(--cream); }
table.sheet td.statute {
  font-size: 0.82rem;
  overflow-wrap: break-word;
}
.table-scroll::-webkit-scrollbar { height: 10px; }
.table-scroll::-webkit-scrollbar-track { background: var(--plank); border-radius: 4px; }
.table-scroll::-webkit-scrollbar-thumb { background: #6a6054; border-radius: 4px; }

.rate-cards {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  min-width: 0;
  max-width: 100%;
}
.rate-card {
  background: var(--dirt);
  border: 1px solid var(--plank);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
  max-width: 100%;
}
.rate-card h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rate-card dl {
  margin: 0;
  min-width: 0;
}
.rate-card dt {
  color: var(--hi-vis);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 10px 0 4px;
}
.rate-card dt:first-child { margin-top: 0; }
.rate-card dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: break-word;
}
.rate-card .statute {
  overflow-wrap: break-word;
  word-break: normal;
  min-width: 0;
}


/* Landing calculator */
.calc-out {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 12px;
  overflow-wrap: break-word;
}
.calc-out h3 { margin: 0 0 8px; color: var(--ink); }
.calc-out .big {
  font-size: 1.65rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 14px;
  overflow-wrap: break-word;
}
.calc-out p { color: var(--ink-soft); }
.calc-out a, .paper a { color: var(--orange-dk); }
.calc-out a:hover, .paper a:hover { color: var(--orange); }
.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.calc-grid div {
  background: #f3eee4;
  padding: 10px;
  border-radius: 6px;
  min-width: 0;
  overflow-wrap: break-word;
}
.calc-grid span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6a6054;
  font-weight: 700;
}
.calc-grid strong {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Invoice paper (on-screen + PDF) */
.paper {
  background: var(--paper);
  color: var(--ink);
  padding: 22px 20px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.35;
}
.paper h1, .paper h2, .paper p, .paper td, .paper th, .paper label {
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}
.paper .head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 3px solid #1a1510;
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.paper .head > * { min-width: 0; }
.paper .co { font-size: 1.25rem; font-weight: 900; margin: 0; }
.paper .inv-no { text-align: right; font-weight: 800; }
.paper .addr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.paper table { width: 100%; border-collapse: collapse; }
.paper th { text-align: left; border-bottom: 2px solid #1a1510; padding: 6px 4px; font-size: 11px; text-transform: uppercase; }
.paper td { padding: 6px 4px; border-bottom: 1px solid #ddd; }
.paper .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper .sum {
  margin-top: 12px;
  margin-left: auto;
  width: min(240px, 100%);
}
.paper .sum td { border: 0; padding: 3px 4px; }
.paper .sum .due td { font-weight: 900; font-size: 15px; border-top: 2px solid #1a1510; }
.paper .interac {
  border: 2px solid #1a1510;
  padding: 10px;
  margin: 16px 0 8px;
}
.paper .disclaimer {
  font-size: 10px;
  color: #555;
  margin-top: 16px;
  border-top: 1px solid #ccc;
  padding-top: 8px;
}
.paper .footer-free {
  text-align: center;
  font-weight: 800;
  margin-top: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
}
.paper .logo { max-height: 56px; max-width: 160px; }

.hidden { display: none !important; }
.screen { display: none; }
.screen.on { display: block; }

.toast {
  position: fixed;
  left: 16px; right: 16px; bottom: 84px;
  background: var(--hi-vis);
  color: #1a1008;
  font-weight: 800;
  padding: 14px;
  border-radius: 8px;
  text-align: center;
  z-index: 50;
}

.hero-kicker {
  color: var(--orange);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin-bottom: 8px;
}

.statute { font-size: 0.82rem; word-break: normal; overflow-wrap: break-word; }

@media (max-width: 360px) {
  .brand { font-size: 1rem; gap: 8px; }
  .mark { width: 36px; height: 36px; }
}

@media (max-width: 539px) {
  .row2 { grid-template-columns: 1fr; }
  .paper .addr-grid { grid-template-columns: 1fr; }
  .paper .head { flex-direction: column; }
  .paper .inv-no { text-align: left; }
}

@media (min-width: 540px) {
  .calc-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 719px) {
  .table-scroll, .swipe-hint { display: none; }
}

@media (min-width: 720px) {
  .wrap { max-width: 640px; }
  html { font-size: 18px; }
  .rate-cards { display: none; }
}

@media print {
  body { background: white; color: black; }
  .nav-bottom, .mast, .no-print, .btn { display: none !important; }
  .paper { box-shadow: none; }
}
