/**
 * PR338 — Lily Dispute Shield
 * CSS: TradeRail Field Portal
 * TradeRail orange: #FF6B00
 * Lily bar: border-left: 4px solid #7C3AED; background: #f5f0ff
 * No emoji anywhere
 */

/* ── Main Container ─────────────────────────────────────────────────────── */
.dispute-shield-panel {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 0;
  margin: 0 0 24px 0;
  overflow: hidden;
}

.dispute-shield-project {
  border-bottom: 1px solid #e5e7eb;
  padding: 0 0 16px 0;
  margin-bottom: 0;
}

.dispute-shield-project:last-child {
  border-bottom: none;
}

/* ── Dispute Shield Toggle Header ─────────────────────────────────────────── */
.dispute-shield-toggle {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
}

.dispute-shield-toggle.ds-active {
  background: #fef3f2;
  border-left: 4px solid #FF6B00;
}

.dispute-shield-toggle.ds-off {
  background: #f9fafb;
  border-left: 4px solid #d1d5db;
}

.ds-toggle-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.ds-toggle-state {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}

.ds-state-active {
  background: #FF6B00;
  color: #ffffff;
}

.ds-state-off {
  background: #e5e7eb;
  color: #6b7280;
}

.ds-project-name {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  -webkit-flex: 1;
  flex: 1;
}

.ds-dispute-type {
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 12px;
  font-style: italic;
}

/* ── Lily Insight Bar ────────────────────────────────────────────────────── */
.lily-insight-bar {
  border-left: 4px solid #7C3AED;
  background: #f5f0ff;
  padding: 10px 16px;
  margin: 12px 20px;
  border-radius: 0 6px 6px 0;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  gap: 10px;
}

.lily-insight-tier {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7C3AED;
  white-space: nowrap;
  padding-top: 1px;
}

.lily-insight-text {
  font-size: 13px;
  color: #3b0764;
  line-height: 1.5;
}

/* ── Dollar Impact ────────────────────────────────────────────────────────── */
.dollar-impact {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  margin: 4px 0;
  background: #fff7ed;
  border-left: 3px solid #FF6B00;
  margin-left: 20px;
  margin-right: 20px;
  border-radius: 0 6px 6px 0;
}

.dollar-impact-label {
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dollar-impact-value {
  font-size: 20px;
  font-weight: 700;
  color: #FF6B00;
}

/* Hidden for field_tech and foreman via role class on body */
body.role-field_tech .dollar-impact,
body.role-foreman .dollar-impact {
  display: none !important;
}

/* ── Filter Bar ───────────────────────────────────────────────────────────── */
.ds-filter-bar {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 12px;
  -webkit-align-items: center;
  align-items: center;
  padding: 10px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
  color: #374151;
}

.ds-filter-bar label {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.ds-filter-date-start,
.ds-filter-date-end {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  color: #111827;
  background: #ffffff;
}

.ds-filter-type {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  color: #111827;
  background: #ffffff;
}

/* ── Evidence Timeline ────────────────────────────────────────────────────── */
.dispute-timeline {
  padding: 8px 20px;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 4px;
}

.dispute-evidence-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  transition: background 0.15s ease;
}

.dispute-evidence-row:hover {
  background: #f0f9ff;
}

.dispute-evidence-row-gap {
  background: #fef2f2;
  border-color: #fca5a5;
}

.dispute-evidence-row-gap:hover {
  background: #fee2e2;
}

.evidence-date {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  min-width: 90px;
  font-family: 'Courier New', Courier, monospace;
}

.evidence-label {
  -webkit-flex: 1;
  flex: 1;
  font-weight: 500;
  color: #111827;
}

.evidence-label a {
  color: #1d4ed8;
  text-decoration: none;
}

.evidence-label a:hover {
  text-decoration: underline;
}

.evidence-note {
  font-size: 12px;
  color: #6b7280;
  min-width: 160px;
  text-align: right;
}

/* ── Evidence Badges ─────────────────────────────────────────────────────── */
.evidence-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.evidence-badge-daily_report {
  background: #dbeafe;
  color: #1e40af;
}

.evidence-badge-photo {
  background: #d1fae5;
  color: #065f46;
}

.evidence-badge-rfi {
  background: #fef3c7;
  color: #92400e;
}

.evidence-badge-co {
  background: #ede9fe;
  color: #5b21b6;
}

.evidence-badge-pay_app {
  background: #fff7ed;
  color: #c2410c;
}

.evidence-badge-comm,
.evidence-badge-communication {
  background: #f0fdf4;
  color: #166534;
}

.evidence-badge-time {
  background: #f5f3ff;
  color: #6d28d9;
}

.evidence-badge-delivery {
  background: #fdf4ff;
  color: #7e22ce;
}

.evidence-badge-inspection {
  background: #ecfdf5;
  color: #065f46;
}

.evidence-badge-field_flag {
  background: #fff1f2;
  color: #be123c;
}

.evidence-badge-manual {
  background: #f1f5f9;
  color: #475569;
}

/* ── Gap Badge ───────────────────────────────────────────────────────────── */
.gap-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  white-space: nowrap;
}

/* ── Action Bar & Buttons ─────────────────────────────────────────────────── */
.ds-action-bar {
  display: -webkit-flex;
  display: flex;
  gap: 10px;
  padding: 12px 20px 8px 20px;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

/* Generate Package button — TradeRail orange */
.evidence-package-btn {
  background: #FF6B00;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  letter-spacing: 0.02em;
}

.evidence-package-btn:hover {
  background: #e05f00;
}

.evidence-package-btn.ds-btn-confirming {
  background: #b45309;
  outline: 2px solid #FF6B00;
}

/* Draft Letter button */
.letter-draft-btn {
  background: #7C3AED;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  letter-spacing: 0.02em;
}

.letter-draft-btn:hover {
  background: #6d28d9;
}

.letter-draft-btn.ds-btn-confirming {
  background: #5b21b6;
  outline: 2px solid #7C3AED;
}

/* Add Manual Entry button */
.ds-add-entry-btn {
  background: #ffffff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  letter-spacing: 0.02em;
}

.ds-add-entry-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.ds-add-entry-btn.ds-btn-confirming {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
}

/* ── Shared button disabled state ─────────────────────────────────────────── */
.evidence-package-btn:disabled,
.letter-draft-btn:disabled,
.ds-add-entry-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .dispute-shield-toggle {
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 6px;
  }

  .ds-filter-bar {
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: flex-start;
    align-items: flex-start;
  }

  .dispute-evidence-row {
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
  }

  .evidence-note {
    text-align: left;
    min-width: 0;
    width: 100%;
  }

  .ds-action-bar {
    -webkit-flex-direction: column;
    flex-direction: column;
  }
}
