/**
 * PR372 — Lien Waiver Workflow Extension
 * TradeRail Field Portal
 * ES5-safe CSS — no CSS variables requiring JS polyfills
 */

/* ─── Overlay / Modal ─────────────────────────────────────────────────────── */

.pr372-overlay {
  position: fixed;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.48);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pr372-modal {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.pr372-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.pr372-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.pr372-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

.pr372-close-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.pr372-modal-body {
  padding: 20px 24px 24px;
  flex: 1;
}

.pr372-modal-desc {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 16px;
  line-height: 1.5;
}

/* ─── Tracker Panel ───────────────────────────────────────────────────────── */

.pr372-tracker {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px 20px;
}

.pr372-tracker-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pr372-tracker-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  flex: 1;
}

/* ─── Status Chips ────────────────────────────────────────────────────────── */

.pr372-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr372-chip-pending {
  background: #fef3c7;
  color: #92400e;
}

.pr372-chip-sent {
  background: #dbeafe;
  color: #1e40af;
}

.pr372-chip-received {
  background: #d1fae5;
  color: #065f46;
}

.pr372-chip-overdue {
  background: #fee2e2;
  color: #991b1b;
}

/* ─── TRai Insight Bar ────────────────────────────────────────────────────── */

.pr372-trai-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #78350f;
}

.pr372-trai-icon {
  font-size: 11px;
  font-weight: 700;
  background: #f59e0b;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.pr372-trai-msg {
  flex: 1;
  font-weight: 500;
}

/* ─── Tables ──────────────────────────────────────────────────────────────── */

.pr372-tracker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pr372-tracker-table th,
.pr372-tracker-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.pr372-tracker-table th {
  font-weight: 600;
  color: #6b7280;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f9fafb;
}

.pr372-tracker-table tbody tr:hover {
  background: #f9fafb;
}

.pr372-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Bulk Panel ──────────────────────────────────────────────────────────── */

.pr372-bulk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 320px;
  overflow-y: auto;
}

.pr372-bulk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #374151;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
}

.pr372-bulk-item:hover {
  background: #f9fafb;
}

.pr372-bulk-cb {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── Form Fields ─────────────────────────────────────────────────────────── */

.pr372-field {
  margin-bottom: 14px;
}

.pr372-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr372-select,
.pr372-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #111827;
  background: #ffffff;
}

.pr372-select:focus,
.pr372-input:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  border-color: #3b82f6;
}

.pr372-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #111827;
  background: #ffffff;
  resize: vertical;
}

.pr372-textarea:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  border-color: #3b82f6;
}

/* ─── Panel Actions ───────────────────────────────────────────────────────── */

.pr372-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.pr372-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.12s;
}

.pr372-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pr372-btn:hover:not(:disabled) {
  opacity: 0.88;
}

.pr372-btn-primary {
  background: #1d4ed8;
  color: #ffffff;
}

.pr372-btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.pr372-btn-success {
  background: #059669;
  color: #ffffff;
}

.pr372-btn-warning {
  background: #d97706;
  color: #ffffff;
}

.pr372-btn-danger {
  background: #dc2626;
  color: #ffffff;
}

.pr372-btn-sm {
  font-size: 12px;
  padding: 5px 12px;
}

.pr372-btn-xs {
  font-size: 11px;
  padding: 3px 8px;
}

/* ─── Access Denied ───────────────────────────────────────────────────────── */

.pr372-access-denied {
  padding: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 13px;
  color: #991b1b;
}

/* ─── Empty States ────────────────────────────────────────────────────────── */

.pr372-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}

/* ─── Toast ───────────────────────────────────────────────────────────────── */

.pr372-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.pr372-toast--info    { background: #1d4ed8; color: #ffffff; }
.pr372-toast--success { background: #059669; color: #ffffff; }
.pr372-toast--error   { background: #dc2626; color: #ffffff; }
.pr372-toast--warning { background: #d97706; color: #ffffff; }

/* ─── Hint / Advisory ─────────────────────────────────────────────────────── */

.pr372-hint {
  font-size: 12px;
  color: #6b7280;
  margin: 4px 0 0;
  line-height: 1.5;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .pr372-modal {
    max-width: 100vw;
    border-radius: 0;
    max-height: 100vh;
  }
  .pr372-tracker-table th,
  .pr372-tracker-table td {
    font-size: 11px;
    padding: 6px 6px;
  }
  .pr372-tracker-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .pr372-panel-actions {
    flex-direction: column;
  }
}
