.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.page-head h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
}

.page-head > div:first-child {
  max-width: 720px;
}

.page-head p {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
}

.page-head__actions,
.section-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.split-grid--top {
  align-items: start;
}

.page-head__date {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
  font-size: 13px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.section-head h2 {
  margin: 0;
}

.section-head h2 small {
  margin-left: var(--space-2);
  color: var(--text-muted);
  font-weight: 400;
}

.kpi-card--button {
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.kpi-card--button[aria-pressed='true'] {
  border-color: var(--blue-600);
  background: var(--blue-100);
}

.staff-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.staff-split:has(.staff-panel:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.staff-panel {
  position: sticky;
  top: var(--space-4);
}

.staff-panel h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-2);
  font-size: 15px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-head h2 {
  margin: 0;
}

.panel-ref {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.panel-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.kv-list {
  margin: 0;
}

.kv-list > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: 13px;
}

.kv-list dt {
  color: var(--text-muted);
}

.kv-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.job-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-4);
  align-items: start;
}

.job-layout__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stage-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-3);
}

.line-editor input,
.line-editor select {
  width: 100%;
  min-height: 36px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-card);
}

.check-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-4);
}

.split-grid--even {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.dashboard-list p {
  margin: var(--space-1) 0 0;
}

/* Two columns need room for the tables inside them, so they stack below 1400 px (a list with its details panel too). */
@media (max-width: 1399px) {
  .split-grid,
  .staff-split:has(.staff-panel:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }

  .staff-panel {
    position: static;
  }
}

@media (max-width: 1099px) {
  .job-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .staff-panel {
    position: static;
  }
}

.staff-split .data-table th,
.staff-split .data-table td,
.job-layout .data-table th,
.job-layout .data-table td {
  padding: var(--space-2);
  font-size: 13px;
}

.table-toolbar select,
.table-toolbar input[type='date'],
.page-head select,
.technician-field select {
  width: auto;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-card);
}

.panel-actions .btn {
  width: 100%;
}

.btn--confirm {
  background: var(--success);
  color: var(--white);
}

.btn--reject {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.page-head h1 .badge {
  font-size: 13px;
  line-height: 1.4;
}

.panel-actions .btn .icon {
  flex-shrink: 0;
}

.technician-field select {
  width: 100%;
}

.grid-6 .kpi-card {
  padding: var(--space-3);
}

.grid-6 .kpi-card__icon {
  width: 40px;
  height: 40px;
}

.line-editor {
  min-width: 560px;
}

.line-editor th:nth-child(1) {
  width: 120px;
}

.line-editor th:nth-child(3) {
  width: 90px;
}

.line-editor th:nth-child(4) {
  width: 130px;
}

.line-editor th:nth-child(5) {
  width: 44px;
}

.cell-code {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

/* Columns that can wait until there is room: below 1280 px the actions must stay visible without sideways scrolling. */
@media (max-width: 1279px) {
  .col-wide {
    display: none;
  }
}

@media (max-width: 1439px) {
  .col-xwide {
    display: none;
  }
}

.channel-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.channel-strip li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.list-row small {
  display: block;
  color: var(--text-muted);
}
