/* Dashboard Styles */

.dashboard {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 0;
}

/* KPI Strip */
.dash-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 280px));
  gap: 10px;
  margin-bottom: 24px;
}

.dash-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}

.dash-kpi-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.dash-kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.dash-kpi-value {
  font-size: 22px;
  font-weight: 700;
}

.dash-kpi-sub {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.3;
}

.dash-kpi-card--oos {
  border-color: #fca5a5;
}

.dash-kpi-delta {
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Section */
.dash-section {
  margin-bottom: 24px;
}

.dash-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* Tab Cards */
.dash-tab-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 280px));
  gap: 10px;
  margin-bottom: 16px;
}

.dash-tab-card {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
}

.dash-tab-card.active {
  border-width: 2px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.dash-tab-card--purple.active {
  border-color: var(--purple);
}

.dash-tab-card--purple.active .dash-tab-header,
.dash-tab-card--purple.active .dash-tab-count {
  color: var(--purple);
}

.dash-tab-card--amber.active {
  border-color: var(--amber);
}

.dash-tab-card--amber.active .dash-tab-header,
.dash-tab-card--amber.active .dash-tab-count {
  color: var(--amber);
}

.dash-tab-card--orange.active {
  border-color: var(--accent);
}

.dash-tab-card--orange.active .dash-tab-header,
.dash-tab-card--orange.active .dash-tab-count {
  color: var(--accent);
}

.dash-tab-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.dash-tab-count {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.dash-tab-summary {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Tab Content */
.dash-tab-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

/* Table Styles */
.dash-table-wrapper {
  overflow-x: auto;
}

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

.dash-table thead tr {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.dash-table th {
  padding: 12px 20px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--light);
  text-align: left;
}

.dash-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

.dash-table tbody tr:hover {
  background: var(--surface-alt);
}

.dash-table-footer {
  padding: 14px 20px;
  background: var(--surface-alt);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

/* Deadline Grid */
.dash-deadline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 20px;
}

.dash-deadline-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--surface);
  transition: box-shadow 0.15s;
}

.dash-deadline-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.dash-deadline--critical {
  border-color: var(--red);
  background: #fef8f7;
}

.dash-deadline--urgent {
  border-color: var(--amber);
  background: #fffdf7;
}

.dash-deadline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.dash-deadline-pattern {
  font-size: 14px;
  font-weight: 700;
}

.dash-deadline-days {
  font-size: 20px;
  font-weight: 800;
}

.dash-deadline-stats {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

/* Progress Bar */
.dash-progress-row {
  margin-bottom: 6px;
}

.dash-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-bottom: 3px;
}

.dash-progress-pct {
  font-weight: 700;
}

.dash-progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border-light);
  overflow: hidden;
}

.dash-progress-fill {
  height: 100%;
  border-radius: 3px;
  opacity: 0.7;
}

/* State 1: In Season + Ordered (Monitoring) */
.dash-deadline--in-season-ordered {
  border-color: var(--green);
  background: #f0fdf4;
}

/* State 2: In Season + Not Ordered (Problem) */
.dash-deadline--in-season-problem {
  border-color: var(--red);
  background: #fef8f7;
}

/* State 3: Upcoming + Ordered (Confirmed) */
.dash-deadline--upcoming-ordered {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.dash-ordered-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-badge--green {
  background: #dcfce7;
  color: var(--green);
  font-size: 9px;
  vertical-align: middle;
  margin-left: 6px;
}

/* Progress bar large variant (8px for in-season bars) */
.dash-progress-bar--lg {
  height: 8px;
  border-radius: 4px;
}

/* Season progress fill (blue gradient) */
.dash-progress-fill--season {
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  opacity: 1;
}

/* Date labels below progress bars */
.dash-progress-dates {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--light);
  margin-top: 2px;
}

/* Sell-through health banners */
.dash-health-banner {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 10px;
}

.dash-health--on_track {
  background: #f0fdf4;
  color: var(--green);
}

.dash-health--ahead {
  background: #fffbeb;
  color: var(--amber);
}

.dash-health--behind {
  background: #fef2f2;
  color: var(--red);
}

/* Warning banner (in-season not ordered) */
.dash-warning-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 10px;
  background: #fef2f2;
  color: var(--red);
}

/* Attribution row (ordered cards) */
.dash-deadline-attribution {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.dash-btn-mark-ordered {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
  color: #6b6b6b;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
}

.dash-btn-mark-ordered:hover {
  background: #f0fdf4;
  border-color: var(--green);
  color: var(--green);
}

.dash-undo-link {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 10px;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s;
}

.dash-undo-link:hover {
  color: var(--red);
}

.dash-badge--blue {
  background: #dbeafe;
  color: #2563eb;
  font-size: 9px;
  vertical-align: middle;
  margin-left: 6px;
}

/* LIVE badge for compact deadline list */
.dash-countdown--live {
  background: #dbeafe;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
}

/* Empty State */
.dash-empty-tab {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Insight Row */
.dash-insight-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.dash-insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.dash-insight-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-insight-title {
  font-size: 13px;
  font-weight: 700;
}

/* Sales Trend Chart */
.dash-trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px 16px 8px;
  height: 120px;
}

.dash-trend-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.dash-trend-bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
}

.dash-trend-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: opacity 0.15s;
  cursor: default;
}

.dash-trend-bar--cy { background: #3b82f6; }
.dash-trend-bar--py { background: #e0dfdb; }

.dash-trend-day:hover .dash-trend-bar { opacity: 0.75; }

.dash-trend-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--light);
  text-transform: uppercase;
}

/* Gross / Net Toggle */
.dash-trend-toggle {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.dash-trend-toggle-btn {
  padding: 3px 10px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  color: var(--muted);
  transition: all 0.15s;
}

.dash-trend-toggle-btn--active {
  background: var(--ink);
  color: #fff;
}

.dash-trend-legend {
  display: flex;
  gap: 12px;
  padding: 0 16px 10px;
  font-size: 10px;
  color: var(--light);
}

.dash-trend-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-trend-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.dash-trend-swatch--cy { background: #3b82f6; }
.dash-trend-swatch--py { background: #e0dfdb; }

.dash-trend-day-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}
.dash-trend-day-link:hover { text-decoration: underline; }

/* Mini Table */
.dash-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.dash-mini-table th {
  padding: 8px 16px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--light);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.dash-mini-table td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
}

.dash-mini-table tbody tr:hover {
  background: var(--surface-alt);
}

.dash-mini-footer {
  padding: 10px 16px;
  background: var(--surface-alt);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

/* Urgency Dot */
.dash-urgency-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.dash-urgency--critical {
  background: var(--red);
}

.dash-urgency--warning {
  background: var(--amber);
}

.dash-urgency--normal {
  background: var(--green);
}

/* Bottom Row */
.dash-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dash-bottom-row--single {
  grid-template-columns: 1fr;
}

.dash-bottom-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
}

.dash-bottom-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.dash-bottom-title {
  font-size: 14px;
  font-weight: 700;
}

/* Deadline Row (compact) */
.dash-deadline-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.dash-countdown-badge {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.dash-countdown--red {
  background: #fef2f2;
  color: var(--red);
}

.dash-countdown--amber {
  background: #fffbeb;
  color: var(--amber);
}

.dash-countdown--green {
  background: #f0fdf4;
  color: var(--green);
}

.dash-deadline-row-content {
  flex: 1;
}

/* Activity Row */
.dash-activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.dash-activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-activity-content {
  flex: 1;
}

.dash-activity-time {
  font-size: 10px;
  color: var(--light);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Badge */
.dash-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.dash-badge--amber {
  background: #fffbeb;
  color: #92400e;
}

.dash-badge--red {
  background: #fef2f2;
  color: var(--red);
}

/* Purple Button */
.dash-btn-purple {
  background: var(--purple) !important;
  color: #fff !important;
  border: none !important;
}

.dash-btn-purple:hover {
  background: #6d28d9 !important;
}

.dash-btn-orange {
  background: var(--accent) !important;
  color: #fff !important;
  border: none !important;
}

.dash-btn-orange:hover {
  background: #c93d21 !important;
}

/* Utility classes */
.dash-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.dash-bold {
  font-weight: 700;
}

.dash-semibold {
  font-weight: 600;
}

.dash-muted {
  color: var(--muted);
}

.dash-subtle {
  color: #6b6b6b;
  font-weight: 600;
}

.dash-text-sm {
  font-size: 12px;
}

.dash-text-xs {
  font-size: 10px;
}

.dash-text-red {
  color: var(--red);
}

.dash-text-amber {
  color: var(--amber);
}

.dash-text-green {
  color: var(--green);
}

.dash-text-blue {
  color: var(--blue);
}

.dash-text-accent {
  color: var(--accent);
}

.dash-clickable-row {
  cursor: pointer;
  transition: background 0.1s;
}

/* Responsive */
@media (max-width: 768px) {
  .dash-kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-kpi-value {
    font-size: 18px;
  }

  .dash-tab-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-tab-count {
    font-size: 22px;
  }

  .dash-insight-row {
    grid-template-columns: 1fr;
  }

  .dash-bottom-row {
    grid-template-columns: 1fr;
  }

  .dash-deadline-grid {
    grid-template-columns: 1fr;
  }

  .dash-hide-mobile {
    display: none;
  }
}
