.ehs-app {
  --ehs-bg: #f4f6f8;
  --ehs-panel: #ffffff;
  --ehs-soft: #eef3f7;
  --ehs-ink: #15212e;
  --ehs-muted: #627182;
  --ehs-line: #d5dde6;
  --ehs-green: #15803d;
  --ehs-teal: #0f766e;
  --ehs-orange: #f97316;
  --ehs-blue: #2563eb;
  --ehs-red: #b42318;
  --ehs-amber: #b45309;
  --ehs-purple: #6d28d9;
  --ehs-shadow: 0 20px 48px rgba(15, 23, 42, .14);
  width: min(1450px, 100%);
  margin: 0 auto 48px;
  color: var(--ehs-ink);
  font: 14px/1.45 Inter, Segoe UI, Arial, sans-serif;
}

.ehs-app * {
  box-sizing: border-box;
}

.ehs-app button,
.ehs-app input,
.ehs-app select,
.ehs-app textarea {
  font: inherit;
}

.ehs-shell {
  min-height: calc(100vh - 130px);
  overflow: hidden;
  background: var(--ehs-bg);
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
  box-shadow: var(--ehs-shadow);
}

.ehs-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #ffffff, #edf3f8);
  border-bottom: 1px solid var(--ehs-line);
}

.ehs-kicker {
  margin: 0 0 4px;
  color: #9a3412;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.ehs-header h1 {
  margin: 0;
  color: var(--ehs-ink);
  font-size: 28px;
  letter-spacing: 0;
}

.ehs-header p {
  max-width: 800px;
  margin: 6px 0 0;
  color: var(--ehs-muted);
}

.ehs-qr-card,
.ehs-card,
.ehs-queue-card,
.ehs-action-card,
.ehs-training-card {
  background: var(--ehs-panel);
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
}

.ehs-qr-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.ehs-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 86px;
  height: 86px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 6px;
  box-sizing: border-box;
}

.ehs-qr-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: crisp-edges;
}

.ehs-qr-card b,
.ehs-qr-card span {
  display: block;
  min-width: 0;
}

.ehs-qr-card span {
  margin-top: 3px;
  overflow: hidden;
  color: var(--ehs-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ehs-tabs {
  display: flex;
  gap: 1px;
  overflow-x: auto;
  background: var(--ehs-line);
  border-bottom: 1px solid var(--ehs-line);
}

.ehs-tab {
  min-height: 44px;
  padding: 10px 15px;
  color: var(--ehs-muted);
  background: #f9fbfa;
  border: 0;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.ehs-tab.active {
  color: #fff;
  background: var(--ehs-orange);
}

.ehs-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--ehs-line);
  border-bottom: 1px solid var(--ehs-line);
}

.ehs-metric {
  padding: 13px 15px;
  background: #fff;
}

.ehs-metric b {
  display: block;
  color: #0563c1;
  font-size: 25px;
}

.ehs-metric span {
  display: block;
  margin-top: 2px;
  color: var(--ehs-muted);
  font-size: 12px;
  font-weight: 800;
}

.ehs-body {
  padding: 16px;
}

.ehs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 340px;
  gap: 16px;
  align-items: start;
}

.ehs-card {
  padding: 16px;
}

.ehs-card h2 {
  margin: 0 0 5px;
  color: var(--ehs-ink);
  font-size: 21px;
}

.ehs-card p {
  margin: 4px 0 0;
  color: var(--ehs-muted);
}

.ehs-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.ehs-label {
  display: grid;
  gap: 5px;
  color: var(--ehs-ink);
  font-size: 12px;
  font-weight: 900;
}

.ehs-label.full {
  grid-column: 1 / -1;
}

.ehs-required {
  color: var(--ehs-orange);
}

.ehs-input,
.ehs-select,
.ehs-textarea {
  width: 100%;
  min-width: 0;
  color: var(--ehs-ink);
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 6px;
  padding: 10px 11px;
  outline: 0;
}

.ehs-input:focus,
.ehs-select:focus,
.ehs-textarea:focus {
  border-color: var(--ehs-teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .16);
}

.ehs-textarea {
  min-height: 132px;
  resize: vertical;
}

.ehs-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ehs-check {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  background: var(--ehs-soft);
  border: 1px solid var(--ehs-line);
  border-radius: 6px;
  font-weight: 800;
}

.ehs-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}

.ehs-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 12px;
  color: #fff;
  background: var(--ehs-orange);
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.ehs-report-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 430px);
  gap: 18px;
  align-items: start;
}

.ehs-email-readiness {
  padding: 11px 13px;
  background: var(--ehs-soft);
  border-left: 4px solid var(--ehs-orange);
  border-radius: 5px;
}

.ehs-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.ehs-report-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 15px;
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
}

.ehs-report-card h3 {
  margin: 0;
  color: var(--ehs-ink);
  font-size: 17px;
}

.ehs-report-card p {
  flex: 1;
}

.ehs-report-card .ehs-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ehs-report-email-form .ehs-textarea {
  min-height: 90px;
}

.ehs-reports .ehs-report-card strong,
.ehs-reports .ehs-report-card .management-number {
  color: #0563c1;
}

.ehs-button.secondary {
  color: var(--ehs-ink);
  background: #fff;
  border-color: var(--ehs-line);
}

.ehs-button.orange {
  background: var(--ehs-orange);
}

.ehs-button.blue {
  background: var(--ehs-blue);
}

.ehs-button.red {
  background: var(--ehs-red);
}

.ehs-button:disabled {
  opacity: .52;
  cursor: not-allowed;
}

.ehs-side-list,
.ehs-list,
.ehs-board-items {
  display: grid;
  gap: 9px;
}

.ehs-rule {
  padding: 11px;
  background: #f8fbfa;
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
}

.ehs-rule b,
.ehs-rule span {
  display: block;
}

.ehs-rule span {
  margin-top: 3px;
  color: var(--ehs-muted);
  font-size: 12px;
}

.ehs-split {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(380px, 1.05fr);
  gap: 16px;
}

.ehs-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 11px;
  color: var(--ehs-ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
  cursor: pointer;
}

.ehs-list-row:hover,
.ehs-list-row.active {
  border-color: var(--ehs-teal);
  background: #effaf6;
}

.ehs-list-row b,
.ehs-list-row span,
.ehs-list-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ehs-list-row small {
  margin-top: 3px;
  color: var(--ehs-muted);
}

.ehs-status,
.ehs-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 8px;
  color: var(--ehs-muted);
  background: #eef2f7;
  border: 1px solid #d9e2ec;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.ehs-status.high,
.ehs-status.critical,
.ehs-status.serious,
.ehs-status.overdue {
  color: var(--ehs-red);
  background: #fff0ed;
}

.ehs-status.medium,
.ehs-status.needs-review,
.ehs-status.assigned,
.ehs-status.action-assigned {
  color: var(--ehs-amber);
  background: #fff7ed;
}

.ehs-status.low,
.ehs-status.open,
.ehs-status.in-progress,
.ehs-status.in-review,
.ehs-status.pending-review {
  color: var(--ehs-blue);
  background: #e8f1ff;
}

.ehs-status.closed,
.ehs-status.complete,
.ehs-status.completed,
.ehs-status.sent-to-maintenance,
.ehs-status.waiting-on-maintenance {
  color: var(--ehs-green);
  background: #eaf7ef;
}

.ehs-status.training {
  color: var(--ehs-purple);
  background: #f3e8ff;
}

.ehs-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ehs-line);
}

.ehs-detail-head h2 {
  margin: 6px 0 0;
}

.ehs-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ehs-info {
  padding: 10px;
  background: #f8fbfa;
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
}

.ehs-info span {
  display: block;
  color: var(--ehs-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ehs-info b {
  display: block;
  margin-top: 3px;
}

.ehs-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.ehs-board-col {
  min-width: 0;
  padding: 11px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
}

.ehs-board-col h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--ehs-ink);
  font-size: 14px;
}

.ehs-board-card {
  min-width: 0;
  padding: 10px;
  background: #f8fbfa;
  border: 1px solid var(--ehs-line);
  border-radius: 6px;
}

.ehs-board-card b,
.ehs-board-card span,
.ehs-board-card small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ehs-board-card small {
  margin-top: 4px;
  color: var(--ehs-muted);
}

.ehs-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ehs-training-card,
.ehs-action-card {
  padding: 13px;
}

.ehs-training-card h3,
.ehs-action-card h3 {
  margin: 0 0 6px;
  color: var(--ehs-ink);
  font-size: 16px;
}

.ehs-progress {
  height: 9px;
  overflow: hidden;
  background: #dfeae6;
  border-radius: 999px;
}

.ehs-progress span {
  display: block;
  height: 100%;
  background: var(--ehs-green);
}

.ehs-table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
}

.ehs-table {
  width: 100%;
  border-collapse: collapse;
}

.ehs-table th,
.ehs-table td {
  padding: 10px 11px;
  color: var(--ehs-ink);
  border-bottom: 1px solid var(--ehs-line);
  text-align: left;
  white-space: nowrap;
}

.ehs-table th {
  color: var(--ehs-muted);
  background: var(--ehs-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.ehs-empty {
  padding: 16px;
  color: var(--ehs-muted);
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
}

.ehs-ai-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  color: var(--ehs-ink);
  background: #f8fafc;
  border: 1px solid var(--ehs-line);
  border-left: 4px solid var(--ehs-green);
  border-radius: 8px;
}

.ehs-ai-box.blocked {
  background: #fff7ed;
  border-left-color: var(--ehs-red);
}

.ehs-ai-box p,
.ehs-ai-box ul {
  margin: 0;
  color: var(--ehs-muted);
}

.ehs-ai-box li + li {
  margin-top: 6px;
}

.ehs-command-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.ehs-period-control {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
  padding: 9px;
  color: var(--ehs-muted);
  background: var(--ehs-soft);
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.ehs-period-buttons {
  display: flex;
  gap: 4px;
}

.ehs-period-button {
  min-height: 32px;
  padding: 5px 10px;
  color: var(--ehs-ink);
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 5px;
  cursor: pointer;
  font-weight: 800;
}

.ehs-period-button.active {
  color: #fff;
  background: var(--ehs-blue);
  border-color: var(--ehs-blue);
}

.ehs-period-control label {
  display: flex;
  gap: 5px;
  align-items: center;
}

.ehs-period-control input {
  max-width: 136px;
  padding: 6px;
  color: var(--ehs-ink);
  background: #fff;
  border: 1px solid var(--ehs-line);
  border-radius: 5px;
}

.ehs-period-summary {
  margin: 0 0 12px !important;
}

.ehs-command-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  background: var(--ehs-line);
  border: 1px solid var(--ehs-line);
  border-radius: 8px;
}

.ehs-command-stat {
  padding: 14px;
  background: #fff;
}

.ehs-command-stat b,
.ehs-command-stat span {
  display: block;
}

.ehs-command-stat b {
  color: #0563c1;
  font-size: 24px;
}

.ehs-command-stat span {
  color: var(--ehs-muted);
  font-size: 12px;
  font-weight: 800;
}

.ehs-my-work {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.ehs-boundary {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  background: #fff7ed;
  border: 1px solid #f2c078;
  border-left: 4px solid var(--ehs-orange);
  border-radius: 7px;
}

.ehs-training-handoff {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
}

@media (max-width: 1180px) {
  .ehs-header,
  .ehs-grid,
  .ehs-split {
    grid-template-columns: 1fr;
  }

  .ehs-metrics,
  .ehs-board,
  .ehs-grid-3,
  .ehs-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ehs-report-heading {
    grid-template-columns: 1fr;
  }

  .ehs-command-heading,
  .ehs-training-handoff {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ehs-command-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .ehs-body {
    padding: 12px;
  }

  .ehs-header h1 {
    font-size: 24px;
  }

  .ehs-metrics,
  .ehs-form,
  .ehs-check-grid,
  .ehs-info-grid,
  .ehs-board,
  .ehs-grid-3,
  .ehs-report-grid,
  .ehs-report-card .ehs-actions {
    grid-template-columns: 1fr;
  }

  .ehs-list-row,
  .ehs-detail-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ehs-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ehs-command-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ehs-period-control,
  .ehs-period-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .ehs-button {
    width: 100%;
    padding-right: 7px;
    padding-left: 7px;
    white-space: normal;
  }
}

/* V8.3.8 Fix 2: visible EHS submit feedback */
.ehs-form-message { margin: 12px 0; padding: 11px 13px; border-radius: 7px; font-weight: 800; }
.ehs-form-message.error { background: #fff1f0; border: 1px solid #f3b5b0; color: #9f2d20; }
.ehs-form-message.success { background: #edf8f1; border: 1px solid #9ed2b0; color: #166534; }
.ehs-button:disabled { opacity: .65; cursor: wait; }
