.safety-page .stats-title h1 {
  text-align: left;
}

.sheet-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet-actions button,
.safety-card-actions button {
  min-height: 36px;
  border: 1px solid #fff;
  border-radius: 6px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: 900 12px Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  cursor: pointer;
}

.sheet-actions button {
  border-color: #f3a334;
  background: #f3a334;
  color: #07111f;
}

.sheet-actions span {
  color: #d8eef4;
  font-size: 12px;
  font-weight: 900;
}

.safety-filter-card,
.sheet-block {
  min-width: 0;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid #8fa9ba;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(13, 37, 58, 0.12);
}

.safety-card-head,
.sheet-block h2 {
  margin: 0;
  padding: 11px 13px;
  background: linear-gradient(135deg, #0b2d5a 0%, #12446f 70%, #0f7789 100%);
  color: #fff;
}

.safety-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.safety-card-head h2,
.sheet-block h2 {
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
}

.safety-card-actions {
  display: flex;
  gap: 8px;
}

#toggleSafetyFilters {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.2);
}

.safety-card-actions button:last-child {
  border-color: #9eb4c3;
  background: #fff;
  color: #102f5e;
}

.safety-filter-card.collapsed .safety-toolbar {
  display: none;
}

.safety-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px;
}

.safety-search-field {
  grid-column: span 2;
}

.safety-toolbar label,
.safety-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #344f62;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.safety-toolbar input,
.safety-form input,
.safety-form select,
.safety-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #aebfcb;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: #07111f;
  font: 800 13px Arial, Helvetica, sans-serif;
}

.sheet-register {
  min-width: 0;
}

.sheet-table-wrap {
  overflow-x: auto;
}

.sheet-table {
  width: 100%;
  min-width: 1130px;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
}

.sheet-table th,
.sheet-table td {
  border: 1px solid #b8c8d6;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.sheet-table th {
  background: #d8eaf2;
  color: #102f5e;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.sheet-table tbody tr {
  cursor: pointer;
}

.sheet-table tbody tr:hover {
  background: #edf8fa;
}

.sheet-table tbody tr.cap-due-30,
.sheet-table tbody tr.cap-due-30:hover {
  background: #eef7ff;
}

.sheet-table tbody tr.cap-due-20,
.sheet-table tbody tr.cap-due-20:hover {
  background: #fff8dd;
}

.sheet-table tbody tr.cap-due-10,
.sheet-table tbody tr.cap-due-10:hover {
  background: #ffefd8;
}

.sheet-table tbody tr.cap-overdue-10,
.sheet-table tbody tr.cap-overdue-10:hover {
  background: #ffe8e4;
}

.sheet-table tbody tr.cap-overdue-20,
.sheet-table tbody tr.cap-overdue-20:hover {
  background: #ffd5cf;
}

.sheet-table tbody tr.cap-overdue-30,
.sheet-table tbody tr.cap-overdue-30:hover {
  background: #ffc4bd;
}

.sheet-table tbody tr.cap-overdue-older,
.sheet-table tbody tr.cap-overdue-older:hover {
  background: #f2a8a1;
}

.sheet-table .blank-row {
  cursor: default;
}

.sheet-table .blank-row:hover {
  background: transparent;
}

.sheet-table tbody tr.safety-group-row,
.sheet-table tbody tr.safety-group-row:hover {
  background: linear-gradient(135deg, #102f5e 0%, #0f7789 100%);
  color: #fff;
  cursor: default;
}

.safety-group-row td {
  border-color: #102f5e !important;
  padding: 8px 12px !important;
}

.safety-group-title {
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.safety-group-count {
  display: inline-block;
  margin-left: 10px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f3a334;
  color: #07111f;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.no-col {
  width: 48px;
}

.finding-col {
  min-width: 260px;
}

.manager-col {
  min-width: 170px;
}

.date-col {
  min-width: 116px;
}

.status-col {
  min-width: 120px;
}

.remarks-col {
  min-width: 220px;
}

.safety-finding-cell,
.safety-notes-cell {
  min-width: 240px;
  max-width: 460px;
  color: #07111f;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal !important;
}

.safety-manager-cell,
.safety-date-cell {
  color: #263d4d;
  font-weight: 900;
}

.safety-empty {
  padding: 22px !important;
  color: #536b7a;
  font-weight: 900;
  text-align: center !important;
}

.compact-modal .safety-modal-panel {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
}

.compact-modal .bulk-safety-modal-panel {
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.safety-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
  overflow-y: auto;
}

.narrative-section {
  grid-column: 1 / -1;
}

.safety-form-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid #b8c8d6;
  border-radius: 6px;
  padding: 12px;
  background: #f8fbfd;
}

.safety-form-section h3 {
  margin: 0;
  border-radius: 6px;
  padding: 9px 11px;
  background: linear-gradient(135deg, #0b2d5a 0%, #607a2a 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.schedule-section h3 {
  background: linear-gradient(135deg, #102f5e 0%, #0f7789 100%);
}

.narrative-section h3 {
  background: linear-gradient(135deg, #1d4965 0%, #b86520 100%);
}

.safety-entry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.narrative-section {
  background: #fff;
}

.narrative-section .safety-finding-field,
.narrative-section .safety-notes-field {
  display: grid;
  gap: 5px;
}

.safety-finding-field textarea,
.safety-notes-field textarea {
  min-height: 118px;
  line-height: 1.45;
  resize: vertical;
  text-transform: none;
}

.safety-notes-field textarea {
  min-height: 96px;
}

.safety-delete-row {
  border: 1px solid #9c2f2a !important;
  background: #fff !important;
  color: #9c2f2a !important;
}

#safetyModalStatus {
  color: #536b7a;
  font-size: 12px;
  font-weight: 900;
}

.bulk-safety-form {
  display: grid;
  gap: 14px;
  overflow-y: auto;
}

.bulk-source-section {
  padding: 14px;
}

.bulk-source-layout {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) minmax(220px, 280px);
  gap: 20px;
  align-items: stretch;
}

.bulk-image-stack,
.bulk-source-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.bulk-source-panel {
  min-height: 316px;
  border: 1px solid #c7d6e2;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  align-content: space-between;
}

.bulk-source-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border-radius: 7px;
  padding: 0 14px;
  background: #eef8fb;
  color: #102f5e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.bulk-image-field {
  min-height: 316px;
  border: 1px dashed #0f7789;
  border-radius: 8px;
  background: #eef8fb;
  color: #102f5e;
  cursor: pointer;
  display: grid !important;
  gap: 6px !important;
  place-items: center;
  min-width: 0;
  padding: 14px !important;
  text-align: center;
}

.bulk-image-field input {
  height: 1px !important;
  opacity: 0;
  overflow: hidden;
  padding: 0 !important;
  position: absolute;
  width: 1px !important;
}

.bulk-upload-icon {
  width: 34px;
  height: 34px;
  border: 1px solid #0f7789;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: #0f7789;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.bulk-upload-title {
  color: #102f5e;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.bulk-upload-name {
  max-width: 100%;
  color: #536b7a;
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.bulk-image-preview {
  width: 100%;
  min-height: 222px;
  border: 1px solid rgba(15, 119, 137, 0.26);
  border-radius: 7px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #536b7a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.bulk-image-preview img {
  width: 100%;
  height: 100%;
  max-height: 238px;
  object-fit: contain;
  display: block;
}

.bulk-source-actions,
.bulk-section-head,
.bulk-mapping-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bulk-source-actions,
.bulk-section-head {
  justify-content: space-between;
}

.bulk-source-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 12px;
}

.bulk-section-head h3 {
  margin: 0;
}

.bulk-mapping-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bulk-check-field {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 38px;
}

.bulk-check-field input {
  width: auto !important;
}

.bulk-image-stack button,
.bulk-source-actions button,
.bulk-mapping-actions button,
#previewBulkSafety,
#saveBulkSafety,
#clearBulkSafety {
  min-height: 38px;
  border: 1px solid #0f7789;
  border-radius: 6px;
  padding: 0 13px;
  background: #0f7789;
  color: #fff;
  font: 900 12px Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  cursor: pointer;
}

#extractBulkSafetyImage,
#parseBulkSafety {
  min-height: 44px;
  padding-inline: 22px;
}

#parseBulkSafety {
  min-width: 0;
}

#clearBulkSafety {
  border-color: #9eb4c3;
  background: #fff;
  color: #102f5e;
}

#clearBulkMapping {
  border-color: #9eb4c3;
  background: #fff;
  color: #102f5e;
}

#saveBulkSafety {
  border-color: #f3a334;
  background: #f3a334;
  color: #07111f;
}

.bulk-default-grid,
.bulk-map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.bulk-default-grid label {
  display: grid;
  gap: 6px;
  color: #344f62;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.bulk-default-grid select,
.bulk-map-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #9eb4c3;
  border-radius: 7px;
  padding: 0 36px 0 11px;
  background:
    linear-gradient(45deg, transparent 50%, #0f7789 50%) right 15px center / 6px 6px no-repeat,
    linear-gradient(135deg, #0f7789 50%, transparent 50%) right 10px center / 6px 6px no-repeat,
    #fff;
  color: #07111f;
  font: 900 12px Arial, Helvetica, sans-serif;
  text-transform: none;
  appearance: none;
  cursor: pointer;
}

.bulk-default-grid select:hover,
.bulk-map-field select:hover {
  border-color: #0f7789;
  box-shadow: 0 0 0 3px rgba(15, 119, 137, 0.08);
}

.bulk-default-grid select:focus,
.bulk-map-field select:focus {
  outline: none;
  border-color: #0f7789;
  box-shadow: 0 0 0 3px rgba(15, 119, 137, 0.18);
}

.bulk-map-grid {
  padding-top: 2px;
}

.bulk-map-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #344f62;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.bulk-preview-wrap {
  overflow-x: auto;
}

.bulk-preview-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 12px;
}

.bulk-preview-table th,
.bulk-preview-table td {
  border: 1px solid #b8c8d6;
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
}

.bulk-preview-table th {
  background: #d8eaf2;
  color: #102f5e;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.bulk-preview-table td {
  color: #07111f;
  font-weight: 800;
}

.bulk-preview-empty {
  padding: 20px !important;
  color: #536b7a !important;
  font-weight: 900;
  text-align: center !important;
}

#bulkSafetyStatus {
  flex: 1 1 auto;
  color: #536b7a;
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

@media (max-width: 760px) {
  .sheet-actions,
  .safety-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .sheet-actions,
  .safety-card-actions {
    justify-content: flex-start;
  }

  .safety-toolbar,
  .safety-form,
  .safety-entry-grid {
    grid-template-columns: 1fr;
  }

  .safety-search-field {
    grid-column: auto;
  }

  .sheet-table {
    min-width: 980px;
  }

  .bulk-source-layout,
  .bulk-default-grid,
  .bulk-map-grid {
    grid-template-columns: 1fr;
  }

  .bulk-source-panel,
  .bulk-source-actions {
    min-height: 0;
  }

  .bulk-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-mapping-actions {
    justify-content: flex-start;
  }
}
