/* The three-stage plan and its Ciclo S&OP (stages_views.py, behind plan_stages).
   Built on the shell's tokens and the same cards, chips and tables as the
   other screens; Plan de demanda's grid keeps its own styles. */

.stg {
  --a1: #1976D2; --a2: #C2185B; --a3: #00897B;
  display: flex; flex-direction: column; gap: 16px;
  padding: 0 0 4px; max-width: 1240px; margin: 0 auto; width: 100%; box-sizing: border-box;
  font-size: 13px; color: var(--text);
  /* The sidebar takes part of the viewport, so the layout follows the
     width the screen actually gets, not the window's. */
  container: stg / inline-size;
}
[data-theme="dark"] .stg { --a1: #64B5F6; --a2: #F48FB1; --a3: #4DB6AC; }
.stg * { box-sizing: border-box; }
.stg .num { font-variant-numeric: tabular-nums; }

/* ── The screen's root, head, tabs and "Ver como" ─────────────────────
   The root only holds Alpine's state: the grid's flex layout sees through. */
.stg-root { display: contents; }
.stg-head { flex: none; display: flex; flex-direction: column; gap: 10px; max-width: 1240px; width: 100%; margin: 0 auto 16px; }
.stg-head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stg-head-acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.stg-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.stg-tabs a { height: 30px; padding: 0 14px; font-size: 12.5px; }
@media (max-width: 767.98px) { .stg-tabs a { padding: 0 9px; } }
.stg-head .seg a.is-on { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }
.stg-who-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.stg-who-row .seg { flex-wrap: wrap; max-width: 100%; }
.stg-who-row .seg a { white-space: normal; height: auto; min-height: 26px; }
.page.stg-detail .stg-head { margin-bottom: 12px; }

/* ── Header chips and KPIs ───────────────────────────────────────────── */
.stg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stg-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--border); background: var(--card); font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.stg-chip.is-preview { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); color: var(--warning); background: color-mix(in srgb, var(--warning) 8%, var(--card)); font-weight: 600; }

.stg-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stg-kpi { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stg-kpi-l { font-size: 11px; font-weight: 600; letter-spacing: .3px; color: var(--muted); }
.stg-kpi-v { font-size: 22px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.stg-kpi-s { font-size: 11.5px; color: var(--text-2); line-height: 1.35; }
.stg-kpi.is-up .stg-kpi-s { color: var(--success); }
.stg-kpi.is-down .stg-kpi-v { color: var(--error); }
.stg-kpi.is-warn .stg-kpi-v { color: var(--warning); }

/* ── Cards ───────────────────────────────────────────────────────────── */
.stg-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.stg-card-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px 10px; }
.stg-card-h h2 { margin: 0; font-size: 14px; font-weight: 600; }
.stg-card-h .stg-sp { flex: 1; }
.stg-card-sub { font-size: 12px; color: var(--muted); }
.stg-card-b { padding: 0 16px 16px; }
.stg-two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.stg-text { margin: 0 0 8px; font-size: 13.5px; line-height: 1.55; }
.stg-how { margin: 4px 0 8px; padding-left: 18px; line-height: 1.55; color: var(--text-2); }
.stg-row-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.stg-needs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.stg-need { display: flex; gap: 10px; align-items: baseline; line-height: 1.45; }

/* ── Plan de demanda's grid inside a card: it scrolls in there ───────── */
.page.stg-page { overflow: auto; }
/* The grid's top bar keeps its view switch and export; the S&OP cycle
   chip belongs to Ciclo S&OP's demo, not to this cycle, so it stays out. */
#main:has(.stg-root, .stg-split) .pl-part { display: none; }
/* The agent's FAB would sit on the panel's buttons. */
#main:has(.stg-sum.is-open) .fab-wrap { display: none; }
.stg-grid { display: flex; flex-direction: column; height: min(72vh, 680px); min-height: 440px; padding: 0 12px; border-top: 1px solid var(--border); }
.stg-grid > .plan { flex: 1; min-height: 0; }

/* ── Flags ───────────────────────────────────────────────────────────── */
.stg-flags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stg-flag { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.stg-flag-t { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-weight: 600; }
.stg-flag-d { color: var(--text-2); line-height: 1.45; }
.stg-sev { font-size: 10.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.sev-high .stg-sev { color: var(--error); }
.sev-mid .stg-sev { color: var(--warning); }
.stg-fix { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; padding: 3px 10px; border-radius: 12px; font-size: 11.5px; border: 1px solid var(--border); background: var(--card); color: var(--text-2); }
.stg-fix:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.stg-fix.is-on { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); color: var(--success); background: color-mix(in srgb, var(--success) 8%, var(--card)); }

/* ── Status chips (tables) ───────────────────────────────────────────── */
.stg-st { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.stg-st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stg-st.is-ok { color: var(--success); background: color-mix(in srgb, var(--success) 11%, transparent); }
.stg-st.is-warn { color: var(--warning); background: color-mix(in srgb, var(--warning) 11%, transparent); }
.stg-st.is-muted { color: var(--muted); background: var(--hover); }
.stg-st.is-down { color: var(--error); background: color-mix(in srgb, var(--error) 10%, transparent); }
.stg-area { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.stg-area::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.stg-area.a1 { color: var(--a1, #1976D2); } .stg-area.a2 { color: var(--a2, #C2185B); } .stg-area.a3 { color: var(--a3, #00897B); } .stg-area.a4 { color: var(--a4, #5D6D7E); }
[data-theme="dark"] .stg-area.a1 { color: #64B5F6; } [data-theme="dark"] .stg-area.a2 { color: #F48FB1; } [data-theme="dark"] .stg-area.a3 { color: #4DB6AC; } [data-theme="dark"] .stg-area.a4 { color: #AEB6BF; }

/* ── Tables: scroll inside their card, never the page ───────────────── */
.stg-tbl-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
.stg-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.stg-tbl th { text-align: left; padding: 9px 12px; background: var(--hover); font-size: 11.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; border-bottom: 1px solid var(--border); }
.stg-tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.stg-tbl tr:last-child td { border-bottom: 0; }
.stg-tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.stg-tbl tfoot td { font-weight: 700; background: var(--hover); border-top: 1px solid var(--border); }
.stg-tbl td.wrap { white-space: normal; min-width: 200px; color: var(--text-2); }
.stg-tbl tr.is-picked td { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.stg-tbl .stg-first { font-weight: 600; }
.stg-up { color: var(--success); } .stg-down { color: var(--error); }
.stg-muted { color: var(--muted); }
.stg-who { display: flex; flex-direction: column; gap: 1px; }
.stg-who small { color: var(--muted); font-size: 11px; }
.stg-new { color: var(--primary); font-size: 11.5px; }
.stg-kept { font-size: 11px; color: var(--muted); display: block; }
.stg-thread-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-size: 11.5px; }

/* ── Progress ────────────────────────────────────────────────────────── */
.stg-prog { display: flex; flex-direction: column; gap: 12px; }
.stg-bar { height: 8px; border-radius: 4px; background: var(--seg-bg); overflow: hidden; }
.stg-bar > i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.stg-prog-big { display: flex; align-items: baseline; gap: 8px; }
.stg-prog-big b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stg-prog-rows { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto; gap: 8px 12px; align-items: center; }
.stg-prog-rows .stg-bar { height: 6px; }
.stg-prog-rows .a1 > i { background: var(--a1); } .stg-prog-rows .a2 > i { background: var(--a2); } .stg-prog-rows .a3 > i { background: var(--a3); }

.stg-owner { display: flex; flex-direction: column; gap: 6px; }
.stg-owner-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.stg-owner .stg-bar.a1 > i { background: var(--a1); } .stg-owner .stg-bar.a2 > i { background: var(--a2); } .stg-owner .stg-bar.a3 > i { background: var(--a3); }

/* ── Notice (a newer base) ───────────────────────────────────────────── */
.stg-notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); background: color-mix(in srgb, var(--primary) 5%, var(--card)); line-height: 1.45; }
.stg-notice > span { flex: 1; min-width: 220px; }

/* ── Comment threads, one card per series ────────────────────────────── */
.stg-thread-h { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; color: inherit; font: inherit; }
.stg-thread-h:hover { background: var(--hover); border-radius: 12px; }
.stg-empty { padding-top: 16px; color: var(--muted); }
.stg-wip { max-width: 760px; }

/* ── Comment thread ──────────────────────────────────────────────────── */
.stg-thread { display: flex; flex-direction: column; gap: 12px; }
.stg-msg { display: flex; gap: 10px; }
.stg-av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--seg-bg); color: var(--text-2); }
.stg-msg-b { min-width: 0; flex: 1; }
.stg-msg-h { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.stg-msg-h b { color: var(--text); font-weight: 600; }
.stg-msg-t { margin-top: 3px; line-height: 1.5; }
.stg-reply { display: flex; gap: 8px; margin-top: 4px; }
.stg-reply .input { flex: 1; min-width: 0; padding: 0 12px; }

/* ── Toast and the close dialog ──────────────────────────────────────── */
.stg-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: var(--z-toast); max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 10px; background: var(--tooltip-bg); color: #fff; font-size: 13px; line-height: 1.4; box-shadow: var(--menu-shadow); }
.stg-dlg-scrim { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(0, 0, 0, .35); display: grid; place-items: center; padding: 16px; }
.stg-dlg { width: min(480px, 100%); background: var(--surface); border-radius: 14px; padding: 20px; box-shadow: var(--menu-shadow); display: flex; flex-direction: column; gap: 12px; }
.stg-dlg h3 { margin: 0; font-size: 16px; }
.stg-dlg ul { margin: 0; padding-left: 18px; line-height: 1.55; color: var(--text-2); }
.stg-dlg-acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ── Narrow screens (the width the screen gets) ──────────────────────── */
@container stg (max-width: 980px) {
  .stg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stg-two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767.98px) {
  .stg-head-acts { margin-left: 0; width: 100%; }
  .stg-head-acts .btn { flex: 1 1 auto; white-space: normal; height: auto; min-height: 36px; padding: 6px 12px; text-align: center; }
}
@container stg (max-width: 640px) {
  .stg-kpi { padding: 12px; }
  .stg-kpi-v { font-size: 19px; }
  .stg-chip { white-space: normal; height: auto; min-height: 26px; padding: 4px 10px; }
  .stg-notice > span { min-width: 0; flex-basis: 100%; }
  .stg-row-acts .btn { white-space: normal; height: auto; min-height: 36px; }
  .stg-grid { padding: 0 4px; }
  .stg-card-h h2 { flex-basis: 100%; }
}
@container stg (max-width: 420px) {
  .stg-kpis { grid-template-columns: minmax(0, 1fr); }
}

/* ── Plan baseline: the grid, and the agent's panel beside it ────────────
   The panel pushes the grid instead of covering it; its content keeps the
   panel's width and stays pinned right, so opening slides it in. */
.page.plan-page.stg-detail:has(.stg-split) { padding: 0 0 0 var(--gutter); }
.stg-split { flex: 1; min-height: 0; display: flex; }
.stg-split-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 18px var(--gutter) var(--gutter) 0; }
.stg-split-main > .plan { flex: 1; min-height: 0; }
/* The summary, its chat and a screen's settings run the window's height
   at its right, and the page (its top bar and the grid) makes room for
   them: #main gives up --stg-sum-w, the panel's width, set by panel_attrs.
   So both stay in view, and every panel starts at the top. */
.stg-sum { position: fixed; z-index: calc(var(--z-drawer) + 1); top: 0; right: 0; bottom: 0; height: calc(100dvh / var(--zoom, 1)); max-width: calc(100vw - 492px); overflow: hidden; background: var(--surface-light); border-left: 1px solid var(--border); transition: width 320ms var(--ease-out-cubic); }
/* Only a screen that draws the panel makes room for it: --stg-sum-w lives
   on <html> and outlives a boosted swap to a screen without one (Plan de
   abastecimiento before its first run kept the 400px the baseline left). */
#main:has(.stg-sum) { padding-right: var(--stg-sum-w, 0px); transition: padding-right 320ms var(--ease-out-cubic); }
/* Every panel's header is as tall as the top bar, so they line up. */
/* Every panel's header is the top bar's height, so its white band and
   border line up with the page's top bar. */
.stg-sum .stg-sum-head, .sup-line-panel .stg-sum-head { box-sizing: border-box; height: var(--topbar-h); min-height: var(--topbar-h); padding-top: 10px; padding-bottom: 10px; justify-content: center; overflow: hidden; }
.psp .psp-head, .psp .sdp-head { box-sizing: border-box; min-height: var(--topbar-h); }
/* A series' panel (planning/_panel.html, .sdp-head) beside the chat: its
   title centered in the same height, so the two bars read as one edge. */
.psp .sdp-head { align-items: center; padding-top: 8px; padding-bottom: 8px; }
.sup-line-panel .sp-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 767.98px) { #main:has(.stg-sum) { padding-right: 0; } }
.stg-sum:not(.is-open) { border-left-width: 0; box-shadow: none; }
.stg-sum.is-dragging { transition: none; user-select: none; }
.stg-sum-in { position: absolute; top: 0; right: 0; bottom: 0; max-width: 100%; display: flex; flex-direction: column; }
.stg-sum-handle { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; z-index: 2; cursor: ew-resize; touch-action: none; }
.stg-sum-handle:hover, .stg-sum.is-dragging .stg-sum-handle { background: color-mix(in srgb, var(--primary) 35%, transparent); }
.stg-sum-ttl { flex: 1; min-width: 0; }
.stg-sum-body { display: flex; flex-direction: column; gap: 22px; padding: 16px 20px 20px; }
.stg-sum-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stg-sum-kpis .stg-kpi { padding: 10px 12px; border-radius: 10px; }
.stg-sum-kpis .stg-kpi-v { font-size: 18px; }
.stg-sum-sec h3 { margin: 0; font-size: 13px; font-weight: 600; }
.stg-sum-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.stg-sum-h .btn { height: 28px; font-size: 12px; }
.stg-sum-note { margin: 0 0 8px; font-size: 12px; line-height: 1.4; color: var(--muted); }
/* What an org's plan does not have yet, said once at the panel's end (colaborativo.html). */
.stg-sum-soon { margin-top: 16px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; }
.stg-sum-soon .stg-sum-note { margin: 4px 0 0; }
/* The alerts' progress while the worker computes them (_baseline_alerts.html). */
.stg-progress { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin: 0 0 10px; }
.stg-progress > span { display: block; height: 100%; background: var(--primary); transition: width .4s ease; }
.stg-progress.is-busy > span { width: 30%; animation: stg-busy 1.2s ease-in-out infinite; }
@keyframes stg-busy { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .stg-progress.is-busy > span { animation: none; width: 100%; opacity: .4; } }
.stg-fix-link { align-self: flex-start; font-size: 12px; color: var(--primary); }
.stg-sev { margin-right: 6px; }
.stg-sev.sev-high { color: var(--error); }
.stg-sev.sev-mid { color: var(--warning); }
.stg-who-note { margin: 0 0 12px; }
.stg-sum-acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.stg-sum-btn { margin-right: 8px; }
@media (max-width: 767.98px) {
  .stg-sum { position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-drawer); max-width: 100vw; height: auto; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); }
  .stg-sum-in { max-width: 100vw; }
}

/* ── Column filters over the grid ───────────────────────────────────── */
/* In the grid's toolbar, between its search and its period picker. */
.stg-filters { flex: 0 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stg-split .pl-search { max-width: 280px; min-width: 170px; }
/* One line where it fits; a narrow screen takes the chips to a second. */
.stg-split .pl-tb-left { flex-wrap: wrap; row-gap: 8px; }
/* With "Filtrar por niveles" open, the plan's anchor notice (planning/
   _body.html) would take a second line over the grid: it folds to its
   icon, whose tip says it and whose click folds the filters back. */
.stg-split .pl-tb-left:has(.stg-levels[aria-expanded="true"]) .pl-anchornote { flex: none; padding: 0; }
.stg-split .pl-tb-left:has(.stg-levels[aria-expanded="true"]) .pl-anchornote > :not(.pl-anchor-fold) { display: none; }
.stg-split .pl-tb-left:has(.stg-levels[aria-expanded="true"]) .pl-anchor-fold { display: grid; }
.stg-split .pl-toolbar { align-items: flex-start; }
/* Nobody adjusts the baseline. The grid's own redraws (/planeamiento/body)
   do not know they are drawn here, so the Ajuste cell is held still. */
.stg-split .c-adj { pointer-events: none; }
.stg-fchip-wrap { position: relative; display: inline-flex; align-items: center; }
.stg-fchip { display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 0 6px 0 12px; border-radius: 8px; white-space: nowrap; border: 1px solid var(--border); background: var(--card); font-size: 12px; color: var(--text-2); }
.stg-fchip:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.stg-fchip.is-on { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
.stg-fchip.is-on b { font-weight: 600; }
.stg-fchip-wrap:has(.stg-fchip-x) .stg-fchip { padding-right: 26px; }
.stg-fchip-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--primary); }
.stg-fchip-x:hover { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.stg-fpop { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-menu); width: 280px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--menu-shadow); }
.stg-fpop-q { width: 100%; padding: 0 10px; height: 32px; }
.stg-fpop-list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; }
.stg-fpop-opt { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 6px; font-size: 12.5px; cursor: pointer; }
.stg-fpop-opt:hover { background: var(--hover); }
.stg-fpop-opt input { accent-color: var(--primary); margin: 0; }
.stg-fpop-acts { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.stg-fpop-acts .btn { height: 30px; }

/* ── Plan baseline's own top bar and toolbar ─────────────────────────────
   "Vistas" holds the grid's views, a past forecast, refresh and the XLSX;
   "Períodos" and "Filtrar por niveles" stand in the grid's toolbar for its
   period chip, its month button and the soon-to-come bulk edit. */
.stg-topbar { display: flex; align-items: center; gap: 8px; }
.stg-topbar #plan-part { display: none; }
.stg-menu-wrap { position: relative; }
.stg-views-btn { gap: 6px; }
.stg-views-btn b { font-weight: 600; }
.stg-menu { position: absolute; top: calc(100% + 6px); right: 0; padding: 6px 0; }
.stg-periods { left: 0; right: auto; }
.stg-menu-item { gap: 10px; height: 36px; }
.stg-menu-item[disabled] { opacity: .45; pointer-events: none; }
.stg-menu-check { display: inline-flex; width: 16px; color: var(--primary); }
.stg-menu-note { padding: 6px 12px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.stg-tools { flex: 0 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stg-levels { gap: 6px; padding-right: 8px; }
.stg-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; }
.stg-split .pl-horizon,
.stg-split .pl-tb-actions [hx-post^="/planeamiento/by-month"],
.stg-split .pl-tb-actions .is-soon,
.stg-split .pl-save { display: none; }

/* ── The panel's summary card and its lists ──────────────────────────────
   Built to hold dozens of findings: compact rows, a severity filter, the
   first few and "Ver N más". */
.stg-sum-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.stg-sum-card .stg-text { margin: 0; }
.stg-sum-card .stg-how { margin: 0; }
.stg-points { margin: 2px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.5; }
.stg-points li { margin: 0 0 6px; }
.stg-points li:first-child { font-weight: 600; }
.stg-flist-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.stg-flist-seg { flex-wrap: wrap; }
.stg-flist-seg button.is-on { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }
.stg-flist-picks { display: flex; gap: 2px; }
.stg-flist-picks .btn { height: 28px; padding: 0 6px; font-size: 12px; }
.stg-flist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--card); overflow: hidden; }
.stg-frow { padding: 8px 8px 8px 12px; border-top: 1px solid var(--border); }
.stg-flist > .stg-frow:first-child, .stg-flist > [style*="display: none"] + .stg-frow { border-top: 0; }
.stg-frow.is-off { opacity: .55; }
.stg-frow-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stg-frow-main input { margin: 0; accent-color: var(--primary); flex: none; }
.stg-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.stg-dot.sev-high { background: var(--error); }
.stg-dot.sev-mid { background: var(--warning); }
.stg-frow-t { flex: 1; min-width: 0; text-align: left; font-weight: 500; font-size: 12.5px; line-height: 1.35; color: var(--text); background: none; border: 0; padding: 0; cursor: pointer; }
.stg-frow-delta { flex: none; font-size: 12px; font-weight: 600; }
.stg-frow-x { flex: none; width: 26px; height: 26px; }
.stg-frow-sub { margin: 2px 0 0 37px; font-size: 11.5px; color: var(--muted); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stg-flist:not(:has(input)) .stg-frow-sub, .stg-flist:not(:has(input)) .stg-frow-more { margin-left: 15px; }
.stg-flist:not(:has(input)) .stg-frow-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.stg-frow-more { margin: 6px 0 2px 37px; font-size: 12px; color: var(--text-2); line-height: 1.45; display: flex; flex-direction: column; gap: 4px; }
.stg-frow-more p { margin: 0; }
.stg-flist:not(:has(input)) .stg-frow:has(.stg-frow-more:not([style*="none"])) .stg-frow-sub { -webkit-line-clamp: unset; }
.stg-flist-more { margin-top: 4px; height: 28px; font-size: 12px; }

/* ── Plan de abastecimiento ──────────────────────────────────────────────
   Plan de demanda's rows (.pg, .pr) with this screen's own columns, one
   set per view of the "Vistas" menu; the strip over the grid opens the
   panel's tabs. */
.sup-main { gap: 12px; }
.sup-main-in { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; container: sup / inline-size; }
.sup-strip { flex: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.sup-kpi { padding: 10px 12px; border-radius: 10px; text-align: left; gap: 2px; cursor: pointer; font: inherit; color: inherit; }
.sup-kpi:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.sup-kpi-v { font-size: 14px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.sup-kpi .stg-kpi-s { color: var(--muted); }
.sup-toolbar { flex: none; margin: 0; }
.sup-wrap { min-height: 320px; }

/* Columns: name, then one track per visible cell. Cells of other views
   are not drawn. */
.sup-grid { --c-name: minmax(190px, 1.7fr); --c-n: minmax(70px, 1fr); }
.sup-grid .c-num { justify-content: flex-end; white-space: nowrap; }
.sup-grid .pg-head .h { display: flex; align-items: center; min-width: 0; }
.sup-grid .pg-head .h-r { justify-content: flex-end; text-align: right; }
.sup-grid .pg-head .hs-static { font-size: 11.5px; font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-grid .pg-head .hs-static { white-space: normal; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* A header sorts and filters as Plan baseline's (planning.css .hs,
   .h-filter): its name keeps the grid's two lines, the arrow beside it. */
.sup-grid .pg-head .hs { font-size: 11.5px; color: var(--text-2); letter-spacing: normal; white-space: normal; text-align: inherit; }
.sup-grid .pg-head .hs > span { line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sup-grid .pg-head .hs.is-sort { color: var(--text); }
/* The order is the number the plan closes with: the calculation ends on
   it, after the cover it leaves. */
.sup-grid .c-ord { background: color-mix(in srgb, var(--primary) 6%, transparent); padding: 0 8px; }
.sup-grid .pg-head .c-ord .hs-static, .sup-grid .pg-head .c-ord .hs { color: var(--primary); }
/* The decision, then where it leaves the stock. */
.sup-v-calculo .c-ord, .sup-v-calculo .c-box { order: 2; }
.sup-v-calculo .c-cov, .sup-v-calculo .c-short { order: 3; }
.sup-v-calculo .c-val, .sup-v-calculo .c-sup,
.sup-v-proveedor .c-pol, .sup-v-proveedor .c-box,
.sup-v-pedido .c-risk, .sup-v-pedido .c-s, .sup-v-pedido .c-pos, .sup-v-pedido .c-need, .sup-v-pedido .c-adj, .sup-v-pedido .c-sup,
.sup-v-proveedor .c-risk, .sup-v-proveedor .c-dem, .sup-v-proveedor .c-ss, .sup-v-proveedor .c-s, .sup-v-proveedor .c-pos, .sup-v-proveedor .c-need, .sup-v-proveedor .c-adj, .sup-v-proveedor .c-cov, .sup-v-proveedor .c-short { display: none !important; }
/* Each view's tracks and min-width, as planning.css's .pg reads them. */
.sup-v-calculo { --cols: minmax(170px, 1.6fr) minmax(84px, .8fr) minmax(54px, .6fr) repeat(6, minmax(62px, 1fr)) minmax(72px, 1fr) minmax(56px, .7fr) minmax(64px, .8fr) minmax(76px, .8fr); --minw: 1040px; }
.sup-v-calculo .pg-head, .sup-v-calculo .pr { column-gap: 10px; }
.sup-v-pedido { --cols: var(--c-name) minmax(100px, 1fr) repeat(7, var(--c-n)); --minw: 720px; }
.sup-v-proveedor { --cols: var(--c-name) repeat(2, var(--c-n)) repeat(var(--nsup), minmax(96px, 1fr)); --minw: calc(500px + var(--nsup) * 104px); }
.sup-r.is-sel { box-shadow: inset 3px 0 0 var(--primary); background-image: linear-gradient(var(--hover), var(--hover)); }
.sup-mark { margin-left: 2px; color: var(--muted); cursor: help; }
.sup-pol { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--text-2); }
.sup-pol.is-mixed { color: var(--muted); font-style: italic; }
.sup-rules .stg-frow-t { cursor: default; font-weight: 400; }
.sup-rules .stg-frow-t b { font-weight: 600; }
.sup-rules .stg-frow-sub { margin-left: 0; white-space: normal; }
.sup-rules .stg-frow-main .btn { height: 26px; font-size: 12px; padding: 0 6px; }
.sup-rule-edit { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 10px; }
.sup-pfields { display: flex; flex-direction: column; gap: 6px; }
.sup-bt-bar { flex-wrap: wrap; gap: 8px; justify-content: space-between; }

/* The panel: tabs in its head, one form or list per tab. */
.sup-panel .sp-head { gap: 8px; }
#sup-panel { display: contents; }
.sup-win { gap: 8px; }
.sup-win-t { margin: 0; font-size: 14px; font-weight: 600; }
.sup-win-n { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); }
.sup-win form, .sup-win .stg-st { align-self: flex-start; }
.sup-bt-bar { display: flex; }
.sup-field-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.sup-field-inline select, .sup-field select, .sup-mix-bar .input { height: 32px; padding: 0 8px; font-size: 12.5px; }
.sup-runs .stg-frow.is-in { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.sup-runs .stg-frow-t { cursor: default; }
.sup-runs .stg-frow-main form { flex: none; }
.sup-runs .stg-frow-main .btn { height: 26px; padding: 0 6px; font-size: 12px; }
.sup-runs .stg-frow-sub { margin-left: 0; white-space: normal; }
.sup-run-n { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: 11.5px; color: var(--text-2); }
.sup-run-n b { font-weight: 600; color: var(--text); }
.sup-run-n .is-crit b { color: var(--primary); }
.sup-details summary { cursor: pointer; font-size: 12px; color: var(--primary); }
.sup-details .stg-how { font-size: 12px; }
.sup-code { display: block; font-family: var(--font-mono, ui-monospace, monospace); font-size: 10.5px; color: var(--muted); }
.stg-frow-sub .sup-code { display: inline; }
.sup-form .stg-sum-sec { display: flex; flex-direction: column; gap: 8px; }
.sup-radio { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 12.5px; cursor: pointer; }
.sup-radio input { margin: 3px 0 0; accent-color: var(--primary); flex: none; }
.sup-radio small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.sup-radio.sm { padding: 3px 0; }
.sup-kinds { display: flex; flex-direction: column; padding: 4px 0 0 22px; }
.sup-fields { display: flex; flex-direction: column; gap: 12px; }
.sup-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.sup-field > span:first-child { font-weight: 600; }
.sup-field small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.sup-unit { display: inline-flex; align-items: center; gap: 6px; }
.sup-unit .input { width: 84px; height: 32px; padding: 0 8px; text-align: right; }
.sup-unit em { font-style: normal; font-size: 12px; color: var(--muted); }
.sup-unit.sm .input { width: 64px; height: 28px; }
.sup-formula { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sup-form-acts { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.sup-form-acts .stg-muted { margin-right: auto; font-size: 12px; }
.sup-add { gap: 10px; }
.sup-add-btn { align-self: flex-start; gap: 6px; }
.sup-crow .stg-frow-t { cursor: default; }
.sup-crow .stg-frow-sub { white-space: normal; }
.sup-sups { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.sup-sup { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.sup-sup:first-child { border-top: 0; }
.sup-sup-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.sup-sup-h .stg-muted { font-size: 11.5px; }
.sup-sup-b { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12px; color: var(--text-2); }
.sup-mix-bar { display: flex; gap: 8px; margin-bottom: 8px; }
.sup-mix-bar .input { flex: 1; min-width: 0; }
.sup-mix .stg-frow-sub { margin-left: 0; white-space: normal; }
.sup-mix .stg-frow-main .btn { height: 26px; font-size: 12px; padding: 0 6px; }
.sup-mix-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.sup-mix-edit .sup-unit { justify-content: space-between; }
.sup-mix-n { font-size: 12px; flex: 1; }
.sup-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.sup-check input { accent-color: var(--primary); }
.sup-more-li { list-style: none; padding: 0 8px; }

/* One line explained: each step a row, the order last. */
.sup-steps { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.sup-steps li { padding: 10px 12px; border-top: 1px solid var(--border); }
.sup-steps li:first-child { border-top: 0; }
.sup-steps li.is-sum { background: color-mix(in srgb, var(--surface-light) 40%, transparent); }
.sup-steps li.is-order { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.sup-step-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12.5px; }
.sup-step-h b { font-size: 13.5px; }
.sup-step-d { margin: 4px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.sup-weeks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sup-weeks span { display: flex; flex-direction: column; align-items: flex-end; padding: 3px 6px; border-radius: 6px; background: var(--hover); font-size: 11.5px; }
.sup-weeks span.is-beyond { background: none; border: 1px dashed var(--border); }
.sup-weeks small { font-size: 10px; color: var(--muted); }
.sup-line-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sup-line-form .btn { height: 28px; font-size: 12px; }
.sup-line { display: flex; flex-direction: column; gap: 16px; }
.sup-line .sup-steps { margin: 0; }
.sup-parts { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.sup-parts li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
.sup-parts li .stg-muted { grid-column: 1 / -1; font-size: 11.5px; }

/* Narrow: the strip scrolls sideways instead of stacking over the grid. */
@container sup (max-width: 900px) {
  .sup-strip { display: flex; overflow-x: auto; scrollbar-width: none; }
  .sup-kpi { flex: none; width: 190px; }
}
@container sup (max-width: 560px) {
  .sup-toolbar .pl-search { min-width: 0; max-width: none; flex: 1 1 100%; }
}
@media (max-width: 767.98px) {
  .sup-topbar .stg-views-btn > span, .sup-topbar .stg-views-btn > b, .sup-topbar .sup-go-t { display: none; }
  .sup-wrap { min-height: 420px; }
}

/* ── Who is looking ("Ver como", admins) ─────────────────────────────── */
.stg-as { flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 var(--gutter) 10px 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--hover); font-size: 12.5px; line-height: 1.4; }
.stg-as > span { flex: 1; min-width: 200px; }
.stg-menu .stg-area { margin-left: auto; padding-left: 10px; }
.stg-sub-ok { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; color: var(--text); }
.stg-sub-ok svg { color: var(--primary); }

/* ── Resumen IA's conversation ───────────────────────────────────────── */
.stg-chat { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.stg-chat-log { display: flex; flex-direction: column; gap: 10px; }
.stg-chat-msg { display: flex; flex-direction: column; gap: 2px; max-width: 92%; }
.stg-chat-msg p { margin: 0; padding: 8px 11px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); line-height: 1.5; font-size: 13px; }
.stg-chat-msg.is-me { align-self: flex-end; align-items: flex-end; }
.stg-chat-msg.is-me p { background: var(--hover); border-color: transparent; }
.stg-chat-who { font-size: 11px; font-weight: 600; color: var(--muted); }
.stg-chat-sug { display: flex; flex-wrap: wrap; gap: 6px; }
.stg-chat-sug .stg-fchip { height: auto; min-height: 28px; white-space: normal; text-align: left; padding: 4px 10px; }
.stg-chat .stg-reply .input { height: 36px; }
.stg-chat h3 { margin: 0; font-size: 13px; font-weight: 600; }
.stg-sum-kpis.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@container (max-width: 380px) { .stg-sum-kpis.is-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Plan colaborativo's lines ───────────────────────────────────────── */
.stg-lines { margin-bottom: 16px; }
.stg-lines .stg-card-h .seg a { height: 28px; padding: 0 12px; font-size: 12px; }
.stg-line { cursor: pointer; }
.stg-line:hover td { background: var(--hover); }
.stg-line .stg-first a { color: inherit; }
.stg-line .stg-first .stg-st { margin-left: 6px; }
.stg-last { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; }
.stg-last b { color: var(--text); font-weight: 600; }
.stg-frow-main a.stg-frow-t { color: inherit; text-decoration: none; }
.stg-frow-main a.stg-frow-t:hover { text-decoration: underline; }
.stg-frow-main .stg-sp { flex: 1; }
.stg-frow-main .stg-who { flex-direction: row; align-items: center; gap: 8px; }

/* ── Ciclo S&OP ──────────────────────────────────────────────────────── */
.stg.cyc { max-width: none; gap: 12px; }
.cyc h2, .cyc h3 { margin: 0; }
.cyc-card-h, .cyc-now-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px 0; }
.cyc-card-h h2, .cyc-now-h h2 { font-size: 15px; font-weight: 600; }
.cyc-card-h p, .cyc-now-h p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.cyc-link { align-self: flex-start; font-size: 12.5px; font-weight: 600; color: var(--primary); text-decoration: none; }
.cyc-link:hover { text-decoration: underline; }
.cyc-step-k { font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.cyc-dot { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--card); font-size: 12px; font-weight: 700; color: var(--text-2); }
.cyc-who { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; }

/* Ciclo actual: the month as a timeline, one column per step. Each step
   is a subgrid of the track's rows, so every row lines up across steps. */
.cyc-count { font-size: 12.5px; color: var(--muted); padding-top: 2px; }
.cyc-track { list-style: none; margin: 0; padding: 16px 8px 8px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(8, auto); column-gap: 0; }
.cyc-step { position: relative; grid-row: span 8; display: grid; grid-template-rows: subgrid; row-gap: 6px; justify-items: start; padding: 10px 12px 12px; border-radius: 10px; }
.cyc-step::before { content: ""; position: absolute; top: 24px; left: 46px; right: -6px; height: 1.5px; background: var(--border); }
.cyc-step:last-child::before { display: none; }
.cyc-step.is-done::before { background: color-mix(in srgb, var(--text-2) 45%, var(--border)); }
.cyc-step.is-cur { background: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.cyc-step .cyc-dot { position: relative; margin-bottom: 4px; }
.cyc-step.is-done .cyc-dot { border-color: var(--border); background: var(--hover); color: var(--text-2); }
.cyc-step.is-cur .cyc-dot { border-color: var(--primary); background: var(--primary); color: #fff; }
.cyc-step.is-late .cyc-dot { border-color: var(--error); color: var(--error); }
.cyc-step h3 { font-size: 14px; font-weight: 600; }
.cyc-when { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.2px; line-height: 1.25; }
.cyc-when.is-sm { font-size: 14px; font-weight: 600; letter-spacing: 0; line-height: 1.4; }
.cyc-state { font-size: 12.5px; color: var(--text-2); }
.cyc-step.is-cur .cyc-state { color: var(--primary); font-weight: 600; }
.cyc-step.is-late .cyc-state { color: var(--error); font-weight: 600; }
.cyc-step-d { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.cyc-bar { align-self: center; width: 100%; max-width: 200px; height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; }
.cyc-bar i { display: block; height: 100%; border-radius: 2px; background: var(--primary); }
.cyc-step.is-done .cyc-bar i { background: var(--text-2); }
.cyc-step.is-late .cyc-bar i { background: var(--error); }
.cyc-people { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.cyc-open { align-self: end; display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }
.cyc-open:hover { text-decoration: underline; }

/* Ciclo actual: who answers, one column per stage. */
.cyc-resp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 16px 4px 18px; }
.cyc-resp-col { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px; }
.cyc-resp-col + .cyc-resp-col { border-left: 1px solid var(--border); }
.cyc-resp-t { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.cyc-resp-t .stg-muted { font-size: 12px; }
.cyc-resp-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cyc-resp-col li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }

/* Proceso: the steps down the side, one configured at a time. */
.cyc-proc { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 12px; align-items: start; }
.cyc-rail { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.cyc-rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cyc-rail li { position: relative; }
.cyc-rail li:not(:last-child)::after { content: ""; position: absolute; left: 23px; top: 40px; bottom: -6px; width: 1.5px; background: var(--border); }
.cyc-rail-k { padding: 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.cyc-rail-i { width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 0; border-radius: 9px; background: none; font: inherit; text-align: left; color: var(--text); cursor: pointer; }
.cyc-rail-i:hover { background: var(--hover); }
.cyc-rail-i.is-on { background: color-mix(in srgb, var(--primary) 8%, var(--card)); }
.cyc-rail-i.is-on .cyc-dot { border-color: var(--primary); background: var(--primary); color: #fff; }
.cyc-rail-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 4px; }
.cyc-rail-t b { font-size: 13px; font-weight: 600; }
.cyc-rail-t small { font-size: 11.5px; line-height: 1.35; color: var(--muted); }
.cyc-rail-n { margin: 0 4px; font-size: 11.5px; line-height: 1.4; color: var(--muted); text-align: center; }
.cyc-pane { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cyc-stage { display: flex; flex-direction: column; gap: 12px; }
.cyc-stage-h { display: flex; flex-direction: column; gap: 4px; }
.cyc-stage-h h2 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.cyc-stage-h p { margin: 0; font-size: 13px; color: var(--text-2); }
.cyc-sec { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.cyc-sec-h { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.cyc-sec-h h3 { font-size: 14px; font-weight: 600; }
.cyc-sec-h p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); max-width: 640px; }
/* A row: the label, then its control right beside it (not at the far
   end of a wide card); the step itself keeps a readable width. */
.cyc-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: center; justify-items: start; gap: 16px; padding: 8px 0; border-top: 1px solid var(--border); }
.cyc-row > :last-child:not(:first-child) { max-width: 100%; }
.cyc-sec-h + .cyc-row, .cyc-sec-h + input + .cyc-row { border-top: 0; }
.cyc-sec.is-set .cyc-sec-h + .cyc-row + input + .cyc-row { border-top: 1px solid var(--border); }
.cyc-row-l { display: flex; flex-direction: column; gap: 2px; font-size: 13px; font-weight: 600; color: var(--text); }
.cyc-row-l small { font-size: 12px; font-weight: 400; color: var(--muted); }
.cyc-row .cyc-pick { width: 280px; max-width: 100%; }
.cyc-seg { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--seg-bg, var(--hover)); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.cyc-seg a { flex: none; display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 7px; font-size: 12.5px; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.cyc-seg a:hover { color: var(--text); }
.cyc-seg a.is-on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }
.cyc-pane:disabled .cyc-seg { pointer-events: none; opacity: .7; }
.cyc-warn { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 6px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warning) 9%, transparent); font-size: 12.5px; line-height: 1.45; color: var(--text); }
.cyc-warn svg { flex: none; color: var(--warning); margin-top: 1px; }
.cyc-pick .cyc-chip { width: 100%; height: 38px; justify-content: space-between; gap: 8px; padding: 0 6px 0 12px; font-size: 13px; color: var(--text); }
.cyc-chip-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; font-weight: 600; }
.cyc-chip.is-empty .cyc-chip-v { font-weight: 400; color: var(--muted); }
.cyc-chip-t { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cyc-chip:disabled { cursor: default; background: var(--hover); }
.cyc-pop { left: auto; right: 0; width: 300px; }
.cyc-opt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cyc-opt small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.cyc-opt small:empty { display: none; }
.cyc-nodes { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.cyc-nodes-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.cyc-nodes-q { width: 240px; max-width: 100%; height: 34px; }
.cyc-nodes-l { list-style: none; margin: 0; padding: 4px 12px; max-height: 440px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.cyc-nodes-l li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cyc-nodes-l li:last-child { border-bottom: 0; }
.cyc-nodes-l li.stg-muted { padding: 10px 0; font-size: 12.5px; }
.cyc-node { min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cyc-nodes-l .cyc-pick { flex: none; width: 260px; max-width: 55%; }
.cyc-nodes-l .cyc-chip { height: 34px; }
/* A step fills the screen's height; its node list scrolls inside, so the
   card neither leaves a gap below nor pushes the page. */
.stg.cyc:has(> .cyc-proc) { height: 100%; min-height: 560px; }
.cyc-proc { flex: 1 1 auto; min-height: 0; align-items: stretch !important; }
.cyc-rail { align-self: start; }
.cyc-pane { min-height: 0; }
.cyc-stage { flex: 1 1 auto; min-height: 0; }
.cyc-sec.is-list { flex: 1 1 auto; min-height: 0; }
.cyc-sec.is-list .cyc-nodes { flex: 1 1 auto; min-height: 0; padding-top: 0; border-top: 0; }
.cyc-sec.is-list .cyc-nodes-l { flex: 1 1 auto; min-height: 0; max-height: none; }
/* Wide: the step's settings on the left, its node list on the right at
   full height. */
@container stg (min-width: 1180px) {
  .cyc-stage { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); grid-template-rows: auto auto minmax(0, 1fr); align-content: stretch; }
  .cyc-stage-h { grid-column: 1 / -1; }
  .cyc-stage > .cyc-sec:not(.is-list) { grid-column: 1; align-self: start; }
  .cyc-stage > .cyc-sec.is-list { grid-column: 2; grid-row: 2 / 4; }
}
.cyc-rail-acts { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.cyc-rail-acts .btn { width: 100%; justify-content: center; }

/* Historial. */
.cyc-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cyc-kpis > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.cyc-kpis span { font-size: 12px; color: var(--muted); }
.cyc-kpis b { font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.cyc .stg-card > .stg-tbl-wrap { margin-top: 12px; }
.cyc-hist td { padding: 11px 14px; }
.cyc-hist th { padding: 9px 14px; }
.cyc-cell { display: inline-flex; align-items: center; gap: 8px; }
.cyc-fva-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 12px; padding: 0 16px; }
.cyc-fva-take { margin: 14px 0 12px; padding: 0 16px; font-size: 13.5px; line-height: 1.5; }
.cyc-fva-note { margin: 0; padding: 10px 16px 14px; font-size: 12px; line-height: 1.45; border-top: 1px solid var(--border); }
.cyc-fva-ref td { color: var(--text-2); font-style: italic; }
.cyc-empty { padding: 28px 14px !important; text-align: center; color: var(--muted); white-space: normal !important; }

@container stg (max-width: 980px) {
  .cyc-track { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(16, auto); row-gap: 16px; }
  .cyc-step:nth-child(2n)::before { display: none; }
  .cyc-resp-cols { grid-template-columns: minmax(0, 1fr); }
}
@container stg (max-width: 760px) {
  .cyc-proc { grid-template-columns: minmax(0, 1fr); }
  .cyc-rail { position: static; }
  .cyc-track, .cyc-kpis { grid-template-columns: minmax(0, 1fr); }
  .cyc-step::before { display: none; }
  .cyc-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .cyc-row .cyc-pick { width: 100%; }
}

/* ── Top bar on narrow screens; segmented controls outside the old head ─ */
.stg-topbar { flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 100%; }
@media (max-width: 767.98px) {
  .stg-topbar { gap: 6px; }
  .stg-topbar .stg-views-btn > span:first-of-type { display: none; }
  .stg-topbar .btn { padding: 0 10px; }
}
.stg .seg a.is-on, .stg-lines .seg a.is-on { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .10); color: var(--text); }
/* On a phone the stage's top bar goes under the title, not over it. */
@media (max-width: 767.98px) {
  .topbar:has(.stg-topbar) { flex-wrap: wrap; height: auto; padding-bottom: 8px; row-gap: 8px; }
  .topbar:has(.stg-topbar) .tb-actions { order: 3; flex: 1 1 100%; margin-left: 12px; min-width: 0; }
  .topbar:has(.stg-topbar) .stg-topbar { justify-content: flex-start; }
}

/* Stockcast's charts (stages_supply_charts): SVG drawn on the server,
   sized by the panel. */
.sup-chart { margin: 0; }
.sup-chart svg { display: block; width: 100%; height: auto; }
.sup-ev .stg-tbl { font-size: 11.5px; }
.sup-ev .stg-tbl th, .sup-ev .stg-tbl td { padding: 5px 7px; }
.sup-ev { border: 1px solid var(--border); border-radius: 10px; max-height: 320px; overflow: auto; }
.sup-running { gap: 4px; }
.sup-bt-pick { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 4px 0 6px; }
.sup-bt-pick select { max-width: 100%; }
.sup-chart-how { margin-top: 2px; }
.sup-bt-chart { min-height: 120px; }
.sup-rules + .sup-add, .sup-rules ~ .sup-add { margin-top: 12px; }
.sup-rules .stg-frow { padding-top: 10px; padding-bottom: 10px; }
.sup-wrap { position: relative; }
.sup-wrap .pg-body { padding-bottom: 76px; }

/* The configuration's cards: a policy, a kind of constraint, the costs. */
.sup-cards { display: flex; flex-direction: column; gap: 10px; }
.sup-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.sup-card.is-editing { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.sup-card.is-soon { background: color-mix(in srgb, var(--surface-light) 35%, var(--card)); }
.sup-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sup-card-scope { font-size: 12.5px; font-weight: 600; color: var(--text); }
.sup-card-t { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.sup-card-d { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-2); }
.sup-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.sup-facts span { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--hover); font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.sup-danger { color: var(--error); }
.sup-card-add { display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; border: 1px dashed var(--border); border-radius: 12px; background: none; color: var(--primary); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.sup-card-add:hover { background: var(--hover); }
.sup-card .sup-rule-edit { margin-top: 2px; }
.sup-crule-add { display: flex; flex-direction: column; gap: 8px; }
.sup-switch { flex: none; position: relative; width: 34px; height: 20px; border-radius: 10px; border: 1.5px solid var(--muted); background: var(--surface-light); cursor: pointer; padding: 0; transition: background-color 120ms linear, border-color 120ms linear; }
.sup-switch i { position: absolute; top: 3.5px; left: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); transition: all 120ms var(--ease-out-cubic); }
.sup-switch.is-on { background: color-mix(in srgb, var(--primary) 46%, var(--card)); border-color: var(--primary); }
.sup-switch.is-on i { left: 16px; top: 1.5px; width: 14px; height: 14px; background: var(--primary); }
.sup-formula-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 6px; }
.sup-formula-row > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.sup-formula-row > div.is-h { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.sup-formula-row b { font-size: 16px; }
.sup-formula-row small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.sup-formula-row > span { align-self: center; font-size: 16px; color: var(--muted); }
/* The backtest's "Medir sobre": a search over policies and the hierarchy. */
.sup-seg { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 100%; }
.sup-seg-btn { min-width: 0; max-width: 100%; gap: 6px; }
.sup-seg-btn > span { overflow: hidden; text-overflow: ellipsis; }
.sup-seg-pop { width: 340px; }
.sup-seg-g { padding: 8px 4px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.sup-seg-opt { width: 100%; text-align: left; background: none; border: 0; font: inherit; font-size: 12.5px; color: var(--text); }
.sup-seg-opt.is-on { color: var(--primary); font-weight: 600; }
/* Where the plan's demand comes from, over the grid. */
.sup-source { flex: none; margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-2); }
.sup-source b { color: var(--text); font-weight: 600; }

/* ── Tabs in the top bar (Ciclo S&OP), as Eventos' and Inputs' ───────── */
.stg-tbseg { display: flex; height: 38px; padding: 2px; border-radius: 8px; background: var(--hover); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.stg-tbseg a { display: inline-flex; align-items: center; padding: 0 12px; border-radius: 6px; font-size: 12px; font-weight: 600; letter-spacing: .25px; color: var(--text-2); border: 1px solid transparent; white-space: nowrap; text-decoration: none; }
.stg-tbseg a:hover:not(.is-on) { background: var(--hover); }
.stg-tbseg a.is-on { background: var(--card); border-color: var(--border); color: var(--text); }
@media (max-width: 767.98px) {
  .topbar:has(.stg-tbseg) { flex-wrap: wrap; height: auto; padding-bottom: 8px; row-gap: 8px; }
  .topbar:has(.stg-tbseg) .tb-actions { order: 3; flex: 1 1 100%; margin-left: 12px; min-width: 0; }
}


/* ── Resumen IA over the whole screen ────────────────────────────────────
   An overlay from the top of the window, as the series' panel: the page's
   background under white cards, so they read apart in light mode. */
.stg-sum-head { flex: none; display: flex; align-items: center; gap: 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.stg-sum-head .stg-sum-ttl { display: flex; flex-direction: column; gap: 2px; }
.stg-chat-cta { height: 32px; padding: 0 12px; font-size: 12.5px; gap: 6px; white-space: nowrap; }
.stg-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font-size: 12px; color: var(--muted); cursor: pointer; }
.stg-back:hover { color: var(--text); }
.stg-sum .stg-sum-card, .stg-sum .stg-flist, .stg-sum .stg-kpi { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }

/* ── The summary, and the chat it turns into ─────────────────────────── */
.stg-convo { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
/* "Chatear sobre esto": the summary rises and shrinks into the chat's top
   right corner, where it lands as the person's first bubble (.stg-brief). */
.stg-view-sum { flex: 1; min-height: 0; overflow-y: auto; transform-origin: 100% 0; }
.stg-view-sum.is-sending { animation: stg-send 420ms var(--ease-in-cubic, ease-in) forwards; }
@keyframes stg-send { to { transform: translate(-20px, 18px) scale(.5); opacity: 0; border-radius: 16px; } }
.stg-view-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stg-convo-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 12px; }
.stg-msg-row { display: flex; }
.stg-msg-row.is-me { justify-content: flex-end; }
.stg-msg-row.is-fresh { animation: stg-pop 360ms var(--ease-out-cubic, ease-out) both; }
.stg-msg-row.is-fresh.is-me { transform-origin: 100% 100%; }
/* The summary's bubble arrives from where the summary went: from above,
   settling down into place. */
.stg-msg-row.is-fresh.is-me:has(.stg-brief) { transform-origin: 100% 0; animation-name: stg-land; }
@keyframes stg-land { from { opacity: 0; transform: translateY(-12px) scale(1.04); } }
.stg-msg-row.is-fresh.is-ai { transform-origin: 0 100%; }
@keyframes stg-pop { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.stg-bubble { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 4px; }
.stg-bubble.is-me { background: var(--text); color: var(--bg); border-bottom-right-radius: 5px; }
.stg-bubble.is-ai { background: var(--card); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.stg-bubble-go { font-size: 11.5px; color: var(--primary); }
.stg-brief { max-width: 88%; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 16px; border-bottom-right-radius: 5px; background: var(--text); color: var(--bg); font-size: 12.5px; line-height: 1.45; }
.stg-brief-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; opacity: .7; }
.stg-brief b { font-size: 13.5px; }
.stg-brief p { margin: 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; opacity: .9; }
.stg-brief-facts { display: flex; flex-wrap: wrap; gap: 4px; }
.stg-brief-facts span { padding: 2px 8px; border-radius: 10px; background: color-mix(in srgb, var(--bg) 16%, transparent); font-size: 11px; }
.stg-typing { flex-direction: row; align-items: center; gap: 4px; padding: 12px 14px; }
.stg-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: stg-dot 1.1s ease-in-out infinite; }
.stg-typing i:nth-child(2) { animation-delay: .15s; } .stg-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes stg-dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* The questions to start with: a row that cycles on its own, paused on
   hover, so it takes one line of height. */
.stg-convo-foot { flex: none; display: flex; flex-direction: column; gap: 10px; padding: 10px 16px 14px; background: var(--surface); border-top: 1px solid var(--border); }
.stg-marquee { overflow: hidden; margin: 0 -16px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.stg-marquee-track { display: flex; gap: 8px; width: max-content; padding: 0 16px; animation: stg-cycle 28s linear infinite; }
.stg-marquee:hover .stg-marquee-track, .stg-marquee:focus-within .stg-marquee-track { animation-play-state: paused; }
@keyframes stg-cycle { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .stg-marquee-track { animation: none; } .stg-marquee { overflow-x: auto; } .stg-view-sum.is-sending, .stg-msg-row.is-fresh, .stg-msg-row.is-fresh.is-me:has(.stg-brief), .stg-typing i { animation: none; } }
.stg-qcard { flex: none; max-width: 240px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 12.5px; line-height: 1.35; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.stg-qcard:hover:not(:disabled) { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.stg-qcard:disabled { opacity: .5; cursor: default; }

/* The composer: the send button at the field's foot, centered on its
   last line, so a question of several lines grows upward from it. */
.stg-composer { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--border); border-radius: 22px; background: var(--card); }
.stg-composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.stg-composer textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 14px; line-height: 20px; height: 20px; max-height: 120px; overflow-y: hidden; margin: 0 0 7px; padding: 0; }
.stg-send { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; cursor: pointer; transition: opacity 120ms; }
.stg-send:disabled { opacity: .35; cursor: default; }
[data-theme="dark"] .stg-sum { background: var(--bg); }
/* The questions fold away while the person types (and while an answer
   comes), and come back when the field is empty. */
.stg-marquee { max-height: 48px; transition: max-height 240ms var(--ease-out-cubic, ease-out), opacity 180ms linear, margin 240ms var(--ease-out-cubic, ease-out); }
.stg-marquee.is-hidden { max-height: 0; opacity: 0; margin-bottom: -10px; pointer-events: none; }

/* ── Plan de abastecimiento, strategy panel (2026-10-29) ────────────────
   Header with its title over tabs that share the width; filter chips as
   "Filtrar por niveles"; cards with even spacing; segmented choices and
   option cards instead of radios; number fields with their unit inside. */
.content:has(.sup-page) > .fab-wrap { display: none; } /* "Generar órdenes" holds that corner */
.sup-fab { position: absolute; right: 20px; bottom: 20px; z-index: 3; height: 44px; padding: 0 20px; gap: 8px; border-radius: 22px; font-size: 14px; font-weight: 600; box-shadow: 0 2px 4px rgba(0, 0, 0, .14), 0 6px 16px rgba(0, 0, 0, .18); }
.sup-pill { width: 76px; margin-left: auto; }
.sup-pill input { text-align: right; padding-right: 12px; }

.sup-panel .sp-head.sup-head { flex-direction: column; align-items: stretch; gap: 0; padding: 10px 20px; }
.sup-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.sup-head-row .icon-btn { margin-right: -6px; }
.sup-head-row .sp-title { font-size: 16px; }

.sup-tab { display: flex; flex-direction: column; gap: 16px; }
.sup-lead { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.sup-sec { display: flex; flex-direction: column; gap: 10px; }
.sup-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sup-sec-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.sup-select { height: 34px; padding: 0 10px; font-size: 13px; border-radius: 8px; max-width: 100%; }
.sup-kicker { font-size: 12px; font-weight: 600; color: var(--text-2); }
.sup-card { gap: 10px; padding: 16px; }
.sup-card-d { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.sup-card-acts { display: flex; gap: 8px; }
.sup-card .btn.sm, .sup-card-more { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 4px; align-self: flex-start; }
.sup-card-form { display: flex; flex-direction: column; gap: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.sup-card-add { height: 48px; font-size: 13px; }
.sup-facts span.is-bad { color: var(--error); background: color-mix(in srgb, var(--error) 10%, transparent); }
.sup-warn { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; color: var(--warning); }

/* Filter chips: a muted key and the value it holds. */
.sup-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.sup-pick { position: relative; min-width: 0; max-width: 100%; }
.sup-chip { gap: 6px; max-width: 100%; padding: 0 6px 0 12px; font-size: 12.5px; }
.sup-chip-k { color: var(--muted); }
.sup-chip-v { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--text); }
.sup-chip.is-on { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.sup-chip-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 200px; z-index: var(--z-menu); }
.sup-pick-pop { width: 360px; max-width: min(360px, calc(100vw - 32px)); gap: 10px; padding: 10px; }
.sup-pick-lv { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--seg-bg); overflow-x: auto; scrollbar-width: none; }
.sup-pick-lv button { flex: 1 0 auto; height: 28px; padding: 0 6px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; }
.sup-pick-lv button.is-on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }
.sup-pick-q { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--muted); }
.sup-pick-q:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.sup-pick-q input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 13px; color: var(--text); }
.sup-pick-list { display: flex; flex-direction: column; max-height: 280px; overflow-y: auto; }
.sup-pick-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13px; text-align: left; color: var(--text); cursor: pointer; }
.sup-pick-opt:hover { background: var(--hover); }
.sup-pick-opt svg { flex: none; visibility: hidden; color: var(--primary); }
.sup-pick-opt.is-on { color: var(--primary); font-weight: 600; }
.sup-pick-opt.is-on svg { visibility: visible; }
.sup-pick-none { margin: 0; padding: 10px; font-size: 12.5px; color: var(--muted); }
.sup-fld .sup-pick-pop { left: 0; right: 0; width: auto; max-width: none; }
.sup-fld .sup-pick .sup-chip { width: 100%; justify-content: space-between; height: 38px; }

/* "Cómo funciona": a card that opens. */
.sup-how { border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.sup-how > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; list-style: none; cursor: pointer; }
.sup-how > summary::-webkit-details-marker { display: none; }
.sup-how > summary > svg { order: 2; margin-left: auto; color: var(--muted); transition: transform 150ms var(--ease-out-cubic); }
.sup-how[open] > summary > svg { transform: rotate(180deg); }
.sup-how-t { flex: 1 1 auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.sup-how-t svg { color: var(--primary); }
.sup-how-f { order: 3; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.sup-how-f span { height: 22px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: 11px; background: var(--hover); font-size: 11.5px; color: var(--text-2); }
.sup-how-b { padding: 0 14px 14px; font-size: 12.5px; line-height: 1.55; color: var(--text-2); }
.sup-how-b p { margin: 0 0 8px; }
.sup-how-b ul { margin: 0 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.sup-how-b b { color: var(--text); font-weight: 600; }
.sup-how-demo { padding: 8px 10px; border-radius: 8px; background: var(--hover); }

/* The backtest's result. */
.sup-running { flex-direction: row; align-items: center; gap: 14px; }
.sup-spin { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--primary); border-right-color: transparent; animation: sup-spin 800ms linear infinite; }
.sup-spin.sm { width: 10px; height: 10px; border-width: 1.5px; }
@keyframes sup-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sup-spin { animation-duration: 2.4s; } }
.sup-st-run { gap: 6px; }
.sup-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.sup-kpis > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--hover); }
.sup-kpis b { font-size: 16px; font-weight: 700; color: var(--text); }
.sup-kpis small { font-size: 11.5px; color: var(--muted); }
.sup-win-go { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.sup-runs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.sup-runs li { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sup-run-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.sup-run-h .btn { height: 28px; }
.sup-run-t { font-size: 13px; font-weight: 600; }
.sup-run-n { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; border-radius: 50%; background: var(--hover); font-size: 11px; font-weight: 600; color: var(--text-2); }
.sup-run-m { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-left: 28px; font-size: 12px; color: var(--muted); }
.sup-run-m b { color: var(--text-2); font-weight: 600; }
.sup-run-m .is-crit b { color: var(--primary); }

/* Fields: a label, the control, a line of help. */
.sup-pfields { display: flex; flex-direction: column; gap: 18px; }
.sup-fld { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sup-fld-l { font-size: 12.5px; font-weight: 600; color: var(--text); }
.sup-fld-h { font-size: 12px; line-height: 1.45; color: var(--muted); }
.sup-fld-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.sup-fld-col { display: flex; flex-direction: column; gap: 14px; }
.sup-seg { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--seg-bg); }
.sup-seg label { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; height: 32px; padding: 0 8px; border-radius: 7px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; cursor: pointer; transition: color 120ms linear; }
.sup-seg label:hover { color: var(--text); }
.sup-seg label.is-on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }
.sup-seg input, .sup-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.sup-seg label:has(input:focus-visible), .sup-opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
.sup-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.sup-opt { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); cursor: pointer; transition: border-color 120ms linear, background 120ms linear; }
.sup-opt:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.sup-opt b { font-size: 13px; font-weight: 600; color: var(--text); }
.sup-opt small { font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.sup-opt.is-on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--card)); box-shadow: 0 0 0 1px var(--primary); }
.sup-num { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); cursor: text; }
.sup-num:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.sup-num input { width: 64px; height: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 14px; font-weight: 600; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.sup-num em { font-style: normal; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* Constraints' rules: the switch flips on the press, no spinner over it. */
.sup-switch .busy-spin { display: none; }
.sup-switch:disabled { opacity: 1; cursor: progress; }

/* Costs: how a lost sale weighs against stock. */
.sup-range { --p: 50%; -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: 0; background: transparent; cursor: pointer; }
.sup-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--primary) var(--p), var(--seg-bg) var(--p)); }
.sup-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--primary); border: 3px solid var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.sup-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--seg-bg); }
.sup-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--primary); }
.sup-range::-moz-range-thumb { width: 16px; height: 16px; border: 3px solid var(--card); border-radius: 50%; background: var(--primary); }
.sup-range-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.sup-range-say { margin: 4px 0 0; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--text); }
.sup-soon { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--hover); font-size: 12px; line-height: 1.45; color: var(--text-2); }
.sup-soon svg { flex: none; margin-top: 1px; color: var(--muted); }

/* ── Plan de abastecimiento in the baseline panel's language ────────────
   Rules, runs and constraints are one bordered list each (stg-flist); the
   winner is a card over 2×2 tiles (stg-kpi), each against what is in use. */
.sup-how.stg-sum-card { padding: 0; gap: 0; }
.sup-win-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sup-win-t { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.sup-win .stg-sum-note { margin: 0; }
.sup-win .sup-win-go { padding-top: 6px; border-top: 0; }
.stg-kpi-s.sup-tone-up { color: var(--success); }
.stg-kpi-s.sup-tone-down { color: var(--error); }
.stg-kpi-s.sup-tone-flat { color: var(--muted); }
.sup-bt-chart.stg-sum-card { padding: 8px; }
.sup-runs .stg-frow { padding: 8px 10px 8px 12px; }
.sup-runs .sup-run-n { margin-right: 0; }
.sup-runs .stg-frow-t { cursor: default; }
.sup-runs .sup-run-m { padding-left: 28px; margin-top: 2px; }
.sup-runs form { flex: none; }
.sup-use { height: 26px; padding: 0 8px; font-size: 12px; }
.sup-rules .stg-frow { padding: 10px 8px 10px 14px; }
.sup-rules .stg-frow.is-open { background: color-mix(in srgb, var(--primary) 3%, var(--card)); }
.sup-rules .stg-frow-t { display: flex; flex-direction: column; gap: 2px; }
.sup-rule-scope { font-size: 11px; font-weight: 600; letter-spacing: .3px; color: var(--muted); }
.sup-rule-t { font-size: 13px; font-weight: 600; color: var(--text); }
.sup-rule-facts { margin-top: 8px; }
.sup-rule-form { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.sup-rule-form .sup-form-acts .sup-danger { margin-right: auto; }
.sup-add-card { gap: 14px; padding: 14px; margin-top: 10px; }
.sup-opts.is-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sup-cost-card { gap: 16px; padding: 14px; }
.sup-tab > .stg-sum-sec + .stg-sum-sec, .sup-tab > .stg-sum-sec { gap: 6px; }
.sup-tab .stg-sum-sec { display: flex; flex-direction: column; }
.sup-tab .stg-sum-h h3 .stg-muted { font-weight: 400; margin-left: 2px; }

/* "Gana": the objective, then the fill-rate floor. */
.sup-crit-pop { width: 340px; gap: 8px; padding: 12px; }
.sup-crit-list { display: flex; flex-direction: column; margin-bottom: 6px; }
.sup-crit-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.sup-crit-opt:hover { background: var(--hover); }
.sup-crit-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.sup-crit-opt svg { visibility: hidden; color: var(--primary); }
.sup-crit-opt.is-on { color: var(--primary); font-weight: 600; }
.sup-crit-opt.is-on svg { visibility: visible; }

/* A calendar: the weeks of the month a policy orders in, as toggles. */
.sup-weeks-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sup-weeks-pick label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); cursor: pointer; transition: border-color 120ms linear, background 120ms linear; }
.sup-weeks-pick label:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.sup-weeks-pick b { font-size: 15px; font-weight: 700; color: var(--text); }
.sup-weeks-pick small { font-size: 11px; color: var(--muted); }
.sup-weeks-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.sup-weeks-pick label.is-on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--card)); box-shadow: 0 0 0 1px var(--primary); }
.sup-weeks-pick label.is-on b { color: var(--primary); }
.sup-weeks-pick label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }

.sup-crules .stg-frow { padding: 8px 8px 8px 12px; }
.sup-crules .stg-frow-main { gap: 12px; }
.sup-crules .stg-frow-t { cursor: default; font-weight: 400; }
.sup-crules .stg-frow-t b { font-weight: 700; }
.stg-flist.sup-crules .stg-frow-sub { margin-left: 46px; }
.sup-crules .stg-frow.is-off .stg-frow-t { color: var(--text-2); }
.sup-line .sup-chart { padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
/* Five tabs in the series panel's control: each as wide as its label. */
.sdp-tabs.sup-tabs { display: flex; margin: 12px 20px 0; }
.sdp-tabs.sup-tabs button { flex: 1 1 auto; padding: 7px 6px; white-space: nowrap; }

/* ── Plan de abastecimiento, 2026-10-29 (3) ──────────────────────────── */
/* What the projection says, as pills beside the filters. */
.sup-stats { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.sup-stat { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); font-size: 12px; color: var(--muted); white-space: nowrap; cursor: default; }
.sup-stat b { font-size: 13px; font-weight: 700; color: var(--text); }
.sup-stat.is-bad b { color: var(--error); }
.sup-source-foot { padding: 10px 2px 0; color: var(--muted); }
@media (max-width: 767.98px) { .sup-stats { justify-content: flex-start; } }

/* The winning run stands out of the list. */
.sup-runs .stg-frow.is-win { background: color-mix(in srgb, var(--primary) 6%, var(--card)); box-shadow: inset 3px 0 0 var(--primary); }
.sup-runs .stg-frow.is-win .sup-run-n { background: var(--primary); color: #fff; }
.sup-runs .stg-frow.is-win .stg-frow-t { font-weight: 600; }
.stg-st.sup-st-win { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }

/* Suppliers: the name goes to Inputs; the lead time is a number field. */
.sup-sup { display: flex; flex-direction: column; gap: 8px; }
.sup-sup-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sup-sup-name { display: inline-flex; align-items: center; gap: 2px; color: var(--text); text-decoration: none; }
.sup-sup-name:hover b { text-decoration: underline; }
.sup-sup-name svg { color: var(--muted); }
.sup-sup-h .sup-num { margin-left: auto; }
.sup-num.sm { height: 32px; padding: 0 10px; }
.sup-num.sm input { width: 36px; font-size: 13px; }
.sup-num.sm em { font-size: 12px; }
.sup-link { color: var(--primary); text-decoration: none; }
.sup-link:hover { text-decoration: underline; }

/* A policy's form in three sections, each under its own heading. */
.sup-pfields { gap: 0; }
.sup-pgroup { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 18px 0; border: 0; border-top: 1px solid var(--border); min-width: 0; }
.sup-pgroup:first-child { border-top: 0; padding-top: 4px; }
.sup-pgroup > legend { float: left; width: 100%; padding: 0; margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.sup-pgroup > legend + * { clear: both; }
.sup-tab { gap: 24px; }

/* Apply stays at the panel's foot, on the right, while its form shows. */
.sup-dock { position: sticky; bottom: -20px; z-index: 2; margin: 4px -20px -20px; padding: 12px 20px; background: var(--surface-light); }
.sup-rule-form .sup-dock { margin: 4px -8px -10px -14px; padding: 12px 14px; background: color-mix(in srgb, var(--primary) 3%, var(--card)); }
.sup-add-card .sup-dock { margin: 4px -14px -14px; padding: 12px 14px; border-radius: 0 0 10px 10px; background: var(--card); }
.stg-flist.sup-rules, .stg-flist.sup-crules { overflow: visible; }
.sup-sup { gap: 4px; }
.sup-sup-l { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.sup-sup-l b { color: var(--text); font-weight: 700; }
.sup-sup-l.is-muted { font-size: 12px; color: var(--muted); }
/* "Generar órdenes" sits at the very foot of the grid. */
.sup-fab { bottom: 12px; right: 16px; }
/* The baseline holds its Ajuste cell still (.stg-split .c-adj); here c-adj
   is the constraints' delta, whose hover says what moved the order. */
.stg-split.sup .c-adj { pointer-events: auto; cursor: default; }

/* ── Detail overlays beside the summary (2026-10-29) ───────────────────
   A series' panel (planning.css .psp) and a supply line's projection open
   over the grid, under the top bar, at the left of the summary when it is
   open (--stg-sum-w, set by panel_attrs); a click on the grid closes them,
   a click in the summary does not. */
.psp { top: 0; right: var(--stg-sum-w, 0px); height: calc(100dvh / var(--zoom, 1)); transition: right 320ms var(--ease-out-cubic); }
.psp-barrier { right: var(--stg-sum-w, 0px); }
/* They sit a layer under the summary (.stg-sum, --z-drawer + 1), so
   closing one slides it out behind the chat, not over it (Lucas,
   2026-11-03). On a phone the summary covers the screen: they go on top. */
.psp, .psp-barrier, .sup-line-panel { z-index: var(--z-drawer); }
@media (max-width: 767.98px) {
  .psp { z-index: calc(var(--z-drawer) + 11); }
  .psp-barrier { z-index: calc(var(--z-drawer) + 10); }
  .sup-line-panel { z-index: calc(var(--z-drawer) + 2); }
}
/* A series panel's foot is as tall as the summary's composer under
   "Chatear sobre esto" (.stg-chat-dock), so the two read as one band. */
.psp-foot.sdp-foot { padding: 10px 16px 14px; }
.sdp-foot .sdp-foot-row { min-height: 48px; }
.sup-line-panel { position: fixed; top: 0; bottom: 0; width: min(520px, calc(100vw - 72px)); display: flex; flex-direction: column; background: var(--surface-light); border-left: 1px solid var(--border); box-shadow: -12px 0 32px rgba(0, 0, 0, .12); transition: right 320ms var(--ease-out-cubic); }
.sup-line-panel .sp-head.sup-head { padding: 10px 20px; justify-content: center; }
.sup-panel .sp-head.sup-head { justify-content: center; }
.sup-line-body { flex: 1; min-height: 0; overflow-y: auto; }
.sup-line-enter { transition: transform 220ms var(--ease-out-cubic), right 320ms var(--ease-out-cubic); }
.sup-line-leave { transition: transform 200ms var(--ease-in-cubic); }
.sup-line-from { transform: translateX(100%); }
[data-theme="dark"] .sup-line-panel { background: var(--bg); }
@media (max-width: 767.98px) { .sup-line-panel { right: 0 !important; width: 100vw; } }

/* Beside an open side panel the toolbar keeps to one line: the level chips
   fold (level_filters) unless someone unfolds them, the search narrows, and
   the projection's pills scroll sideways. */
.stg-split:has(.stg-sum.is-open) .pl-tb-left { flex-wrap: nowrap; }
.stg-split:has(.stg-sum.is-open) .pl-tb-left:has(.stg-levels[aria-expanded="true"]) { flex-wrap: wrap; }
.stg-split:has(.stg-sum.is-open) .pl-search { flex: 0 1 220px; min-width: 150px; }
.stg-split:has(.stg-sum.is-open) .stg-tools { flex-wrap: nowrap; }
.sup-toolbar .pl-tb-left { flex: none; }
.stg-split:has(.stg-sum.is-open) .sup-toolbar .pl-search { flex: none; width: 190px; min-width: 0; }
.stg-filters, .stg-filters > .stg-fchip, .stg-tools > .stg-fchip-wrap { flex: none; }
.sup-stats { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; justify-content: normal; overflow-x: auto; scrollbar-width: none; }
/* Right-aligned while they fit; scrolled from their start when not. */
.sup-stat:first-child { margin-left: auto; }
.sup-stats::-webkit-scrollbar { display: none; }
.sup-stat { flex: none; }
.stg-sum-head .sp-sub, .sup-line-panel .sp-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* "Ver como" as an icon (viewer_switch); someone else's name beside it. */
.stg-as-btn { gap: 6px; min-width: 38px; padding: 0 9px; justify-content: center; }
.stg-as-btn.is-on { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
/* A plan's closing action floats at the page's foot, left of any open
   side panel, in the agent button's place. */
.stg-fab { position: fixed; z-index: var(--z-fab, 20); right: calc(var(--stg-sum-w, 0px) + 28px); bottom: 24px; height: 44px; padding: 0 20px; gap: 8px; border-radius: 22px; font-size: 14px; font-weight: 600; box-shadow: 0 2px 4px rgba(0, 0, 0, .14), 0 6px 16px rgba(0, 0, 0, .18); transition: right 320ms var(--ease-out-cubic); }
#main:has(.stg-fab) .fab-wrap { display: none; }
/* "Chatear sobre esto", anchored at the summary's foot as a composer. */
.stg-chat-dock { flex: none; padding: 10px 16px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.stg-chat-cta { display: flex; align-items: center; gap: 10px; width: 100%; height: 48px; padding: 0 6px 0 14px; border: 1px solid var(--border); border-radius: 24px; background: var(--card); font: inherit; font-size: 14px; color: var(--text-2); cursor: pointer; text-align: left; }
.stg-chat-cta > span:first-of-type { flex: 1; }
.stg-chat-cta:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); color: var(--text); }
.stg-chat-cta .stg-send { position: static; flex: none; width: 34px; height: 34px; }
.stg-as-btn + .menu, .stg-menu-wrap:has(.stg-as-btn) .menu { min-width: 300px; }
/* The next question, inside the answer it follows. */
.stg-next { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 12px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); background: color-mix(in srgb, var(--primary) 6%, var(--card)); color: var(--primary); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.stg-next:hover { background: color-mix(in srgb, var(--primary) 12%, var(--card)); }
/* The views button shows the view; "Vistas" heads its menu. */
.stg-menu-h { padding: 6px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.stg-views-btn { gap: 6px; }
.stg-back-title { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.stg-back-title svg { flex: none; color: var(--text-2); }
.stg-back-title:hover svg { color: var(--text); }

.stg-notice.is-error { border-color: color-mix(in srgb, var(--error) 35%, var(--border)); background: color-mix(in srgb, var(--error) 6%, var(--card)); color: var(--error); }

/* The forecast pipeline's schedule, drawn by Pipelines into Proceso's
   first step (workflows/web/forecast_schedule.py). */
.wfs { display: flex; flex-direction: column; }
.wfs-cron { width: 280px; max-width: 100%; height: 38px; font-family: var(--mono, ui-monospace, monospace); }
.wfs-acts { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.wfs-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.wfs .cyc-seg a { cursor: pointer; }
.cyc-sec.is-list .cyc-nodes-l { padding-bottom: 44px; }

/* Plan de abastecimiento under a session: the run picker in the top bar. */
.sup-hist-menu { max-height: min(60vh, 520px); overflow-y: auto; width: min(360px, calc(100vw - 32px)); }
.sup-hist-menu .menu-item { height: auto; min-height: 40px; align-items: flex-start; padding: 8px 12px; }
.sup-hist-it { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.sup-hist-it > span { display: inline-flex; align-items: center; gap: 6px; }
.sup-hist-it small { color: var(--muted); font-size: 11.5px; }
.sup-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px; font-size: 10.5px; font-weight: 500; color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }

/* The panel under a session (_supply_panel_run.html): its rows are the
   demo's policy rows (.sup-rules: a caption, a title, tags on the right,
   facts as chips), the open or selected one tinted as the demo's open
   rule. `.sup-row-acts` is the right side of a row's head, where its
   tags and actions go. */
.sup-row-acts { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.sup-rules a.stg-frow-t { cursor: pointer; }
.sup-rules .stg-frow-main a.stg-frow-t:hover { text-decoration: none; }
.sup-rules a.stg-frow-t:hover .sup-rule-t { color: var(--primary); }
.sup-hist .stg-frow.is-open .sup-rule-t { color: var(--primary); }
.sup-here { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.sup-facts b { font-weight: 700; color: var(--text); }
.sup-facts span.is-hit { color: var(--success); background: color-mix(in srgb, var(--success) 11%, transparent); }
.sup-cons .sup-card-d { margin-top: 4px; }
.sup-cons .sup-facts span { height: auto; min-height: 22px; padding: 2px 8px; white-space: normal; }
.sup-after, .sup-none { margin-top: 8px; }
/* The run panel's states: a word in its color, no pill and no dot (Lucas,
   2026-11-03: the dotted pills read as hand-coded). */
.sup-flag { font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.sup-flag.is-ok { color: var(--success); }
.sup-flag.is-warn { color: var(--warning); }
.sup-flag.is-down { color: var(--error); }
.sup-segs .stg-frow.is-open .sup-seg-name { color: var(--primary); }
/* A segment's competitors open inside its row, under a rule, as the
   demo's policy form does. */
.sup-segs .sup-use { display: inline-flex; align-items: center; gap: 2px; }
.sup-segs .sup-use svg { transition: transform 150ms var(--ease-out-cubic); }
.sup-segs .stg-frow.is-open .sup-use svg { transform: rotate(180deg); }
.sup-seg-body { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.sup-seg-body .stg-sum-note { margin: 0; }
.sup-cand-chart:empty { min-height: 40px; }
.sup-cand-chart .sup-chart svg { max-height: 340px; }
.sup-cand-t { width: 100%; border-collapse: collapse; font-size: 12px; }
.sup-cand-t th { text-align: right; font-weight: 500; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sup-cand-t td { text-align: right; padding: 5px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); white-space: nowrap; }
.sup-cand-t tr:last-child td { border-bottom: 0; }
.sup-cand-t th:first-child, .sup-cand-t td:first-child { text-align: left; }
.sup-cand-t td:first-child { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sup-cand-t tr.is-win td { font-weight: 600; color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent); }
.sup-cand-t tr.is-win td:first-child { border-radius: 6px 0 0 6px; }
.sup-cand-t tr.is-win td:last-child { border-radius: 0 6px 6px 0; }
.sup-cand-t tr.is-off td { color: var(--muted); }
select.sup-cand-pick { align-self: flex-start; height: 30px; max-width: 100%; font-size: 12.5px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: inherit; padding: 0 8px; }
.sup-lost .sup-rule-t { font-weight: 500; color: var(--text-2); }

/* The run panel's edits (_supply_panel_run.html): what is changed lands in
   «Ejecutar política», and Recalcular plays that box again. One row: what
   it means on the left, the button on the right. */
.stg-sum-card.sup-recalc { flex-direction: row; align-items: center; gap: 16px; padding: 12px 14px; margin-bottom: 4px; text-align: left; }
.stg-sum-card.sup-recalc.is-hit { background: color-mix(in srgb, var(--primary) 5%, var(--card)); border-color: color-mix(in srgb, var(--primary) 28%, var(--border)); }
.sup-recalc-t { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1; min-width: 0; font-size: 13px; }
.sup-recalc-t span { color: var(--text-2); font-size: 12px; line-height: 1.4; }
.sup-recalc .btn { flex-shrink: 0; }
/* A trash button that is posting shows the spinner in the icon's place. */
.sup-del { position: relative; }
.sup-del.is-busy > svg { visibility: hidden; }
.sup-del .busy-spin { position: absolute; inset: 0; margin: auto; }
/* The new policy's form: a header with what it does, then the demo's fields. */
.sup-new-pol { gap: 16px; }
.sup-new-h { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.sup-new-h > div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sup-new-h b { font-size: 14px; }
.sup-new-h span { font-size: 12px; color: var(--text-2); }
.sup-new-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
/* A field the form still needs: red, and a short shake sideways. */
.sup-fld.is-missing .sup-chip { border-color: var(--error); color: var(--error); background: color-mix(in srgb, var(--error) 6%, var(--card)); animation: sup-shake 420ms var(--ease-out-cubic); }
.sup-fld-err { font-size: 12px; font-weight: 500; color: var(--error); }
@keyframes sup-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .sup-fld.is-missing .sup-chip { animation: none; } }
/* The run panel's edits feel immediate: a removed row folds away on the
   click, a form closes on save with a "Guardando…" row in its place, and
   the row the save added comes in softly (Lucas, 2026-11-03). */
.sup-rules .stg-frow { transition: opacity 180ms var(--ease-out-cubic), transform 180ms var(--ease-out-cubic); }
.sup-rules .stg-frow.is-gone { pointer-events: none; overflow: hidden; animation: sup-out 240ms var(--ease-out-cubic) forwards; }
@keyframes sup-out {
  0% { opacity: 1; max-height: 120px; }
  45% { opacity: 0; transform: translateX(10px); max-height: 120px; }
  100% { opacity: 0; transform: translateX(10px); max-height: 0; padding-top: 0; padding-bottom: 0; border-width: 0; }
}
/* A list whose every row is folding away goes with them: no empty frame. */
.stg-flist.sup-rules:not(:has(> .stg-frow:not(.is-gone))) { animation: sup-list-out 240ms var(--ease-out-cubic) forwards; }
@keyframes sup-list-out { to { opacity: 0; border-color: transparent; box-shadow: none; } }
.sup-rules .stg-frow.is-new { animation: sup-in 420ms var(--ease-out-cubic); }
@keyframes sup-in { from { opacity: 0; transform: translateY(-4px); background: color-mix(in srgb, var(--primary) 8%, var(--card)); } to { opacity: 1; transform: none; } }
.sup-pending { display: flex; align-items: center; gap: 8px; margin-top: 8px; border: 1px dashed var(--border); border-radius: 10px; color: var(--text-2); font-size: 12.5px; }
.sup-empty { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 10px; background: color-mix(in srgb, var(--card) 60%, transparent); }
.sup-empty > div { display: flex; flex-direction: column; gap: 2px; }
.sup-empty b { font-size: 13px; }
.sup-empty span { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.sup-recalc-t b { display: inline-flex; align-items: center; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .sup-rules .stg-frow.is-new { animation: none; } .sup-rules .stg-frow { transition: none; } }
/* The empty card folds (height, then opacity) as a new policy opens. */
.sup-empty { max-height: 120px; overflow: hidden; }
.sup-empty.sup-fold-in, .sup-empty.sup-fold-out { transition: max-height 220ms var(--ease-out-cubic), opacity 160ms ease, padding 220ms var(--ease-out-cubic), margin 220ms var(--ease-out-cubic), border-width 220ms; }
.sup-empty.is-folded { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; margin: 0; border-width: 0; }
/* Several products at once (bits.scope_multi): checks in the list, the
   choices as chips under the button, a count of the SKUs they hold. */
.sup-multi-opt { display: flex; align-items: center; gap: 8px; }
.sup-multi-opt > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.sup-multi-opt small { color: var(--muted); font-size: 11.5px; }
.sup-check { display: grid; place-items: center; width: 16px; height: 16px; flex-shrink: 0; border: 1.5px solid var(--border); border-radius: 4px; color: transparent; transition: background 120ms, border-color 120ms; }
.sup-multi-opt.is-on .sup-check { background: var(--primary); border-color: var(--primary); color: #fff; }
.sup-multi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sup-mchip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 26px; padding: 0 4px 0 9px; border: 1px solid var(--border); border-radius: 13px; background: var(--card); font-size: 12px; }
.sup-mchip small { color: var(--muted); font-size: 10.5px; }
.sup-mchip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-mchip button { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--muted); }
.sup-mchip button:hover { background: var(--hover); color: var(--text); }
.sup-multi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
/* A segment of the backtest as a card (_supply_panel_run.html): its name
   and SKUs, the winning policy under it, the fill rate large on the right
   with a bar against the floor. */
.sup-seg-card { display: flex; align-items: flex-start; gap: 16px; }
.sup-seg-l { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.sup-seg-h { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sup-seg-name { font-size: 14.5px; font-weight: 700; color: var(--text); letter-spacing: -.1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-seg-n { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sup-seg-pol { margin: 0; font-size: 12.5px; color: var(--text); line-height: 1.4; }
.sup-seg-pol span { margin-right: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--primary); }
.sup-seg-pol.is-quiet { color: var(--muted); }
.sup-seg-more { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; margin-top: 2px; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 500; color: var(--primary); cursor: pointer; }
.sup-seg-more svg { transition: transform 150ms var(--ease-out-cubic); }
.sup-segs .stg-frow.is-open .sup-seg-more svg { transform: rotate(180deg); }
.sup-seg-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; width: 92px; }
.sup-seg-r b { font-size: 18px; font-weight: 700; color: var(--success); letter-spacing: -.3px; }
.sup-seg-r > span:not(.sup-seg-bar) { font-size: 11px; color: var(--muted); }
.sup-seg-r.is-short b { color: var(--warning); }
.sup-seg-bar { position: relative; width: 100%; height: 4px; margin-top: 4px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 18%, transparent); }
.sup-seg-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--success); }
.sup-seg-r.is-short .sup-seg-bar i { background: var(--warning); }
.sup-seg-bar em { position: absolute; top: -3px; width: 2px; height: 10px; margin-left: -1px; border-radius: 1px; background: var(--text-2); }
/* A tinted first or last row keeps the list's rounded corners (the list
   lets its pop-overs out, so it does not clip). */
.stg-flist.sup-rules > .stg-frow:first-child { border-top-left-radius: 9px; border-top-right-radius: 9px; }
.stg-flist.sup-rules > .stg-frow:last-child { border-bottom-left-radius: 9px; border-bottom-right-radius: 9px; }
/* A header that wraps to two lines centres them on each other, wherever
   the header sits (Lucas, 2026-11-03: right-aligned they read crooked). */
.sup-grid .h .hs > span:first-child, .sup-grid .h .hs-static > span:first-child { text-align: center; }
.sup-newer { gap: 8px; text-decoration: none; color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.sup-newer b { color: var(--primary); }
.sup-newer:hover { background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.sup-newer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent); animation: sup-ping 1.8s ease-out infinite; }
@keyframes sup-ping { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .sup-newer-dot { animation: none; } }
.sup-run-find { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sup-run-find .sup-pick-q { flex: 1; min-width: 0; margin: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.sup-run-kind { flex: none; }
.sup-run-kind { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--seg-bg); }
.sup-run-kind button { height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: none; font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; }
.sup-run-kind button:hover { color: var(--text); }
.sup-run-kind button.is-on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }

/* The run panel's chat (its «Chat» tab): the plans' conversation (.stg-convo)
   fills the panel's body under the tabs instead of scrolling with it. */
.sup-panel .sp-body { position: relative; }
.sup-tab.sup-chat { position: absolute; inset: 0; gap: 0; }
.sup-chat .stg-view-sum { padding: 16px 20px 20px; }
/* Six tabs in the panel's 440 px: tighter, and they scroll before they clip. */
.sdp-tabs.sup-tabs { overflow-x: auto; scrollbar-width: none; }
.sdp-tabs.sup-tabs button { padding: 7px 4px; }
.sup-chat-new { flex: none; display: flex; justify-content: flex-end; padding: 8px 12px 0; }

/* Plan de abastecimiento's Proveedores tab (stages_supply_suppliers): each
   supplier opens its sheet over the screen; a lead time in days says its
   weeks right under it. */
.sup-compras .stg-sum-h .sup-row-acts { display: flex; gap: 4px; }
.sup-cp-t { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.sup-cp-t small { font-size: 12px; }
.sup-cp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin-top: 8px; }
.sup-cp-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 11px; color: var(--muted); }
.sup-cp-f .input { height: 32px; font-size: 13px; padding: 0 8px; min-width: 0; width: 100%; }
.sup-cp-f.is-wide, .sup-cp-grid .is-wide { grid-column: 1 / -1; }
.sup-cp-wk { font-size: 11px; color: var(--text-2); }
.sup-ok { display: flex; align-items: center; gap: 5px; color: var(--success, #1a7f37); }
.sup-bad { color: var(--danger, #c62828); }
.sup-cp-errs { margin: 0 0 8px 18px; font-size: 12px; color: var(--text-2); }
.sup-cp-tbl { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.sup-cp-tbl th, .sup-cp-tbl td { padding: 5px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.sup-cp-tbl .r { text-align: right; }
.sup-cp-preview { display: flex; flex-direction: column; gap: 6px; }
.sup-cp-go { display: flex; color: var(--muted); }
.sup-compras .stg-frow-t { cursor: pointer; }

/* A supplier's sheet (_supply_supplier_sheet.html): a panel that slides in
   from the right, the whole height, over the side panel and the grid
   (Lucas, 2026-11-04: a panel, not a window floating in the middle). Its
   data, a bar that sets many SKUs at once, the table and a footer that
   saves every change together. */
.sup-dlg-scrim { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(0, 0, 0, .18); display: flex; justify-content: flex-end; }
.sup-dlg { width: min(1080px, calc(100vw - 80px)); height: 100%; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -12px 0 32px rgba(0, 0, 0, .14); overflow: hidden; --field-under: var(--surface); animation: sup-dlg-in 180ms cubic-bezier(.2, 0, 0, 1); }
@keyframes sup-dlg-in { from { transform: translateX(48px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sup-dlg { animation: none; } }
.sup-dlg-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; }
.sup-dlg-ttl { flex: 1; min-width: 0; }
.sup-dlg-ttl h3 { margin: 0 0 2px; font-size: 18px; }
.sup-dlg-ttl p { margin: 0; font-size: 13px; }
.sup-dlg-note { margin: 0 20px 8px; }
.sup-dlg-data { display: grid; grid-template-columns: 2fr 1.5fr 2fr 1.5fr; gap: 10px; margin: 0; padding: 0 20px 14px; border: 0; border-bottom: 1px solid var(--border); }
.sup-dlg-data .input { height: 34px; }
.sup-dlg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--hover); }
.sup-dlg-bar .sup-pick-q { width: 220px; height: 34px; }
.sup-dlg-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.sup-dlg-bulk-t { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.sup-dlg-bulk .input { height: 32px; font-size: 13px; padding: 0 8px; }
.sup-dlg-bulk .input.num { width: 84px; }
.sup-dlg-bulk select.input { width: auto; max-width: 170px; }
.sup-dlg-bulk .input.sup-dlg-blead { width: 100px; }
.sup-dlg-unit-h { white-space: nowrap; }
.sup-dlg-unit { margin-left: 4px; height: 26px; padding: 0 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.sup-dlg-hint { width: 100%; margin: 0; font-size: 12px; }
.sup-dlg-table { flex: 1; min-height: 0; overflow: auto; }
.sup-dlg-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.sup-dlg-tbl th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sup-dlg-tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sup-dlg-tbl .r { text-align: right; }
.sup-dlg-tbl .c { width: 32px; text-align: center; }
.sup-dlg-tbl td .input.num { width: 84px; height: 30px; font-size: 13px; padding: 0 8px; text-align: right; }
.sup-dlg-tbl td .sup-cp-wk { display: block; margin-top: 2px; }
.sup-dlg-tbl tr.is-picked td { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.sup-dlg-tbl tr.is-dirty td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.sup-dlg-tbl tr.is-dirty .input { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.sup-dlg-sku { min-width: 200px; }
.sup-dlg-sku b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.sup-dlg-sku small { display: block; font-size: 11px; }
.sup-dlg-moved { color: var(--primary); }
.sup-dlg-played { white-space: nowrap; font-size: 12px; }
.sup-dlg-played small { display: block; font-size: 11px; }
.sup-dlg-own { display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; font-size: 11px; color: var(--text-2); }
.sup-dlg-f { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; }
.sup-dlg-f > span:not(.sup-dlg-acts) { flex: 1; min-width: 0; }
.sup-dlg-acts { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 720px) {
  .sup-dlg { width: 100vw; border-left: 0; }
  .sup-dlg-data { grid-template-columns: 1fr 1fr; }
  .sup-dlg-bar .sup-pick-q { width: 100%; }
}

/* The demo's applied clean-ups and their per-row Aplicar. */
.stg-applied { display: inline-grid; place-items: center; width: 16px; color: var(--success); }
.stg-apply-one { display: inline; margin-left: 8px; }
.stg-apply-one .btn { padding: 2px 10px; font-size: 12.5px; }
.pr.is-flash { background: color-mix(in srgb, var(--primary) 14%, transparent) !important; transition: background .6s; }

/* Plan de abastecimiento's downloads: the menu's divider, the done FAB. */
.stg-menu-sep { height: 1px; margin: 4px 0; background: var(--border); }
.sup-fab.is-done { display: inline-flex; align-items: center; text-decoration: none; background: var(--success, #16a34a); border-color: var(--success, #16a34a); }
.sup-fab-sep { opacity: .7; margin: 0 2px; }
.sup-po-dl { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.stg-typing-t { margin-left: 6px; font-size: 12.5px; color: var(--muted); }

/* Plan colaborativo's chat: an attached Excel and the button that loads it. */
.stg-clip { flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin-left: -8px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.stg-clip:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.stg-clip:disabled { opacity: .35; cursor: default; }
.stg-file { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; margin: -2px 0; border-radius: 10px; background: color-mix(in srgb, #fff 12%, transparent); }
.stg-file > svg { flex: none; padding: 6px; width: 34px; height: 34px; border-radius: 8px; background: #1d6f42; color: #fff; }
.stg-file b { display: block; font-size: 13.5px; font-weight: 600; }
.stg-file small { display: block; font-size: 11.5px; opacity: .75; }
.stg-file-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; }
.stg-bubble.is-ai span[x-text="m.text"] { white-space: pre-line; }
