/* T14/T15 (forecast_trails_growth / forecast_trails_decline) — Demand Shift
 * Detector visibility surfaces.
 *
 * Global sheet (loaded by the :app glob, usable on every surface): the
 * replenishment-row growth/decline badge, the SKU-detail "Demand Shift Detected"
 * card, and the /forecast_engine_health demand-shift funnel panel. GROWTH is the
 * green family; DECLINE (T15, default-off) is the amber "trim / verify" family —
 * a --decline modifier recolours the shared markup.
 *
 * The app ships a single (light "warm minimal") theme, so these match it rather
 * than introducing a lone dark-mode island on an otherwise-light page.
 */

/* ── Replenishment row badge ─────────────────────────────────────────────── */
.demand-shift-line {
  margin-top: 3px;
}
.demand-shift-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px 1px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  line-height: 1.5;
  white-space: nowrap;
}
.demand-shift-badge svg {
  display: block;
  color: #16a34a;
}
.demand-shift-badge--medium {
  color: #3f6212;
  background: #ecfccb;
  border-color: #d9f99d;
}
.demand-shift-badge .demand-shift-badge-conf {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.85;
  text-transform: uppercase;
}
/* Decline (T15) — amber "trim / verify" family. The compound
   --decline.--medium selector outranks the green --medium rule above so a
   medium-confidence decline still reads amber. */
.demand-shift-badge--decline {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}
.demand-shift-badge--decline svg {
  color: #d97706;
}
.demand-shift-badge--decline.demand-shift-badge--medium {
  color: #b45309;
  background: #fffbeb;
  border-color: #fef3c7;
}

/* ── SKU-detail "Demand Shift Detected" card (mirrors frq-callout--underforecast) ── */
.demand-shift-card {
  margin-top: 16px;
  padding: 16px 18px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 3px solid #16a34a;
  border-radius: 8px;
  font-size: 13px;
  color: #3a3936;
}
.demand-shift-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.demand-shift-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #dcfce7;
  color: #15803d;
  flex: 0 0 auto;
}
.demand-shift-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #14532d;
}
.demand-shift-card-conf {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 2px 8px;
}
.demand-shift-card p {
  margin: 0 0 8px 0;
}
.demand-shift-card-guidance {
  color: #6b7280;
  margin: 0;
}
.demand-shift-metrics {
  /* One shared grid across both rows so the 2nd/3rd tiles align as columns;
     minmax(0, max-content) lets labels wrap instead of overflowing on narrow
     viewports. 5 columns since the units tile joined the forecast row
     (2026-09-08); the 3-tile actuals row simply leaves trailing cells empty. */
  display: grid;
  grid-template-columns: repeat(5, minmax(0, max-content));
  justify-content: start;
  column-gap: 28px;
  row-gap: 10px;
  margin: 10px 0 12px 0;
  padding: 10px 0;
  border-top: 1px dashed #bbf7d0;
  border-bottom: 1px dashed #bbf7d0;
}
.demand-shift-metrics-row {
  display: contents;
}
/* The forecast row always restarts at column 1, even when the actuals row
   rendered fewer than 3 tiles (nil guards on sparse snapshots). */
.demand-shift-metrics-row + .demand-shift-metrics-row > div:first-child {
  grid-column-start: 1;
}
.demand-shift-metric-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 2px;
}
.demand-shift-metric-value {
  font-size: 16px;
  font-weight: 700;
  color: #14532d;
}
.demand-shift-metric-value.is-muted {
  color: #57534e;
}

/* Decline (T15) — recolour the shared card markup to the amber "trim" family. */
.demand-shift-card--decline {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: #d97706;
}
.demand-shift-card--decline .demand-shift-card-icon {
  background: #fef3c7;
  color: #b45309;
}
.demand-shift-card--decline .demand-shift-card-title {
  color: #7c2d12;
}
.demand-shift-card--decline .demand-shift-card-conf {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}
.demand-shift-card--decline .demand-shift-metrics {
  border-top-color: #fde68a;
  border-bottom-color: #fde68a;
}
.demand-shift-card--decline .demand-shift-metric-value {
  color: #7c2d12;
}

/* ── /forecast_engine_health T14 funnel panel ────────────────────────────── */
.dsh-panel {
  margin-top: 32px;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid #e7e3da;
  border-radius: 8px;
}
.dsh-panel-title {
  margin: 0 0 4px 0;
  font-size: 18px;
  color: #2a2a2a;
}
.dsh-panel-sub {
  margin: 0 0 14px 0;
  color: #6b7280;
  font-size: 13px;
}
.dsh-scroll {
  overflow-x: auto;
}
.dsh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dsh-table thead tr {
  background: #f5f4f0;
  text-align: left;
}
.dsh-table th,
.dsh-table td {
  padding: 8px 10px;
}
.dsh-table th.dsh-num,
.dsh-table td.dsh-num {
  text-align: right;
}
.dsh-table tbody tr {
  border-top: 1px solid #f0eeea;
}
.dsh-co {
  font-weight: 500;
}
.dsh-run {
  color: #6b7280;
}
.dsh-fired {
  font-weight: 700;
  color: #16a34a;
}
/* T15 decline chip — amber, matching the badge/card decline family. */
.dsh-fired--decline {
  color: #d97706;
}
.dsh-fired.is-zero {
  color: #9ca3af;
  font-weight: 500;
}
.dsh-excl {
  color: #6b7280;
  font-size: 11px;
}
.dsh-excl-chip {
  display: inline-block;
  margin: 0 4px 2px 0;
  padding: 1px 6px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Company Settings: Demand Shift Detection fieldset ──────────────────────
   Class (not an inline style) for the fieldset's stacked control list, so the
   settings form's inline-style ratchet count does not grow. */
.dsh-settings-fieldset {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
