* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: #f4f5f7; color: #202124; font-size: 16px; }
main { max-width: 1100px; margin: 0 auto; padding: 12px; }
a { color: inherit; }
.muted { color: #5f6368; font-weight: normal; }
.center { text-align: center; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid #dadce0; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: bold; text-decoration: none; flex: 1 1 auto; font-size: 17px; }
nav { display: flex; gap: 8px; }

/* buttons */
.btn { display: inline-block; font-size: 15px; padding: 9px 14px; border: 1px solid #bbb; border-radius: 6px; background: #fff; color: #202124; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { background: #eee; }
.btn.active { background: #e8f0fe; border-color: #1a73e8; color: #1a73e8; }
.primary { background: #1a73e8; color: #fff; border-color: #1a73e8; font-weight: bold; }
.primary:hover { background: #1765cc; }
button.primary { font-size: 18px; padding: 14px 24px; border-radius: 8px; border: 0; cursor: pointer; width: 100%; }
button.primary:disabled { opacity: .6; }

/* cards + form */
.card { background: #fff; border: 1px solid #dadce0; border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.card h1 { font-size: 20px; margin: 0 0 6px; }
.field { margin-top: 14px; }
.field > label { display: block; font-weight: bold; margin-bottom: 6px; }
input[type=text] { width: 100%; font-size: 17px; padding: 10px; border: 1px solid #bbb; border-radius: 6px; }
textarea { width: 100%; font-size: 16px; padding: 8px; border: 1px solid #bbb; border-radius: 6px; font-family: inherit; }
select, input[type=date] { font-size: 15px; padding: 7px 8px; border: 1px solid #bbb; border-radius: 6px; background: #fff; }

.truck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.truck-pill { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; border: 2px solid #bbb; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 18px; background: #fff; }
.truck-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.truck-pill small { font-size: 11px; color: #188038; font-weight: normal; }
.truck-pill.done { border-style: dashed; }
.truck-pill:has(input:checked) { border-color: #1a73e8; background: #e8f0fe; color: #1a73e8; }

.items-head { display: flex; justify-content: space-between; font-weight: bold; padding-bottom: 8px; border-bottom: 1px solid #ddd; }
.items { list-style: none; margin: 0; padding: 0; }
.items .item { display: grid; grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid #eee; padding: 4px 0; }
.items .item.is-checked .en { color: #188038; }
.check { display: flex; align-items: center; gap: 12px; padding: 8px 4px; cursor: pointer; min-height: 56px; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.box { flex: 0 0 34px; height: 34px; border: 2px solid #999; border-radius: 6px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; }
.check input:checked + .box { background: #188038; border-color: #188038; }
.check input:checked + .box::after { content: "✓"; font-weight: bold; }
.label { display: flex; flex-direction: column; line-height: 1.25; }
.en { font-weight: bold; }
.es { color: #5f6368; font-size: 14px; }
.note-toggle { border: 1px solid #ccc; background: #fff; border-radius: 6px; font-size: 13px; padding: 0 10px; height: 42px; cursor: pointer; white-space: nowrap; }
.note-toggle.open, .note-toggle.has-text { background: #fef7e0; border-color: #f9ab00; }
.note { grid-column: 1 / -1; padding: 0 4px 10px; }
.submit-bar { position: sticky; bottom: 0; padding: 10px 0 14px; background: linear-gradient(to top, #f4f5f7 70%, rgba(244,245,247,0)); }

/* done page */
.bigcheck { font-size: 72px; color: #188038; line-height: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

/* results */
.results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 8px; }
.results-bar .inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend { font-size: 13px; color: #5f6368; margin-bottom: 8px; }
.legend span { margin-right: 14px; }
.wrap { overflow-x: auto; }
.grid { border-collapse: collapse; background: #fff; min-width: 100%; }
.grid th, .grid td { border: 1px solid #333; padding: 6px 4px; text-align: center; vertical-align: middle; font-size: 15px; }
.grid th.item, .grid td.item { text-align: left; min-width: 230px; max-width: 260px; font-size: 13px; line-height: 1.25; background: #fff; position: sticky; left: 0; z-index: 2; }
.grid thead th { background: #fff; position: sticky; top: 0; z-index: 3; font-weight: bold; }
.grid thead th.item { z-index: 4; }
.grid thead th.truck { min-width: 52px; }
.grid tr.date td { font-size: 11px; color: #5f6368; height: 30px; }
.grid tr.date td.item { font-weight: bold; color: #202124; font-size: 13px; }
.grid .by { font-size: 10px; }
.grid td.missing { background: #f1f1f1; color: #999; }
.check-mark { color: #188038; font-size: 22px; font-weight: bold; line-height: 1; }
.cell { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 30px; justify-content: center; }
.note-btn { border: 1px solid #f9ab00; background: #fef7e0; color: #7a4f00; border-radius: 4px; font-size: 10px; padding: 2px 4px; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.note-btn:hover { background: #fde293; }
.print-only { display: none; }

.flash { background: #e6f4ea; border: 1px solid #188038; color: #0d652d; padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; font-size: 14px; }
.small { font-size: 12px; }
.pdf { font-size: 11px; color: #1a73e8; text-decoration: none; border: 1px solid #1a73e8; border-radius: 3px; padding: 1px 5px; background: #fff; cursor: pointer; }
.pdf.err { color: #c5221f; border-color: #c5221f; }

/* comment popup */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.box-wrap { }
.modal .box { background: #fff; border-radius: 8px; width: 100%; max-width: 440px; box-shadow: 0 8px 30px rgba(0,0,0,.3); flex: none; height: auto; border: 0; display: block; color: #202124; font-size: 16px; }
.modal h2 { margin: 0; padding: 14px 16px; font-size: 16px; border-bottom: 1px solid #ddd; }
.modal .sub { padding: 10px 16px 0; font-size: 13px; color: #5f6368; }
.modal .text { padding: 12px 16px 18px; font-size: 16px; white-space: pre-wrap; word-break: break-word; }
.modal .actions { padding: 0 16px 16px; justify-content: flex-end; margin: 0; }

@media print {
  .top, .results-bar, .legend, .modal { display: none !important; }
  main { max-width: none; padding: 0; }
  .grid th, .grid td { font-size: 11px; padding: 3px; }
  .note-btn { display: none; }
  .print-only { display: block; font-size: 9px; color: #7a4f00; }
  .check-mark { font-size: 16px; }
}

/* write-ups */
.flash.error { background: #fce8e6; border-color: #c5221f; color: #a50e0e; }
.ok { color: #188038; }
.err { color: #c5221f; }
.grid.list th, .grid.list td { padding: 8px 8px; }
.grid.list td.left, .grid.list th { text-align: left; }
.grid.list td { text-align: center; }
.grid.list td.left { text-align: left; }
.grid.list .clip { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }
.doc h2 { font-size: 15px; margin: 18px 0 6px; color: #5f6368; text-transform: uppercase; letter-spacing: .3px; }
.doc .row { display: grid; grid-template-columns: 240px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee; }
.doc .k { font-weight: bold; }
.doc .pre { white-space: pre-wrap; }
.actions.left { justify-content: flex-start; }
hr { border: 0; border-top: 1px solid #ddd; margin: 16px 0; }
input[type=date] { width: 100%; font-size: 17px; padding: 10px; }
@media (max-width: 600px) { .doc .row { grid-template-columns: 1fr; gap: 2px; } }
@media print { .actions, .flash { display: none !important; } }
