/* =============================================================
   TradeRail — Safety Officer Role Dashboard
   Namespace : TradeRailPR_SAFETY
   PR        : Safety Officer Role
   ============================================================= */

/* ── Layout ─────────────────────────────────────────────── */
.trso-shell {
  padding: 24px;
  max-width: 1200px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #e2e8f0;
}
.trso-shell * { box-sizing: border-box; }

/* ── Page header ─────────────────────────────────────────── */
.trso-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.trso-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}
.trso-page-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 2px 0 0;
}
.trso-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────── */
.trso-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.trso-btn:hover { opacity: 0.85; }
.trso-btn-primary   { background: #FF6B00; color: #fff; }
.trso-btn-secondary { background: #1e293b; color: #cbd5e1; border: 1px solid #334155; }
.trso-btn-danger    { background: #7f1d1d; color: #fca5a5; border: 1px solid #991b1b; }
.trso-btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* ── Summary strip ───────────────────────────────────────── */
.trso-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 767px) {
  .trso-summary-strip { grid-template-columns: repeat(2, 1fr); }
}
.trso-stat-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.trso-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--trso-accent, #FF6B00);
  border-radius: 12px 12px 0 0;
}
.trso-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 6px;
}
.trso-stat-value {
  font-size: 32px;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1;
  margin-bottom: 4px;
}
.trso-stat-sub {
  font-size: 12px;
  color: #475569;
}

/* ── Section grid ────────────────────────────────────────── */
.trso-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.trso-grid-full { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .trso-grid { grid-template-columns: 1fr; }
}

/* ── Card ────────────────────────────────────────────────── */
.trso-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 14px;
  overflow: hidden;
}
.trso-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #1e293b;
  gap: 8px;
  flex-wrap: wrap;
}
.trso-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}
.trso-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.trso-card-body { padding: 0; }

/* ── Table ───────────────────────────────────────────────── */
.trso-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.trso-table th {
  text-align: left;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  background: #0d1829;
  border-bottom: 1px solid #1e293b;
}
.trso-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #0f172a;
  color: #cbd5e1;
  vertical-align: middle;
}
.trso-table tr:last-child td { border-bottom: none; }
.trso-table tr:hover td { background: #1e293b40; }
.trso-table-actions { display: flex; gap: 5px; }
.trso-empty-row td {
  text-align: center;
  color: #334155;
  padding: 24px;
  font-style: italic;
}

/* ── Badges ──────────────────────────────────────────────── */
.trso-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.trso-badge-open     { background: #7f1d1d; color: #fca5a5; }
.trso-badge-resolved { background: #14532d; color: #86efac; }
.trso-badge-pending  { background: #451a03; color: #fdba74; }
.trso-badge-in-progress { background: #1e3a5f; color: #93c5fd; }
.trso-badge-critical { background: #7f1d1d; color: #fca5a5; }
.trso-badge-high     { background: #78350f; color: #fcd34d; }
.trso-badge-medium   { background: #1e3a5f; color: #93c5fd; }
.trso-badge-low      { background: #14532d; color: #86efac; }

/* ── Severity dot ────────────────────────────────────────── */
.trso-sev {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.trso-sev-critical { background: #ef4444; }
.trso-sev-high     { background: #f59e0b; }
.trso-sev-medium   { background: #3b82f6; }
.trso-sev-low      { background: #22c55e; }

/* ── Incident list rows ──────────────────────────────────── */
.trso-incident-row-open td { border-left: 3px solid #ef4444; }
.trso-incident-row-resolved td { border-left: 3px solid #22c55e; }

/* ── Crew pulse list ─────────────────────────────────────── */
.trso-crew-list { list-style: none; margin: 0; padding: 0; }
.trso-crew-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #1e293b;
  gap: 10px;
}
.trso-crew-item:last-child { border-bottom: none; }
.trso-crew-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #1e3a5f;
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.trso-crew-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
}
.trso-crew-job {
  font-size: 11px;
  color: #475569;
}
.trso-crew-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}
.trso-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.trso-dot-green  { background: #22c55e; }
.trso-dot-yellow { background: #f59e0b; }
.trso-dot-red    { background: #ef4444; }
.trso-dot-gray   { background: #475569; }

/* ── Quick actions ───────────────────────────────────────── */
.trso-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 767px) {
  .trso-quick-actions { grid-template-columns: repeat(2, 1fr); }
}
.trso-qa-tile {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.trso-qa-tile:hover { background: #263548; border-color: #FF6B00; }
.trso-qa-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid #334155;
}
.trso-qa-label {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.3;
}

/* ── Checklist progress ──────────────────────────────────── */
.trso-progress-bar {
  width: 100%;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.trso-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: #FF6B00;
  transition: width 0.4s;
}
.trso-progress-fill.complete { background: #22c55e; }
.trso-progress-fill.low      { background: #ef4444; }

/* ── Today jobs hero strip ───────────────────────────────── */
.trso-today-strip {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.trso-today-job {
  background: linear-gradient(135deg, #0f1c2d, #152840);
  border: 1px solid #1e3a5f;
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 220px;
  border-top: 3px solid #FF6B00;
}
.trso-today-job-name {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
}
.trso-today-job-addr {
  font-size: 12px;
  color: #475569;
  margin-bottom: 8px;
}
.trso-today-job-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Violations log ──────────────────────────────────────── */
.trso-violation-row-open { background: #1a0d0c40; }

/* ── Filter bar ──────────────────────────────────────────── */
.trso-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.trso-filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #334155;
  background: transparent;
  color: #64748b;
  transition: all 0.15s;
}
.trso-filter-btn.active,
.trso-filter-btn:hover {
  background: #FF6B00;
  border-color: #FF6B00;
  color: #fff;
}

/* ── Modal overlay ───────────────────────────────────────── */
.trso-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.trso-modal {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.trso-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 20px;
}
.trso-form-row { margin-bottom: 14px; }
.trso-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}
.trso-form-input,
.trso-form-select,
.trso-form-textarea {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: #f1f5f9;
  outline: none;
  font-family: inherit;
}
.trso-form-textarea { min-height: 80px; resize: vertical; }
.trso-form-input:focus,
.trso-form-select:focus,
.trso-form-textarea:focus { border-color: #FF6B00; }
.trso-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 767px) {
  .trso-shell { padding: 12px; }
  .trso-page-header { flex-direction: column; align-items: flex-start; }
  .trso-table th, .trso-table td { padding: 8px 10px; }
  .trso-table th:nth-child(n+4),
  .trso-table td:nth-child(n+4) { display: none; }
  .trso-today-strip { flex-direction: column; }
  .trso-today-job { min-width: unset; }
}
