/* =========================================================
   Checkout Sheet Generator — tool-specific styles.
   Layered on /tools/_shared/tool.css.
   Sibling of sign-in-sheet-generator; shares the same
   printable scaffolding but tracks items, not attendance.
   ========================================================= */

.widget-card {
  max-width: 1040px;
}

/* ---------- Controls ---------- */
.cos-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.cos-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: end;
}
.cos-row[hidden] {
  display: none !important;
}
@media (min-width: 640px) {
  .cos-row { grid-template-columns: repeat(2, 1fr); }
}

.cos-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.cos-field-wide {
  grid-column: 1 / -1;
}
.cos-field label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}
.cos-status {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.cos-status strong { color: var(--text); font-weight: 700; }

.cos-field input[type="text"],
.cos-field input[type="date"],
.cos-field input[type="number"],
.cos-field textarea {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-size: 16px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: var(--transition-colors);
}
.cos-field textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.55;
}
.cos-sample-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.cos-sample-actions .btn {
  min-height: 44px;
  padding-inline: 14px;
}
.cos-field input:focus,
.cos-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ---------- Columns fieldset ---------- */
.cos-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-inset);
}
@media (min-width: 640px) {
  .cos-columns { grid-template-columns: repeat(2, 1fr); }
  .cos-col-custom { grid-column: 1 / -1; }
}
.cos-columns legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.cos-col-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 44px;
}
.cos-col-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.cos-col-check-fixed {
  opacity: 0.85;
  cursor: default;
}
.cos-col-check-fixed input {
  cursor: not-allowed;
}

/* Incident block + AnchorKite credit opt-outs */
.cos-incident-toggle,
.cos-footer-toggle {
  font-size: 14px;
}
.print-credit.is-hidden {
  display: none !important;
}
.cos-col-note {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}
.cos-col-custom {
  flex-wrap: wrap;
  gap: var(--space-3);
}
.cos-col-custom > span {
  font-weight: 600;
}
#col-custom-label {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 12px;
  font: inherit;
  font-size: 16px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: var(--transition-colors);
}
#col-custom-label:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
#col-custom-label:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Mode segment ---------- */
.cos-mode {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 4px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0;
  align-self: flex-start;
}
.cos-segment {
  position: relative;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: calc(var(--radius) - 4px);
  transition: var(--transition-colors);
  white-space: nowrap;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.cos-segment input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.cos-segment:hover { color: var(--text); }
.cos-segment:has(input:checked) {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ---------- Actions ---------- */
.cos-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
@media (min-width: 540px) {
  .cos-actions:has(button:not([hidden]):nth-of-type(2)) {
    grid-template-columns: 2fr 1fr 1fr;
  }
}
.cos-actions .btn {
  font-size: 16px;
  min-height: 52px;
}

/* ---------- Preview ---------- */
.cos-preview {
  border-top: 1px solid var(--border);
  padding-top: var(--space-5);
}
.cos-preview-header {
  margin-bottom: var(--space-4);
  text-align: center;
}
.cos-preview-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.cos-preview-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.cos-preview-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-3);
}
.cos-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}
.cos-table th,
.cos-table td {
  padding: 10px 10px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  color: var(--text);
  background: var(--surface);
}
.cos-table thead th {
  background: var(--surface-inset);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}
.cos-table thead th.col-num {
  width: 40px;
  text-align: center;
}
.cos-table thead th.col-item {
  width: 22%;
  min-width: 130px;
}
.cos-table thead th.col-name {
  width: 22%;
  min-width: 130px;
}
.cos-table thead th.col-time {
  width: 100px;
  min-width: 88px;
}
.cos-table thead th.col-condition {
  width: 15%;
  min-width: 110px;
}
.cos-table thead th.col-custom {
  width: 15%;
  min-width: 110px;
}
.cos-table tbody td.col-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 12px;
}
.cos-table tbody td.col-item,
.cos-table tbody td.col-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cos-table tbody td {
  height: 34px;
}
.cos-table tbody tr:nth-child(even) td {
  background: var(--surface-inset);
}

/* ---------- Incident block ---------- */
.cos-incident-block {
  margin-top: var(--space-5);
}
.cos-incident-title {
  margin: 0 0 var(--space-3);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cos-table-incident {
  min-width: 640px;
}
.cos-table-incident thead th.col-inc-item { width: 22%; min-width: 130px; }
.cos-table-incident thead th.col-inc-desc { width: 34%; min-width: 180px; }
.cos-table-incident thead th.col-inc-cost { width: 90px; min-width: 80px; }
.cos-table-incident thead th.col-inc-date { width: 110px; min-width: 100px; }
.cos-table-incident thead th.col-inc-parent { width: 110px; min-width: 100px; }
.cos-table-incident tbody td { height: 36px; }

/* ---------- Print ----------
   Only the preview prints. Everything else is hidden. */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .tool-header,
  .tool-footer,
  .widget-header,
  .cos-controls,
  .article,
  .attenda-inline,
  .attenda-cta,
  .skip-link { display: none !important; }
  main,
  .widget-wrap {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }
  .widget-card {
    width: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    background: #fff !important;
  }
  .cos-preview {
    width: 100% !important;
    border-top: none !important;
    padding-top: 0 !important;
  }
  .cos-preview-header {
    margin-bottom: 10px !important;
  }
  .cos-preview-title { color: #000 !important; font-size: 16pt !important; }
  .cos-preview-meta  { color: #444 !important; font-size: 10pt !important; }
  .cos-preview-scroll {
    width: 100% !important;
    border: none !important;
    overflow: visible !important;
    background: #fff !important;
    padding: 0 !important;
  }
  .cos-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 10pt !important;
  }
  .cos-table thead { display: table-header-group; }
  .cos-table tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .cos-table th,
  .cos-table td {
    border: 1px solid #666 !important;
    background: #fff !important;
    padding: 6px 8px !important;
    color: #000 !important;
    line-height: 1.2 !important;
  }
  .cos-table thead th {
    color: #000 !important;
    font-size: 8.5pt !important;
    letter-spacing: 0.04em !important;
    white-space: normal !important;
  }
  .cos-table tbody td {
    height: 28px !important;
  }
  .cos-table tbody tr:nth-child(even) td {
    background: #f4f4f4 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .cos-incident-block {
    margin-top: 14px !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .cos-incident-title {
    color: #000 !important;
    font-size: 11pt !important;
    margin: 0 0 6px !important;
  }
  .print-credit {
    margin-top: 10px !important;
    font-size: 7.5pt !important;
    color: #555 !important;
  }
  @page { size: letter portrait; margin: 0.5in; }
}
