/* ── ConsignmentOwner Stats Dashboard ── */

.csp-wrap * { box-sizing: border-box; }

.csp-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a2e;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* Cards */
.csp-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.csp-card h4 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

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

.csp-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #4f46e5;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e7ff;
}

/* Form */
.csp-form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.csp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.csp-field label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.csp-field input[type=text],
.csp-field select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #f9fafb;
  outline: none;
  transition: border-color .15s;
}

.csp-field input[type=text]:focus,
.csp-field select:focus {
  border-color: #4f46e5;
  background: #fff;
}

/* File inputs */
.csp-upload-note {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 16px;
}

.csp-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.csp-file-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.csp-file-field label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.csp-file-field input[type=file] {
  font-size: 13px;
  color: #374151;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f9fafb;
  cursor: pointer;
}

.csp-file-hint {
  font-size: 11px;
  color: #9ca3af;
}

.csp-badge {
  background: #ede9fe;
  color: #5b21b6;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Buttons */
.csp-upload-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.csp-btn-primary {
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.csp-btn-primary:hover { background: #4338ca; }
.csp-btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }

.csp-btn-secondary {
  background: #fff;
  color: #4f46e5;
  border: 1px solid #4f46e5;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.csp-btn-secondary:hover { background: #ede9fe; }

/* Status / alerts */
.csp-status {
  font-size: 13px;
  color: #6b7280;
}

.csp-alert {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}

.csp-alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.csp-alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Season selector */
.csp-selector-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.csp-selector-row .csp-card-title { margin: 0; }

.csp-season-select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  min-width: 220px;
}

/* Season label */
.csp-season-label {
  font-size: 22px;
  font-weight: 700;
  color: #4f46e5;
  margin-bottom: 16px;
}

/* KPI Row */
.csp-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.csp-kpi {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.csp-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.csp-kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.csp-kpi-sub {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}

/* Chart grids */
.csp-chart-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .csp-chart-grid-2 { grid-template-columns: 1fr; }
}

canvas {
  max-width: 100%;
}

/* Consignor tables */
.csp-table-wrap {
  overflow-x: auto;
}

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

.csp-table th {
  background: #f3f4f6;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  border-bottom: 1px solid #e5e7eb;
}

.csp-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.csp-table tr:last-child td { border-bottom: none; }

.csp-table tr:nth-child(even) td { background: #f9fafb; }

.csp-pct-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.csp-bar-bg {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.csp-bar-fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 4px;
  transition: width .3s;
}

.csp-bar-fill.low { background: #f59e0b; }
.csp-bar-fill.very-low { background: #ef4444; }

/* Chart note */
.csp-chart-note {
  font-size: 12px;
  color: #9ca3af;
  margin: -8px 0 12px;
}

.csp-sub {
  font-size: 12px;
  font-weight: 400;
  color: #9ca3af;
}

/* Industry placeholder */
.csp-industry-placeholder {
  background: #f8fafc;
  border-style: dashed;
  text-align: center;
  padding: 40px;
}

.csp-industry-placeholder h3 {
  color: #6b7280;
  margin: 0 0 10px;
}

.csp-industry-placeholder p {
  color: #9ca3af;
  font-size: 14px;
  max-width: 600px;
  margin: 0 auto;
}

/* ── Return visit panel ── */
.csp-return-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.csp-return-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.csp-btn-link {
  background: none;
  border: none;
  color: #4f46e5;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.csp-btn-link:hover { color: #4338ca; }

/* ── Save data row ── */
.csp-save-row {
  margin: 16px 0 20px;
  padding: 14px 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
}

.csp-save-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.csp-save-label input[type=checkbox] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: #4f46e5;
}

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

.csp-save-text strong { color: #111827; }
.csp-save-text em { color: #6b7280; font-style: normal; display: block; margin-top: 4px; }

/* ── Pie chart centering ── */
.csp-pie-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 300px;
}

.csp-pie-wrap canvas {
  max-height: 280px !important;
  max-width: 280px !important;
}
.csp-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6b7280;
  font-size: 14px;
  padding: 16px 0;
}

.csp-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: csp-spin .7s linear infinite;
}

@keyframes csp-spin { to { transform: rotate(360deg); } }

.csp-partner-hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
  display: block;
}
