/* Bulk Forecast Override CSV import + Active Overrides tag/status controls.
   Docs: ai_reference/forecast_engine.md → "Bulk CSV import". Globbed into :app (no per-view
   link tag — see design-system §19). Keeps these surfaces inline-style-free. */

.foi-intro {
  margin-bottom: 16px;
  color: var(--muted, #64748b);
  line-height: 1.6;
}

.foi-callout {
  background: var(--surface-alt, #f8f7f5);
  border: 1px solid var(--border-color, #e5e5e5);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.foi-pre {
  margin: 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--border-color, #e5e5e5);
  border-radius: 6px;
  padding: 10px;
  overflow-x: auto;
}

.foi-cols {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 8px;
}

.foi-cols th,
.foi-cols td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color, #eee);
  vertical-align: top;
}

.foi-warn {
  color: var(--accent-red, #c0392b);
  font-weight: 600;
}

.foi-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}

.foi-file-input {
  max-width: 400px;
}

.foi-progress {
  margin-top: 24px;
}

.foi-spin-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.foi-progress-track {
  margin-top: 8px;
  background: #e5e5e5;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

/* Width is driven by the poll controller (JS) on first fetch — starts empty so
   no inline style is needed on the server-rendered element. */
.foi-progress-bar {
  background: var(--accent-red, #c0392b);
  height: 100%;
  width: 0;
  transition: width 0.3s;
}

.foi-hidden {
  display: none;
}

/* --- Active Overrides toolbar additions (Import button + status links) --- */
.foi-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.foi-status-links {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.foi-status-links .foi-status-link.is-active {
  font-weight: 700;
  text-decoration: underline;
}

.foi-tag-chip {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--surface-alt, #eef2f7);
  color: var(--muted, #475569);
  white-space: nowrap;
}

.foi-recent-error {
  color: var(--accent-red, #c0392b);
  font-size: 0.85rem;
}

/* "Sources (n)" link under a total that sums an own override and kit shares. */
.foi-sources-sub {
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

/* Kit push-down notice on a completed import (sources add up). */
.foi-recent-notice {
  color: #92400e;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

/* Deep-link scope banner — shown when the list is filtered to one product via
   the product Forecast tab's Override-header jump link (?product_id=). */
.foi-product-scope {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface-alt, #eef2f7);
  border: 1px solid var(--border, #e2e8f0);
  font-size: 13px;
  color: var(--ink, #1a1a1a);
}
.foi-product-scope .foi-product-scope-clear { margin-left: auto; }

/* The Show links and the stale toggle as filter bar controls (the page's
   block-form override_status / stale filters): the global .filter-group is a
   column at least 180px wide; these hold a short link row and one button, so
   they keep their natural width and the button does not stretch. */
.foi-bar-control { min-width: 0; }
.foi-bar-toggle { align-self: flex-start; }

/* Active Overrides profile columns (ColumnProfile::FORECAST_OVERRIDES): the
   columns a buyer adds before or after the override block, the plain-cell pair
   the Forecast by SKU (.fbs-cc-*) and demand-event (.de-cc-*) tables use.
   Full-width mode needs no rule here: the global
   body.wide-eligible.is-wide > main.container rule widens the page and the
   .table-wrapper already scrolls sideways. */
.data-table thead th.fo-cc-head {
  text-align: left;
  white-space: nowrap;
}
.data-table td.fo-cc-cell {
  white-space: nowrap;
  font-size: 12px;
}

/* Active Overrides table cells (ForecastOverridesColumnsHelper): the page's own
   override columns keep these wherever the column layout places them. */
.fo-override-pct { font-weight: 600; }
.fo-override-up { color: var(--green); }
.fo-override-down { color: var(--red); }
.data-table td.fo-strong { font-weight: 600; }
.fo-verdict { font-weight: 500; }
.skv-badge.fo-model-badge { font-size: 11px; }
.data-table td.fo-age-stale { color: var(--red); font-weight: 600; }
.skv-badge.fo-stale-badge {
  background: var(--red-tint);
  color: var(--red);
  font-size: 10px;
  margin-left: 4px;
}
.data-table td.fo-note {
  max-width: 200px;
  font-size: 12px;
  color: var(--muted);
}

/* The "Two ways to read this table" note above the table, and the subtitle's
   stale count. */
.fo-read-guide {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.6;
}
.fo-stale-count { color: var(--red); font-weight: 600; }
