/* Palette: membrane white, asphalt slate, hi-vis yellow for the one thing that matters (signing) */
:root {
  --paper: #f5f6f3;
  --surface: #ffffff;
  --ink: #16212a;
  --slate: #56636d;
  --line: #d3d8d2;
  --hivis: #f2c018;
  --hivis-deep: #c99a00;
  --ok: #2c7a4b;
  --ok-bg: #e6f2ea;
  --miss: #b0362a;
  --miss-bg: #f8e7e4;
  --radius: 6px;
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
a { color: var(--ink); text-underline-offset: 3px; }
h1 { font-size: 2rem; line-height: 1.15; margin: .2em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 1.6em 0 .5em; }
.muted { color: var(--slate); }
.small { font-size: .88rem; }
.wrap { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

/* Admin bar */
.bar { background: var(--ink); color: #fff; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  align-items: center; justify-content: space-between; padding: .7rem 1.25rem; }
.bar a, .bar .linkish { color: #fff; text-decoration: none; }
.brand { font-weight: 700; }
.bar nav { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; align-items: center; }
.bar nav a[aria-current] { box-shadow: inset 0 -3px 0 var(--hivis); }
.bar form { margin: 0; }

/* Controls */
button, .button { font: inherit; font-weight: 700; background: var(--ink); color: #fff; border: 2px solid var(--ink);
  border-radius: var(--radius); padding: .55rem 1rem; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .button.secondary { background: transparent; color: var(--ink); }
button:hover, .button:hover { filter: brightness(1.15); }
.linkish { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.linkish.danger { color: var(--miss); }
:focus-visible { outline: 3px solid var(--hivis-deep); outline-offset: 2px; }
input, textarea { font: inherit; width: 100%; padding: .55rem .65rem; border: 1.5px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink); }
input:focus, textarea:focus { border-color: var(--ink); }
label { display: block; font-weight: 700; }
label input, label textarea { margin-top: .3rem; font-weight: 400; }
label .muted { font-weight: 400; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 1rem; }
.row .grow { flex: 1 1 280px; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0 .4rem; }
.actions form { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: 1.5rem; }
.inline-form label { flex: 1 1 200px; }
.card-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 2rem; }
.card-form h2 { margin-top: 0; }
.narrow { max-width: 380px; margin: 12vh auto 0; }

.flash { padding: .6rem .85rem; border-radius: var(--radius); border-left: 4px solid var(--ok); background: var(--ok-bg); margin: 0 0 1rem; }
.flash.error { border-color: var(--miss); background: var(--miss-bg); }

/* Tables */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .88rem; color: var(--slate); font-weight: 700; background: var(--paper); }
td .sub { display: block; font-size: .85rem; color: var(--slate); }
tr.inactive td { color: var(--slate); }
tr.current td { background: #fdf7dc; }
.row-actions { white-space: nowrap; display: flex; gap: 1rem; }
.row-actions form { margin: 0; }

/* Status board */
.status tr td:first-child { border-left: 5px solid transparent; }
.status tr.is-signed td:first-child { border-left-color: var(--ok); }
.status tr.is-missing td:first-child { border-left-color: var(--miss); }
.status tr.is-signed td:nth-child(2) { color: var(--ok); font-weight: 700; }
.status tr.is-missing td:nth-child(2) { color: var(--miss); }
.tally { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 0 .8rem; margin: .5rem 0 .4rem; max-width: 520px; }
.tally-num { font-size: 3.4rem; font-weight: 700; line-height: 1; grid-row: span 2; }
.tally-num small { font-size: 1.4rem; color: var(--slate); }
.meter { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--ok); }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: .35rem 0; border-bottom: 1px solid var(--line); display: flex; gap: 1rem; }
.plain-list .muted { min-width: 8.5rem; }

/* Foreman sign page: big, high-contrast, works in sunlight with gloves off */
body.field { background: var(--surface); }
body.field .wrap { max-width: 560px; padding-top: 0; }
.sign-head { background: var(--ink); color: #fff; margin: 0 -1.25rem 1.25rem; padding: 1.25rem 1.25rem 1.1rem;
  border-bottom: 6px solid var(--hivis); }
.sign-head p { margin: 0; color: #c9d1d6; font-size: .95rem; }
.sign-head h1 { margin: .25rem 0 0; color: #fff; }
.talk-content { white-space: pre-wrap; background: var(--paper); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 700; font-size: 1.05rem; }
.check input { width: 1.6rem; height: 1.6rem; margin: 0; flex: none; accent-color: var(--ink); }
.sig { margin-top: 1.4rem; }
.sig-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: .3rem; }
#pad { display: block; width: 100%; height: 190px; touch-action: none; border: 2px solid var(--ink); border-radius: var(--radius);
  background:
    linear-gradient(var(--hivis), var(--hivis)) 1.5rem calc(100% - 42px) / calc(100% - 3rem) 3px no-repeat,
    #fffef6; cursor: crosshair; }
.sig-error { color: var(--miss); font-weight: 700; margin: .4rem 0 0; }
button.big { width: 100%; font-size: 1.25rem; padding: 1rem; background: var(--hivis); border-color: var(--hivis-deep); color: var(--ink); }
.button.wide { width: 100%; text-align: center; }
.done { text-align: center; padding-top: 18vh; }
.done-mark { width: 84px; height: 84px; }
.done-mark circle { fill: var(--ok); }
.done-mark path { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }

/* Printable record */
.record header { margin-bottom: 1rem; }
.record-table .pre { white-space: pre-line; }
.sig-img { max-width: 180px; height: auto; display: block; }
@media print {
  .bar, .noprint, .flash { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .record-table { font-size: 11pt; }
  .record-table tr { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.import-form { display: grid; grid-template-columns: 1fr auto; gap: .5rem .75rem; align-items: end; margin-top: 1rem; }
.import-form p { grid-column: 1 / -1; margin: 0; }
.import-form input[type=file] { padding: .4rem; }
@media (max-width: 560px) { .import-form { grid-template-columns: 1fr; } }
