/* ============================================================
   PR343 — Lily CO Win Rate Tracking
   CO Intelligence Dashboard Styles
   TradeRail Field Portal
   Build marker: pr343-co-intelligence:2026-06-19

   No emoji. Tenant-neutral. ES5 IIFE companion.
   ============================================================ */

/* ── Module Container ─────────────────────────────────────────────────── */
.pr343-co-intelligence {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  background: #ffffff;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #1a1a2e;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.pr343-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 12px;
}

.pr343-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.pr343-advisory-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7C3AED;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  padding: 3px 10px;
  border-radius: 12px;
}

/* ── Summary Strip ────────────────────────────────────────────────────── */
.pr343-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .pr343-summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .pr343-summary-strip {
    grid-template-columns: 1fr;
  }
}

.pr343-metric-tile {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pr343-metric-label {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr343-metric-value {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
}

.pr343-metric-sub {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

/* ── Period Selector ──────────────────────────────────────────────────── */
.pr343-period-selector {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pr343-period-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pr343-period-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.pr343-period-btn.pr343-period-btn--active {
  background: #7C3AED;
  border-color: #7C3AED;
  color: #ffffff;
}

/* ── Per-GC Table ─────────────────────────────────────────────────────── */
.pr343-gc-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

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

.pr343-gc-table thead {
  background: #f3f4f6;
}

.pr343-gc-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.pr343-gc-table th[data-sort]:hover {
  background: #e9eaec;
}

.pr343-gc-table th.pr343-sorted-asc::after {
  content: " \25B2";
  font-size: 10px;
}

.pr343-gc-table th.pr343-sorted-desc::after {
  content: " \25BC";
  font-size: 10px;
}

.pr343-gc-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
}

.pr343-gc-table tbody tr:last-child td {
  border-bottom: none;
}

.pr343-gc-row {
  cursor: pointer;
  transition: background 0.1s;
}

.pr343-gc-row:hover {
  background: #f9fafb;
}

.pr343-gc-row.pr343-gc-row--expanded {
  background: #f5f3ff;
}

.pr343-limited-data {
  color: #9ca3af;
  font-style: italic;
  font-size: 12px;
}

/* ── GC Reason Code Breakdown (expanded row) ──────────────────────────── */
.pr343-gc-breakdown {
  background: #fdfcff;
  border-top: 1px solid #ddd6fe;
  padding: 16px 14px;
}

.pr343-gc-breakdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.pr343-gc-breakdown th {
  color: #6b7280;
  font-weight: 600;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.pr343-gc-breakdown td {
  padding: 6px 10px;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}

/* ── Reason Code Chart ────────────────────────────────────────────────── */
.pr343-chart-section {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}

.pr343-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 14px 0;
}

.pr343-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pr343-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pr343-bar-label {
  min-width: 160px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.pr343-bar-track {
  flex: 1;
  background: #e5e7eb;
  border-radius: 4px;
  height: 16px;
  overflow: hidden;
}

.pr343-bar-fill {
  height: 100%;
  background: #7C3AED;
  border-radius: 4px;
  min-width: 2px;
  transition: width 0.3s ease;
}

.pr343-bar-pct {
  min-width: 46px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-align: right;
}

.pr343-bar-count {
  font-size: 11px;
  color: #9ca3af;
  min-width: 40px;
}

/* ── Win Rate Trend Line ──────────────────────────────────────────────── */
.pr343-trend-section {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}

.pr343-trend-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pr343-trend-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.pr343-trend-label {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.pr343-trend-label--improving {
  background: #dcfce7;
  color: #15803d;
}

.pr343-trend-label--declining {
  background: #fee2e2;
  color: #b91c1c;
}

.pr343-trend-label--flat,
.pr343-trend-label--stable {
  background: #f3f4f6;
  color: #6b7280;
}

.pr343-trend-placeholder {
  color: #9ca3af;
  font-size: 13px;
  font-style: italic;
  padding: 20px 0;
  text-align: center;
}

/* ── Lily Detected Split ──────────────────────────────────────────────── */
.pr343-lily-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .pr343-lily-split {
    grid-template-columns: 1fr;
  }
}

.pr343-lily-split-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}

.pr343-lily-split-panel--lily {
  border-left: 4px solid #7C3AED;
}

.pr343-lily-split-panel--manual {
  border-left: 4px solid #d1d5db;
}

.pr343-lily-split-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 10px 0;
}

.pr343-lily-split-stat {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
  padding: 4px 0;
  border-bottom: 1px solid #f3f4f6;
}

.pr343-lily-split-stat:last-child {
  border-bottom: none;
}

.pr343-lily-split-stat-val {
  font-weight: 600;
  color: #111827;
}

/* ── Lily Advisory / Insight Bar ──────────────────────────────────────── */
.pr343-lily-bar {
  border-left: 4px solid #7C3AED;
  background: #f5f3ff;
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pr343-lily-label {
  color: #7C3AED;
  font-weight: 700;
  font-size: 13px;
}

.pr343-lily-text {
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
}

.pr343-advisory-disclaimer {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.4;
  margin-top: 4px;
}

/* ── Resubmission Suggestion Cards ───────────────────────────────────── */
.pr343-resubmission-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pr343-resubmission-card {
  border-left: 4px solid #FF6B00;
  background: #fff7ed;
  border-radius: 0 6px 6px 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pr343-resubmission-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #c2410c;
}

.pr343-resubmission-card-body {
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
}

.pr343-resubmission-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pr343-resub-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pr343-resub-btn--primary {
  background: #FF6B00;
  color: #ffffff;
}

.pr343-resub-btn--primary:hover {
  background: #ea5e00;
}

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

.pr343-resub-btn--secondary:hover {
  background: #e5e7eb;
}

/* ── Two-tap confirm pattern ──────────────────────────────────────────── */
.pr343-confirm-step {
  display: none;
  align-items: center;
  gap: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
  flex-wrap: wrap;
}

.pr343-confirm-step.pr343-confirm-step--visible {
  display: flex;
}

.pr343-confirm-btn {
  padding: 4px 12px;
  border-radius: 5px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pr343-confirm-btn--yes {
  background: #FF6B00;
  color: #fff;
}

.pr343-confirm-btn--no {
  background: #e5e7eb;
  color: #374151;
}

/* ── Access Denied State ──────────────────────────────────────────────── */
.pr343-access-denied {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
}

/* ── Empty / Placeholder States ───────────────────────────────────────── */
.pr343-empty-state {
  padding: 30px 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  font-style: italic;
}

/* ── Section Labels ───────────────────────────────────────────────────── */
.pr343-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

/* ── Sub-tab / Navigation ─────────────────────────────────────────────── */
.pr343-subtab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 20px;
}

.pr343-subtab-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.pr343-subtab-btn:hover {
  color: #374151;
}

.pr343-subtab-btn.pr343-subtab-btn--active {
  color: #7C3AED;
  border-bottom-color: #7C3AED;
  font-weight: 600;
}

/* ── Profile Warm Indicator ───────────────────────────────────────────── */
.pr343-profile-warm {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
  vertical-align: middle;
}

.pr343-profile-cold {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Win Rate Value Coloring ──────────────────────────────────────────── */
.pr343-winrate-high {
  color: #15803d;
  font-weight: 700;
}

.pr343-winrate-mid {
  color: #b45309;
  font-weight: 700;
}

.pr343-winrate-low {
  color: #b91c1c;
  font-weight: 700;
}

/* ── Responsive Utility ───────────────────────────────────────────────── */
.pr343-hide-mobile {
  display: table-cell;
}

@media (max-width: 640px) {
  .pr343-hide-mobile {
    display: none;
  }
}
