/*
 * grid.css — tables: the shared table look, and the coordinator grid (trip heads,
 * per-site child rows, editable cells, row states, the name box and legend).
 */

table { width: 100%; border-collapse: collapse; }
th {
  text-align: start;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
.grid-wrap { overflow: auto; border-radius: var(--r-lg); }
.site { font-weight: 700; }

/* ---------- Coordinator grid ---------- */
.col-check { width: 34px; }
.trip-head td { background: var(--surface-3); font-weight: 600; color: var(--text-2); border-top: 2px solid var(--border); }
.trip-head .num { font-weight: 700; color: var(--text); }
.child td:first-child { padding-inline-start: 26px; }
.row-warn { background: var(--row-warn-bg); }
/* Approved lines are dimmed but stay editable — an edit reverts them to pending (rule 18). */
.row-approved { opacity: .62; }
.row-approved:hover, .row-approved:focus-within { opacity: 1; }
.row-locked { opacity: .62; }
.row-saving .editable, .row-saving .cell-select { opacity: .55; }

.editable {
  border-radius: var(--r-sm);
  padding: 2px 6px;
  display: inline-block;
  min-width: 44px;
  transition: background .1s, box-shadow .1s;
}
.editable[contenteditable="true"] { cursor: text; }
.editable[contenteditable="true"]:hover { background: var(--primary-subtle); }
.editable:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 2px var(--primary); }
.editable.is-empty { color: var(--muted); }
.manual { position: relative; }
.manual::after {
  content: "";
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* Contractor / period pickers wear the badge colours */
select.cell-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  box-shadow: none;
  min-width: 0;
  max-width: 170px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-overflow: ellipsis;
}
select.cell-select:disabled { cursor: default; }
select.cell-select option { background: var(--surface); color: var(--text); }
.cell-wrap { display: inline-flex; }

.return-note { font-size: 11.5px; color: var(--warning-strong); margin-top: 3px; max-width: 240px; line-height: 1.4; }

.namebox {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: 8px 14px;
  margin-bottom: 16px;
}
.namebox label { font-size: 12px; color: var(--muted); font-weight: 600; }
.namebox input { min-width: 150px; }
.namebox .tip { font-size: 11.5px; color: var(--muted); margin-inline-start: auto; }
.bar .check-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.bar .check-label.quiet { font-weight: 500; color: var(--text-2); }

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-2);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .editable { min-width: 0; }
.grid-foot { border-top: 1px solid var(--border-2); }
