/* Product-level (sibling) forecast-override modal.
   ai_reference/override_pushdown.md → "UI". Reuses .frq-modal-overlay
   for the backdrop; the panel is the new --xwide width. Design-system
   tokens only — no inline styles (css_hygiene ratchet). */

/* Overlay starts hidden without an inline style attribute (ratchet-safe); the
   sibling-override Stimulus controller toggles .ovs-open. Higher specificity than
   .frq-modal-overlay's display:flex so the hidden default wins regardless of load
   order. */
.frq-modal-overlay.ovs-overlay { display: none; }
.frq-modal-overlay.ovs-overlay.ovs-open { display: flex; }

/* ~1150px panel — the existing --wide (900px) is too narrow for 9 columns. */
.frq-modal-content--xwide { max-width: 1150px; }

.ovs-modal {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

/* Header */
.ovs-head {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border, #e8e6e1);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
}
.ovs-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.ovs-subtitle { font-size: 12px; color: var(--muted, #8a8a8a); margin-top: 3px; }
.ovs-subtitle b { color: var(--ink, #1a1a1a); font-weight: 600; }
.ovs-subtitle .ovs-pct { color: var(--amber, #d97706); font-weight: 700; }
.ovs-close {
  border: none; background: none; font-size: 20px; line-height: 1;
  color: var(--muted, #8a8a8a); cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.ovs-close:hover { background: var(--surface-alt, #fafaf8); color: var(--ink, #1a1a1a); }

/* Body */
.ovs-body { padding: 18px 24px 8px; overflow-y: auto; }

/* Pre-selection rule sentence */
.ovs-rule {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 10px 14px; background: var(--surface-alt, #fafaf8);
  border: 1px solid var(--border-light, #f0eeea); border-radius: 8px; margin-bottom: 12px;
}
.ovs-rule-text { font-size: 13px; font-weight: 500; }
.ovs-rule-text b { font-weight: 700; }
.ovs-rule-escapes { font-size: 12px; white-space: nowrap; }
.ovs-rule-escapes a { color: var(--blue, #3b82f6); text-decoration: none; font-weight: 500; cursor: pointer; }
.ovs-rule-escapes a:hover { text-decoration: underline; }
.ovs-rule-escapes .ovs-sep { color: var(--light, #b0aead); margin: 0 4px; }

/* Chips */
.ovs-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ovs-chip {
  font-size: 11px; font-weight: 500; padding: 4px 11px; border-radius: 14px;
  border: 1px solid var(--border-hover, #d4d2cd); background: var(--surface, #fff);
  color: #6b6560; cursor: pointer; font-family: inherit;
}
.ovs-chip:hover { border-color: #b8b5af; color: var(--ink, #1a1a1a); }

/* Table */
.ovs-table-wrap { border: 1px solid var(--border-light, #f0eeea); border-radius: 10px; overflow: auto; max-height: 46vh; }
table.ovs-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.ovs-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-alt, #fafaf8);
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--light, #b0aead); text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--border-light, #f0eeea); white-space: nowrap;
}
.ovs-table thead th.ovs-num { text-align: right; }
.ovs-table thead th.ovs-ctr { text-align: center; }
.ovs-table tbody td {
  padding: 9px 8px; font-size: 12px; border-bottom: 1px solid #f5f4f2;
  vertical-align: middle; white-space: nowrap;
}
.ovs-table tbody tr:last-child td { border-bottom: none; }
.ovs-table tbody tr.ovs-selectable { cursor: pointer; }
.ovs-table tbody tr.ovs-selectable:hover { background: var(--surface-alt, #fafaf8); }
.ovs-table td.ovs-num, .ovs-table th.ovs-num { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.ovs-table td.ovs-ctr { text-align: center; }

tr.ovs-row-selected { background: #f7fafe; }
tr.ovs-row-selected:hover { background: #f1f7fd; }
tr.ovs-row-muted td { color: var(--light, #b0aead); }
tr.ovs-row-disabled { cursor: default; }
tr.ovs-row-disabled td { color: var(--light, #b0aead); }
tr.ovs-row-anchor { background: #fdfaf5; }
tr.ovs-row-anchor:hover { background: #fbf6ee; }

.ovs-check { width: 15px; height: 15px; accent-color: var(--blue, #3b82f6); cursor: pointer; vertical-align: middle; }
tr.ovs-row-disabled .ovs-check { cursor: not-allowed; }

/* Identity cell */
.ovs-name { font-weight: 600; font-size: 12px; color: var(--ink, #1a1a1a); }
.ovs-sku { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted, #8a8a8a); margin-top: 1px; }
.ovs-anchor-tag {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--amber, #d97706); background: var(--tint-warn-bg, #fffbeb); border-radius: 4px; padding: 1px 6px; margin-left: 6px;
}

/* Value colours */
.ovs-pos { color: var(--green, #16a34a); }
.ovs-neg { color: var(--red, #dc2626); }
.ovs-nil { color: #ccc; }
.ovs-gap-val { font-weight: 700; }
tr.ovs-row-muted .ovs-gap-val { font-weight: 400; }
.ovs-why { border-bottom: 1px dotted var(--border-hover, #d4d2cd); cursor: help; }

/* Fit chip */
.ovs-fit { display: inline-block; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; padding: 2px 7px; }
.ovs-fit-good { background: #dcfce7; color: var(--green, #16a34a); }
.ovs-fit-fair { background: var(--tint-warn-bg, #fffbeb); color: var(--amber, #d97706); }
.ovs-fit-poor { background: #fef2f2; color: var(--red, #dc2626); }

/* Current override */
.ovs-ovr-none { color: #ccc; }
.ovs-ovr-active { color: var(--amber, #d97706); font-weight: 600; font-size: 11px; }
.ovs-ovr-tag { color: var(--muted, #8a8a8a); font-weight: 400; }
.ovs-warn { display: block; font-size: 10px; color: var(--amber, #d97706); font-weight: 600; margin-top: 2px; white-space: nowrap; }
.ovs-warn[hidden] { display: none; }

/* Header calculation tooltips */
.ovs-tip { position: relative; display: inline-flex; align-items: center; gap: 4px; cursor: help; }
.ovs-tip-q {
  display: inline-flex; width: 12px; height: 12px; border-radius: 50%;
  background: #eceae5; color: var(--muted, #8a8a8a); font-size: 8px; font-weight: 700;
  align-items: center; justify-content: center; flex: none;
}
.ovs-tip:hover .ovs-tip-q { background: #dedbd4; color: var(--ink, #1a1a1a); }
.ovs-tip-bubble {
  display: none; position: absolute; top: calc(100% + 7px); left: 0; z-index: 6;
  width: 258px; background: var(--surface, #fff); border: 1px solid var(--border, #e8e6e1);
  border-radius: 8px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  font-size: 11px; font-weight: 400; color: #555; line-height: 1.5;
  text-transform: none; letter-spacing: 0; white-space: normal; text-align: left;
}
.ovs-tip-bubble--right { left: auto; right: 0; }
.ovs-tip:hover .ovs-tip-bubble { display: block; }
.ovs-tip-bubble .ovs-f {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink, #1a1a1a);
  background: var(--surface-alt, #fafaf8); border-radius: 3px; padding: 1px 4px;
}

/* Editable Override % */
.ovs-eff-wrap { display: inline-flex; align-items: center; gap: 2px; justify-content: flex-end; }
.ovs-eff-input {
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; font-weight: 700;
  width: 50px; text-align: right; border: 1px solid transparent; border-radius: 5px;
  padding: 3px 5px; color: var(--green, #16a34a); background: transparent;
}
.ovs-eff-input:hover { border-color: var(--border-hover, #d4d2cd); background: var(--surface, #fff); }
.ovs-eff-input:focus { border-color: var(--blue, #3b82f6); background: var(--surface, #fff); outline: none; }
.ovs-eff-input.ovs-eff-edited { color: var(--amber, #d97706); background: var(--tint-warn-bg, #fffbeb); border-color: #fde68a; }
.ovs-eff-input:disabled { color: var(--muted, #8a8a8a); }
.ovs-eff-sfx { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--muted, #8a8a8a); }

/* New ADD */
.ovs-add-old { color: var(--muted, #8a8a8a); }
.ovs-add-arrow { color: var(--light, #b0aead); padding: 0 3px; }
.ovs-add-new { font-weight: 700; }

/* Tag + footer */
.ovs-tagrow { display: flex; align-items: center; gap: 10px; margin: 14px 2px 6px; }
.ovs-tagrow label { font-size: 12px; font-weight: 600; }
.ovs-taginput {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 6px 10px;
  border: 1px solid var(--border-hover, #d4d2cd); border-radius: 6px; width: 240px; color: var(--ink, #1a1a1a);
}
.ovs-taghelp { font-size: 11px; color: var(--muted, #8a8a8a); }

.ovs-foot {
  padding: 14px 24px; border-top: 1px solid var(--border, #e8e6e1); background: var(--surface-alt, #fafaf8);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.ovs-csv { font-size: 12px; color: var(--muted, #8a8a8a); }
.ovs-csv a { color: var(--blue, #3b82f6); text-decoration: none; }
.ovs-csv a:hover { text-decoration: underline; }
.ovs-foot-actions { display: flex; gap: 10px; align-items: center; }
.ovs-error { color: var(--red, #dc2626); font-size: 12px; font-weight: 600; margin-right: 8px; }
.ovs-error[hidden] { display: none; }

/* Inline the Revoke-batch button_to form so it sits beside the header buttons. */
.override-revoke-form { display: inline-block; }

/* Entry-point checkbox line on the SKU-page override control */
.ovs-entry {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border, #e8e6e1);
}
.ovs-entry label { font-size: 13px; cursor: pointer; }
/* Push-down lock: the kit's checkbox is locked on while its push-down is live. */
.ovs-entry-lock { font-size: 12px; color: var(--muted, #6b6b6b); margin: 4px 0 0 23px; line-height: 1.5; }

/* ─── Kit push-down modal ─── */

/* Tenant-labeled kit chip beside the modal title (purple, like the FRQ badge). */
.ovc-kit-chip {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: #7c3aed; background: #f3f0fe; border: 1px solid #e4dcfb;
  border-radius: 5px; padding: 1px 7px; margin-left: 8px; vertical-align: middle;
}

/* Context strip — the scaling explained once, under the rule line. */
.ovc-context {
  font-size: 12px; color: var(--muted, #8a8a8a); line-height: 1.5;
  margin: -4px 2px 12px; padding: 0 2px;
}
.ovc-context b { color: var(--ink, #1a1a1a); font-weight: 600; }

/* Component cell: long product names would force the 9-column table into a
   horizontal scroll (cells are nowrap), so the name truncates at a fixed width
   and the full name rides on the title attribute. Flags stay visible after it. */
.ovc-name { display: flex; align-items: center; max-width: 240px; }
.ovc-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovc-name .ovc-flag { flex: none; }

/* Current-override cell: total on top, own / kit split underneath. */
.ovc-ovr-split { display: block; font-size: 10px; color: var(--muted, #8a8a8a); margin-top: 1px; }

/* BOM flags inline in the Component cell */
.ovc-flag {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted, #8a8a8a); background: #f0eeea; border-radius: 4px;
  padding: 1px 6px; margin-left: 6px;
}
.ovc-flag--nest { color: #7c3aed; background: #f3f0fe; }

/* Share-of-fc-90d cell: inline bar + % + capped disclosure */
.ovc-share-wrap { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.ovc-share-bar {
  display: inline-block; width: 54px; height: 6px; border-radius: 3px;
  background: #eceae5; overflow: hidden;
}
.ovc-share-fill { display: block; height: 100%; background: var(--blue, #3b82f6); border-radius: 3px; }
.ovc-share-pct { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.ovc-share-cap {
  font-size: 9.5px; color: var(--amber, #d97706); font-weight: 600;
  text-align: right; margin-top: 2px; white-space: nowrap; cursor: help;
}
.ovc-reason { text-align: left; font-style: italic; }

/* Discrete fill widths (5% steps) — no inline style attribute (ratchet-safe). */
.ovc-share-fill--w0   { width: 0%; }
.ovc-share-fill--w5   { width: 5%; }
.ovc-share-fill--w10  { width: 10%; }
.ovc-share-fill--w15  { width: 15%; }
.ovc-share-fill--w20  { width: 20%; }
.ovc-share-fill--w25  { width: 25%; }
.ovc-share-fill--w30  { width: 30%; }
.ovc-share-fill--w35  { width: 35%; }
.ovc-share-fill--w40  { width: 40%; }
.ovc-share-fill--w45  { width: 45%; }
.ovc-share-fill--w50  { width: 50%; }
.ovc-share-fill--w55  { width: 55%; }
.ovc-share-fill--w60  { width: 60%; }
.ovc-share-fill--w65  { width: 65%; }
.ovc-share-fill--w70  { width: 70%; }
.ovc-share-fill--w75  { width: 75%; }
.ovc-share-fill--w80  { width: 80%; }
.ovc-share-fill--w85  { width: 85%; }
.ovc-share-fill--w90  { width: 90%; }
.ovc-share-fill--w95  { width: 95%; }
.ovc-share-fill--w100 { width: 100%; }

@media (max-width: 900px) {
  .ovs-body { padding: 14px 14px 6px; }
  .ovs-head, .ovs-foot { padding-left: 14px; padding-right: 14px; }
}
