/* Repairs presentation only; process and permissions come from the API. */
#appView .repair-journey {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

#appView .repair-journey button {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  text-align: left;
  color: var(--ui-text, var(--text));
  background: var(--ui-panel, var(--panel));
  border: 1px solid var(--ui-border, var(--border));
  border-radius: 12px;
  white-space: normal;
}

#appView .repair-journey button[aria-pressed="true"] {
  border-color: var(--accent, #008579);
  box-shadow: inset 0 -3px var(--accent, #008579);
}

#appView .repair-journey strong { font-size: 18px; }
#appView .repair-journey span { font-size: 13px; color: var(--ui-muted, var(--muted)); }
#appView .repair-physical-balance { margin: 4px 0; }
#appView .repair-shipment-part + .repair-shipment-part { margin-top: 12px; }
#appView .repair-journey-list .cell-title { white-space: normal; overflow-wrap: anywhere; }

#technicalCardModal .modal-card { max-width: 900px; }

#repairNextStepPanel {
  border-left: 4px solid var(--accent, #008579);
}

#repairNextStepTitle { margin: 8px 0; }
#repairNextStepHint { max-width: 64ch; line-height: 1.6; margin-bottom: 18px; }
#repairWorkshopHandoff > button { min-height: 44px; }
#repairOtherActions { margin: 18px 0; }
#repairOtherActions > summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
#repairOtherActions[open] { padding-bottom: 16px; border-bottom: 1px solid var(--ui-border, var(--border)); }
#repairOtherActions .form-row { margin: 12px 0; max-width: 420px; }
#repairWorkshopHistory { margin-top: 16px; }
#appView .repair-row-next { font-weight: 600; margin-bottom: 8px; }

#appView #view-poland .repair-overview > summary,
#technicalCardModal .repair-detail-section > summary {
  cursor: pointer;
  padding: 8px 0;
  font-weight: 650;
  color: var(--ui-text, var(--text));
}

#appView #view-poland .repair-overview {
  padding: 8px 16px;
}

#appView #view-poland .repair-overview[open] > summary,
#technicalCardModal .repair-detail-section[open] > summary {
  margin-bottom: 12px;
}

#appView #view-poland .repair-overview .repair-summary-panel {
  box-shadow: none;
}

#appView #view-poland .repair-case-table {
  min-width: 780px;
}

#appView #view-poland .repair-case-table .cell-sub {
  margin-top: 4px;
}

#appView #view-poland .repair-case-table .checkbox-cell {
  width: 36px;
}

#appView #toolbarActions .repair-status-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ui-muted, var(--muted));
}

#appView #toolbarActions .repair-status-filter select {
  width: auto;
  min-height: 36px;
  max-width: 190px;
}

#appView #toolbarActions .repair-selection-hint {
  flex-basis: 100%;
  color: var(--ui-muted, var(--muted));
  font-size: 13px;
  line-height: 1.5;
}

#appView #toolbarPolandCreateShipmentButton {
  white-space: normal;
}

#technicalCardModal .repair-workspace-actions,
#technicalCardModal .repair-detail-section {
  min-width: 0;
}

#technicalCardModal .repair-detail-section {
  padding: 8px 16px;
}

#technicalCardModal .repair-workspace-actions .modal-actions {
  margin-top: 16px;
}

#technicalCardModal .activity-list,
#technicalCardModal .import-meta-item strong {
  overflow-wrap: anywhere;
}

#technicalCardModal .import-meta-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

#technicalCardModal .import-meta-item > span,
#technicalCardModal .repair-case-summary {
  color: var(--ui-muted, var(--muted));
  font-size: 12px;
  line-height: 1.5;
}

#technicalCardModal .repair-case-summary { margin: 6px 0 0; font-size: 14px; }

@media (max-width: 700px) {
  #appView .repair-journey { gap: 6px; }
  #appView .repair-journey button { padding: 12px 8px; }
  #appView .repair-journey strong { font-size: 14px; }
  #appView .repair-journey span { font-size: 12px; line-height: 1.5; }
  #appView #view-poland .repair-journey-list .repair-case-table { min-width: 0; }
  #appView .repair-journey-list .repair-case-table,
  #appView .repair-journey-list tbody,
  #appView .repair-journey-list tr,
  #appView .repair-journey-list td { display: block; width: 100%; min-width: 0; }
  #appView .repair-journey-list thead { display: none; }
  #appView .repair-journey-list tr { padding: 12px 0; border-bottom: 1px solid var(--ui-border, var(--border)); }
  #appView .repair-journey-list td { padding: 6px 12px; border: 0; white-space: normal; box-sizing: border-box; max-width: none; }
  #appView .repair-journey-list :is(.cell-title, .cell-sub) { white-space: normal; overflow-wrap: anywhere; max-width: none; }
  #appView #view-poland .repair-journey-list .repair-case-table .checkbox-cell { width: 56px; overflow: visible; }
  #appView .repair-journey-list td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--ui-muted, var(--muted));
    font-size: 11px;
  }
  #appView .repair-journey-list .table-actions { flex-wrap: wrap; }
  #technicalCardModal .warehouse-form-grid,
  #polandQueueModal .warehouse-form-grid,
  #technicalCardModal .import-meta,
  #appView #view-poland .summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #technicalCardModal .panel-heading-row,
  #technicalCardModal .repair-attachment-controls {
    flex-wrap: wrap;
    min-width: 0;
  }

  #technicalCardModal input[type="file"] {
    max-width: 100%;
  }
}

#polandShipmentItemsRows .repair-transport-blocker {
  display: grid;
  gap: 8px;
  min-width: 150px;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--ui-text, var(--text));
}

@media (max-width: 760px) {
  #polandShipmentModal .table-wrap:has(#polandShipmentItemsRows) {
    min-width: 0;
    max-height: none;
    overflow: visible;
  }

  #polandShipmentModal table:has(#polandShipmentItemsRows) {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #polandShipmentModal table:has(#polandShipmentItemsRows) thead { display: none; }
  #polandShipmentItemsRows { display: grid; gap: 12px; }
  #polandShipmentItemsRows tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--ui-border, var(--border));
    border-radius: 10px;
  }

  #polandShipmentItemsRows td {
    display: block;
    min-width: 0;
    max-width: none;
    padding: 8px;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #polandShipmentItemsRows td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--ui-muted, var(--muted));
    font-size: 12px;
  }

  #polandShipmentItemsRows td[data-label="Part / MMR"] { grid-area: 1 / 1 / 2 / -1; }
  #polandShipmentItemsRows td[data-label="Include"] { grid-area: 2 / 1; }
  #polandShipmentItemsRows td[data-label="Quantity to send"] { grid-area: 2 / 2; }
  #polandShipmentItemsRows td[data-label="Available"] { grid-area: 3 / 1 / 4 / -1; }
  #polandShipmentItemsRows .empty-cell { grid-column: 1 / -1; }
  #polandShipmentItemsRows .table-input { width: 100%; min-width: 0; box-sizing: border-box; }
}
