/* ============================================================
   PR371 — Prevailing Wage / Certified Payroll Extension
   TradeRail Field Portal
   Build marker: pr371-prevailing-wage:2026-06-20
   ============================================================ */

/* ─── Variables ───────────────────────────────────────────── */
:root {
  --pr371-color-draft:      #6b7280;
  --pr371-color-certified:  #2563eb;
  --pr371-color-submitted:  #16a34a;
  --pr371-color-flagged:    #dc2626;
  --pr371-color-surface:    #ffffff;
  --pr371-color-border:     #e5e7eb;
  --pr371-color-text:       #111827;
  --pr371-color-text-muted: #6b7280;
  --pr371-color-accent:     #1e40af;
  --pr371-color-warn-bg:    #fef2f2;
  --pr371-radius:           6px;
  --pr371-radius-chip:      999px;
  --pr371-shadow:           0 1px 3px rgba(0,0,0,0.1);
}

/* ─── Shared Panel Shell ─────────────────────────────────── */
.pr371-wage-rate-panel,
.pr371-tracker-panel {
  background: var(--pr371-color-surface);
  border: 1px solid var(--pr371-color-border);
  border-radius: var(--pr371-radius);
  box-shadow: var(--pr371-shadow);
  padding: 20px;
  margin-bottom: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--pr371-color-text);
}

.pr371-panel-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--pr371-color-border);
  padding-bottom: 12px;
}

.pr371-panel-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--pr371-color-text);
}

.pr371-panel-subtitle {
  font-size: 13px;
  color: var(--pr371-color-text-muted);
  margin: 0;
}

/* ─── Table Wrap ─────────────────────────────────────────── */
.pr371-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

.pr371-wage-table,
.pr371-wh347-header-table,
.pr371-wh347-worker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pr371-wage-table th,
.pr371-wage-table td,
.pr371-wh347-header-table th,
.pr371-wh347-header-table td,
.pr371-wh347-worker-table th,
.pr371-wh347-worker-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--pr371-color-border);
  vertical-align: top;
}

.pr371-wage-table thead th,
.pr371-wh347-col-header th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--pr371-color-text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.pr371-rate-row:hover,
.pr371-wh347-worker-row:hover {
  background: #f3f4f6;
}

.pr371-table-empty {
  color: var(--pr371-color-text-muted);
  text-align: center;
  padding: 24px 0;
}

.pr371-table-note {
  font-size: 12px;
  color: var(--pr371-color-text-muted);
  margin: 0 0 12px;
}

/* ─── Inline Edit Form ───────────────────────────────────── */
.pr371-inline-edit-form {
  background: #f9fafb;
  border: 1px solid var(--pr371-color-border);
  border-radius: var(--pr371-radius);
  padding: 16px;
  margin-top: 12px;
}

.pr371-field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 13px;
}

.pr371-input {
  display: block;
  width: 140px;
  padding: 6px 10px;
  border: 1px solid var(--pr371-color-border);
  border-radius: var(--pr371-radius);
  font-size: 14px;
  margin-top: 4px;
}

.pr371-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ─── Buttons ────────────────────────────────────────────── */
.pr371-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--pr371-radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.pr371-btn--primary {
  background: var(--pr371-color-accent);
  color: #fff;
  border-color: var(--pr371-color-accent);
}
.pr371-btn--primary:hover {
  background: #1e3a8a;
}

.pr371-btn--secondary {
  background: #fff;
  color: var(--pr371-color-accent);
  border-color: var(--pr371-color-border);
}
.pr371-btn--secondary:hover {
  background: #eff6ff;
}

.pr371-btn--warn {
  background: var(--pr371-color-flagged);
  color: #fff;
  border-color: var(--pr371-color-flagged);
}
.pr371-btn--warn:hover {
  background: #b91c1c;
}

.pr371-btn--sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ─── Status Chips ───────────────────────────────────────── */
.pr371-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--pr371-radius-chip);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pr371-chip--draft {
  background: #f3f4f6;
  color: var(--pr371-color-draft);
  border: 1px solid #d1d5db;
}

.pr371-chip--certified {
  background: #eff6ff;
  color: var(--pr371-color-certified);
  border: 1px solid #bfdbfe;
}

.pr371-chip--submitted {
  background: #f0fdf4;
  color: var(--pr371-color-submitted);
  border: 1px solid #bbf7d0;
}

.pr371-chip--flagged {
  background: var(--pr371-color-warn-bg);
  color: var(--pr371-color-flagged);
  border: 1px solid #fecaca;
}

/* ─── Weekly Tracker ─────────────────────────────────────── */
.pr371-tracker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pr371-tracker-row {
  border: 1px solid var(--pr371-color-border);
  border-radius: var(--pr371-radius);
  padding: 12px 14px;
  background: #fff;
  transition: background 0.1s;
}

.pr371-tracker-row[data-status="flagged"] {
  border-color: #fca5a5;
  background: var(--pr371-color-warn-bg);
}

.pr371-tracker-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pr371-tracker-week-label {
  font-weight: 600;
  flex: 1;
  min-width: 180px;
}

.pr371-tracker-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.pr371-correction-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--pr371-color-flagged);
  padding: 6px 10px;
  background: #fef2f2;
  border-radius: var(--pr371-radius);
}

.pr371-correction-label {
  font-weight: 700;
}

.pr371-tracker-empty {
  color: var(--pr371-color-text-muted);
  padding: 24px 0;
  text-align: center;
}

/* ─── WH-347 Modal ───────────────────────────────────────── */
.pr371-wh347-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
}

.pr371-wh347-modal-content {
  background: #fff;
  border-radius: var(--pr371-radius);
  max-width: 960px;
  width: 100%;
  padding: 24px;
  position: relative;
}

.pr371-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 1px solid var(--pr371-color-border);
  border-radius: var(--pr371-radius);
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--pr371-color-text-muted);
}
.pr371-modal-close:hover {
  background: #f3f4f6;
}

/* ─── WH-347 Print Form ──────────────────────────────────── */
.pr371-wh347-form {
  font-family: "Times New Roman", Times, serif;
  font-size: 12px;
  color: #000;
}

.pr371-wh347-title-bar {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #000;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.pr371-wh347-form-number {
  font-weight: 700;
  font-size: 13px;
}

.pr371-wh347-form-title {
  font-size: 12px;
  color: #444;
}

.pr371-wh347-header-table {
  margin-bottom: 12px;
}

.pr371-wh347-label {
  font-weight: 700;
  background: #f5f5f5;
  white-space: nowrap;
  width: 160px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pr371-wh347-value {
  border-bottom: 1px solid #ccc;
  padding-bottom: 2px;
}

.pr371-wh347-worker-section {
  overflow-x: auto;
  margin-bottom: 16px;
}

.pr371-wh347-col-header th {
  font-size: 10px;
  text-transform: uppercase;
  background: #f5f5f5;
  padding: 4px 6px;
}

.pr371-wh347-worker-row td {
  font-size: 11px;
  padding: 4px 6px;
  vertical-align: top;
}

.pr371-wh347-compliance {
  border-top: 2px solid #000;
  padding-top: 12px;
  margin-top: 12px;
}

.pr371-wh347-section-title {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 8px;
}

.pr371-wh347-compliance-text {
  font-size: 11px;
  line-height: 1.5;
  margin: 0 0 12px;
}

.pr371-wh347-soc-fields {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pr371-wh347-soc-item {
  font-size: 11px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 4px;
  min-width: 200px;
}

.pr371-wh347-disclaimer {
  font-size: 10px;
  color: #666;
  font-style: italic;
  margin: 8px 0 0;
}

.pr371-wh347-print-note {
  font-size: 11px;
  color: #888;
  text-align: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed #ccc;
}

.pr371-wh347-empty,
.pr371-access-denied {
  color: var(--pr371-color-text-muted);
  padding: 24px;
  text-align: center;
  font-size: 14px;
}

/* ─── TRai Insight Bar ───────────────────────────────────── */
.pr371-trai-bar {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--pr371-radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.pr371-trai-bar-header {
  margin-bottom: 4px;
}

.pr371-trai-label {
  color: var(--pr371-color-accent);
  font-size: 13px;
}

.pr371-trai-insight {
  color: var(--pr371-color-text);
  margin-bottom: 6px;
}

.pr371-trai-disclaimer {
  font-size: 11px;
  color: var(--pr371-color-text-muted);
  font-style: italic;
}

/* ─── Print overrides ────────────────────────────────────── */
@media print {
  .pr371-tracker-panel,
  .pr371-wage-rate-panel,
  .pr371-trai-bar {
    display: none;
  }

  .pr371-wh347-form {
    font-size: 11px;
  }

  .pr371-wh347-modal {
    position: static;
    background: none;
    padding: 0;
  }

  .pr371-wh347-modal-content {
    box-shadow: none;
    padding: 0;
  }

  .pr371-modal-close,
  .pr371-btn {
    display: none;
  }
}
