/* Piece Rate: a rate notice and a pay slip. Square corners, black rules, no colour for good or bad. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* Paper does not change in the evening. */
.paper, .slip, .statement {
  --bg: #FCF0DD;
  --ink: #1A1A1A;
  --ink-soft: #5B5B5B;
  background: var(--bg);
  color: var(--ink);
}

.label, .slip .lab, th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--fw-medium);
}

/* ---- the notice ---- */

.notice {
  border: 1px solid var(--ink);
  padding: 16px 20px 12px;
  margin-bottom: 20px;
}

.wordmark { display: block; height: auto; }

h1 {
  display: inline-block;
  margin: 10px 0 8px;
  font-size: 22px;
  font-weight: var(--fw-bold);
  border-bottom: 3px solid var(--c-brick);
  padding-bottom: 2px;
}

.rules { margin: 0; padding-left: 1.6em; }
.rules li { margin: 2px 0; }

/* ---- controls ---- */

button {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  padding: 7px 14px;
  cursor: pointer;
}
button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.row.spread { justify-content: space-between; }

main p { margin: 10px 0; }
.claims, .held { font-variant-numeric: tabular-nums; }
.note { color: var(--ink-soft); }

/* ---- countdown and work ---- */

.big {
  display: block;
  font-size: clamp(2.5rem, 10vw, 6rem);
  font-weight: var(--fw-bold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: 8px 0;
}

.clock {
  font-size: 28px;
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}

.counters { display: flex; flex-wrap: wrap; gap: 16px; }
.counter {
  flex: 1 1 12rem;
  min-width: 0;
  border: 1px solid var(--ink);
  padding: 12px 16px;
}

/* ---- slips ---- */

.slips { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }

.slip {
  flex: 1 1 15rem;
  min-width: 0;
  border: 1px solid var(--ink);
  border-bottom-style: dashed;
}

.band {
  background: var(--c-mustard);
  border-bottom: 1px solid var(--ink);
  padding: 8px 12px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.band-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--fw-bold);
}
.who { font-weight: var(--fw-medium); }

.lines { padding: 6px 12px 8px; }

/* A figure never wraps and never widens the slip: when a line is too narrow,
   the figure drops under its label, still right aligned. */
.line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  padding: 3px 0;
}
.line .lab { min-width: 0; flex: 0 1 auto; }
.line .lead { flex: 1 1 1rem; border-bottom: 1px dotted var(--ink); }
.line .fig {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
  text-align: right;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.line.net { border-top: 3px double var(--ink); margin-top: 6px; padding-top: 6px; }

.foot {
  border-top: 1px solid var(--ink);
  padding: 8px 12px 12px;
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.shared { font-variant-numeric: tabular-nums; }

@media (max-width: 40rem) {
  .slips { flex-direction: column; align-items: stretch; }
  .slip { flex: 0 0 auto; }
}

/* ---- statement ---- */

.statement {
  border: 1px solid var(--ink);
  padding: 20px;
}
.statement h2 { margin: 12px 0 6px; font-size: 22px; }
.statement p { margin: 4px 0; }
.statement h3 { margin: 14px 0 4px; }
.statement .rules { margin-bottom: 12px; }
.statement .end { margin-top: 16px; }

.scroll { overflow-x: auto; margin: 12px 0; }

table { border-collapse: collapse; width: 100%; }
th, td {
  border-bottom: 1px solid var(--ink);
  padding: 5px 8px;
  text-align: left;
  vertical-align: bottom;
}
thead tr:first-child th { border-top: 1px solid var(--ink); }
.num, .fig-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.num { white-space: normal; }
.nw { white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
tr.total th, tr.total td { border-top: 3px double var(--ink); }

/* ---- print: the statement alone, one page, cream and ink whatever the screen ---- */

@page { margin: 14mm; }

@media print {
  :root:root:root {
    --bg: #FCF0DD;
    --ink: #1A1A1A;
    --ink-soft: #5B5B5B;
    color-scheme: light;
  }
  .notice, .controls, button { display: none; }
  .page { padding: 0; max-width: none; }
  .statement { border: 0; padding: 0; font-size: 9pt; line-height: 1.35; }
  .statement h2 { font-size: 14pt; margin-top: 6px; }
  .statement table { font-size: 9pt; }
  .statement th, .statement td { padding: 2px 4px; }
  .statement .label, .statement th { font-size: 7.5pt; }
  .scroll { overflow: visible; margin: 8px 0; }
  .statement .end { margin-top: 8px; }
}
