/* ── Listing Health Dashboard ─────────────────────────────────────────────────── */

#listing-health-root {
  font-family: 'DM Sans', system-ui, sans-serif;
  max-width: 960px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  color: #1a1a2e;
}

/* ── Summary bar ──────────────────────────────────────────────────────────────── */

#lh-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.lh-stat {
  background: #f8f7f4;
  border: 1px solid #e8e4dc;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  min-width: 130px;
}

.lh-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 0.25rem;
}

.lh-stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
}

.lh-stat-value.ok     { color: #16a34a; }
.lh-stat-value.warn   { color: #d97706; }
.lh-stat-value.danger { color: #dc2626; }

/* ── Section headings ────────────────────────────────────────────────────────── */

.lh-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin: 1.75rem 0 0.75rem;
}

/* ── Channel health cards ────────────────────────────────────────────────────── */

#lh-channels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.lh-channel-card {
  background: #fff;
  border: 1px solid #e8e4dc;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  position: relative;
  transition: box-shadow 0.15s;
}

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

.lh-channel-card.alert-active {
  border-color: #fbbf24;
  background: #fffbeb;
}

.lh-channel-card.critical {
  border-color: #f87171;
  background: #fef2f2;
}

.lh-channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.lh-channel-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.lh-channel-badge {
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-ok       { background: #dcfce7; color: #16a34a; }
.badge-warn     { background: #fef9c3; color: #d97706; }
.badge-critical { background: #fee2e2; color: #dc2626; }
.badge-offline  { background: #f3f4f6; color: #6b7280; }

.lh-channel-meta {
  font-size: 0.78rem;
  color: #888;
  margin-top: 0.35rem;
}

.lh-channel-alert-msg {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #b91c1c;
  font-weight: 500;
}

/* ── Alerts table ────────────────────────────────────────────────────────────── */

#lh-alerts {
  overflow-x: auto;
}

.lh-alerts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.lh-alerts-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e8e4dc;
}

.lh-alerts-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.lh-alerts-table tr:hover td {
  background: #fafaf8;
}

.lh-alerts-table tr.unack {
  background: #fffbeb;
}

.lh-alerts-table tr.unack.critical-row {
  background: #fef2f2;
}

.severity-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.dot-info     { background: #60a5fa; }
.dot-warning  { background: #f59e0b; }
.dot-critical { background: #ef4444; }

.alert-message-cell {
  max-width: 320px;
}

.lh-btn-ack {
  background: #1a1a2e;
  color: #fff;
  border: none;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.lh-btn-ack:hover { opacity: 0.8; }

/* ── No alerts state ────────────────────────────────────────────────────────── */

.lh-empty {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-size: 0.9rem;
}

.lh-empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* ── Loading / error states ──────────────────────────────────────────────────── */

#listing-health-root.loading { opacity: 0.5; pointer-events: none; }

.lh-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 1rem;
  color: #dc2626;
  font-size: 0.85rem;
}

/* ── Tab nav ─────────────────────────────────────────────────────────────────── */

.lh-tab-nav {
  display: flex;
  gap: 0.25rem;
  margin: 1.5rem 0 0.75rem;
  border-bottom: 2px solid #e8e4dc;
}

.lh-tab {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.lh-tab:hover { color: #1a1a2e; }

.lh-tab.active {
  color: #1a1a2e;
  border-bottom-color: #1a1a2e;
}

#lh-pending-badge {
  display: inline-block;
  background: #fef9c3;
  color: #d97706;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  margin-left: 0.25rem;
  vertical-align: middle;
  min-width: 1.4em;
  text-align: center;
}

#lh-pending-badge:empty { display: none; }

/* ── Pending table ───────────────────────────────────────────────────────────── */

#lh-pending { overflow-x: auto; }

.lh-pending-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.lh-pending-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e8e4dc;
}

.lh-pending-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.lh-pending-table tr:hover td { background: #fafaf8; }

.lh-pending-error-cell {
  max-width: 240px;
  font-size: 0.8rem;
  color: #b91c1c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lh-state-badge {
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lh-state-failed        { background: #fee2e2; color: #dc2626; }
.lh-state-pending_retry { background: #fef9c3; color: #d97706; }
.lh-state-retrying      { background: #dbeafe; color: #2563eb; }

/* ── Channel breakdown table ─────────────────────────────────────────────────── */

#lh-breakdown {
  margin-top: 1.5rem;
}

.lh-breakdown-header {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin-bottom: 0.5rem;
}

.lh-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.lh-breakdown-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid #e8e4dc;
}

.lh-breakdown-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.lh-breakdown-row.healthy    { background: #f0fdf4; }
.lh-breakdown-row.watch      { background: #fffbeb; }
.lh-breakdown-row.struggling { background: #fef2f2; }

.lh-breakdown-critical {
  color: #dc2626;
  font-weight: 600;
  font-size: 0.78rem;
}

.lh-breakdown-totals td {
  font-weight: 600;
  background: #f8f7f4;
  border-top: 2px solid #e8e4dc;
  border-bottom: none;
}

/* ── Inventory Dashboard ─────────────────────────────────────────────────────── */

#inventory-root {
  font-family: 'DM Sans', system-ui, sans-serif;
  max-width: 1000px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  color: #1a1a2e;
}

#inv-table-container {
  overflow-x: auto;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.inv-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e8e4dc;
  user-select: none;
}

.inv-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.inv-table tr:hover td {
  background: #fafaf8;
}

.inv-sortable {
  cursor: pointer;
  transition: color 0.15s;
}
.inv-sortable:hover { color: #1a1a2e; }

.inv-sort-arrow {
  font-size: 0.7rem;
  margin-left: 0.25rem;
}

.inv-sku-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: #6b7280;
}

.inv-num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.inv-age-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #16a34a;
}
.inv-age-cell.watch      { color: #d97706; background: #fffbeb; }
.inv-age-cell.critical-age { color: #dc2626; background: #fef2f2; }

.inv-empty {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-size: 0.9rem;
}

.inv-empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.inv-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 1rem;
  color: #dc2626;
  font-size: 0.85rem;
}

#inventory-root.loading { opacity: 0.5; pointer-events: none; }

/* ── Proposed Pricing Adjustments Dashboard ─────────────────────────────── */

#pricing-review-root {
  font-family: 'DM Sans', system-ui, sans-serif;
  max-width: 1100px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  color: #1a1a2e;
}

#pr-table-container { overflow-x: auto; }

.pr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.pr-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e8e4dc;
}

.pr-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.pr-table tr:hover td {
  background: #fafaf8;
}

.pr-sku-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: #6b7280;
}

.pr-num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pr-age-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #16a34a;
}
.pr-age-cell.watch      { color: #d97706; background: #fffbeb; }
.pr-age-cell.critical-age { color: #dc2626; background: #fef2f2; }

.pr-delta-up   { color: #16a34a; font-weight: 600; }
.pr-delta-down { color: #dc2626; font-weight: 600; }

.pr-reason-cell {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pr-applied-cell {
  white-space: nowrap;
  color: #6b7280;
  font-size: 0.78rem;
}

.pr-applied-badge {
  display: inline-block;
  background: #ecfdf5;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.4rem;
}

.pr-actions-cell {
  white-space: nowrap;
}

.pr-btn {
  border: none;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  color: #fff;
  margin-right: 0.25rem;
  transition: opacity 0.15s;
}
.pr-btn:hover { opacity: 0.85; }
.pr-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pr-btn-approve { background: #16a34a; }
.pr-btn-reject  { background: #dc2626; }

.pr-empty {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-size: 0.9rem;
}

.pr-empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.pr-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 1rem;
  color: #dc2626;
  font-size: 0.85rem;
}

#pricing-review-root.loading { opacity: 0.5; pointer-events: none; }

/* ── Restock Recommendations Dashboard ─────────────────────────────── */

#buy-recommendations-root {
  font-family: 'DM Sans', system-ui, sans-serif;
  max-width: 1100px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  color: #1a1a2e;
}

#br-table-container { overflow-x: auto; }

.br-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.br-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e8e4dc;
}

.br-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.br-table tr:hover td {
  background: #fafaf8;
}

.br-sku-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: #6b7280;
}

.br-num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.br-score-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.br-score-cell.high { color: #16a34a; }
.br-score-cell.mid  { color: #d97706; }
.br-score-cell.low  { color: #6b7280; }

.br-age-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #16a34a;
}
.br-age-cell.watch      { color: #d97706; background: #fffbeb; }
.br-age-cell.critical-age { color: #dc2626; background: #fef2f2; }

.br-pricing-applied {
  display: inline-block;
  background: #ecfdf5;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.4rem;
  text-transform: capitalize;
}
.br-pricing-rejected {
  display: inline-block;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.4rem;
  text-transform: capitalize;
}
.br-pricing-date {
  color: #6b7280;
  font-size: 0.78rem;
}

.br-actions-cell {
  white-space: nowrap;
}

.br-btn {
  background: #1a1a2e;
  color: #fff;
  border: none;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s;
}
.br-btn:hover { opacity: 0.8; color: #fff; }
.br-btn-restock { background: #1a1a2e; }

.br-empty {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-size: 0.9rem;
}

.br-empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.br-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 1rem;
  color: #dc2626;
  font-size: 0.85rem;
}

#buy-recommendations-root.loading { opacity: 0.5; pointer-events: none; }

/* ── Demand Forecast Dashboard ─────────────────────────────────────── */

#demand-forecast-root {
  font-family: 'DM Sans', system-ui, sans-serif;
  max-width: 1100px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  color: #1a1a2e;
}

#df-table-container { overflow-x: auto; }

.df-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.df-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e8e4dc;
}

.df-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.df-table tr:hover td {
  background: #fafaf8;
}

.df-sku-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: #6b7280;
}

.df-num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.df-score-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.df-score-cell.high { color: #16a34a; }
.df-score-cell.mid  { color: #d97706; }
.df-score-cell.low  { color: #6b7280; }

.df-trend-cell {
  font-variant-numeric: tabular-nums;
  text-transform: capitalize;
}
.df-trend-cell.rising { color: #16a34a; font-weight: 600; }
.df-trend-cell.flat   { color: #6b7280; }
.df-trend-cell.falling { color: #dc2626; font-weight: 600; }

.df-pricing-applied {
  display: inline-block;
  background: #ecfdf5;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.4rem;
  text-transform: capitalize;
}
.df-pricing-rejected {
  display: inline-block;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.4rem;
  text-transform: capitalize;
}
.df-pricing-date {
  color: #6b7280;
  font-size: 0.78rem;
}

.df-empty {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-size: 0.9rem;
}

.df-empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.df-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 1rem;
  color: #dc2626;
  font-size: 0.85rem;
}

#demand-forecast-root.loading { opacity: 0.5; pointer-events: none; }
