/* «Прогнозування» pages: parameters and the forecast. */
.fcp { display: flex; flex-direction: column; gap: 14px; }
.fcp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fcp-bar .fcp-per { font-size: 13px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.fcp-bar .fcp-sp { flex: 1 1 auto; }
.fcp .segmented { flex: 0 0 auto; }
.fcp-sec { border: 1px solid var(--border); border-left: 4px solid var(--sp); background: var(--spbg);
    border-radius: 12px; padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.fcp-sec[hidden], .fcp-isle[hidden] { display: none; }
.fcp-sec > h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--sp); display: flex; align-items: center;
    gap: 8px; cursor: pointer; user-select: none; }
.fcp-sec > h2 .fcp-chev { margin-left: 4px; transition: transform .15s; opacity: .7; }
.fcp-sec > h2 .fcp-h-r { margin-left: auto; font-size: 12.5px; font-weight: 500; }
.fcp-sec.is-collapsed > :not(h2) { display: none; }
.fcp-sec.is-collapsed > h2 .fcp-chev { transform: rotate(-90deg); }
.fcp-isle { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
.fcp-t { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
#fcpRates, #fcpCulls, #fcpNeed { min-width: 680px; }
#fcpStd { min-width: 760px; }
.fcp-t th { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute);
    text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.fcp-t td { padding: 7px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.fcp-t tr:last-child td { border-bottom: 0; }
.fcp-t .num { text-align: right; white-space: nowrap; }
.fcp-t tr.grp td { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--sp);
    background: color-mix(in srgb, var(--sp) 6%, var(--surface)); padding-block: 5px; }
.fcp-t .sm { display: block; font-size: 11.5px; color: var(--text-mute); }
.fcp-t .eff { font-weight: 600; }
.fcp-t .eff.man { color: #8a4b00; }
.fcp-code { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 12px; background: #eef3fb; color: #1f3f7a;
    padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.fcp-lo { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: #8a4b00; }
.fcp-lo::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #d98a1a; }
.fcp-in { height: 30px; width: 86px; box-sizing: border-box; padding: 0 9px; border: 1px solid #cfe0f5; background: #e8f1fc;
    border-radius: 8px; font: inherit; font-size: 13.5px; color: var(--text); text-align: right; }
.fcp-in::placeholder { color: var(--text-mute); opacity: .55; }
.fcp-in:focus { outline: none; border-color: var(--primary); background: #fff; }
.fcp-in.set { background: #fff; border-color: #e0a24a; }
.fcp-unit { font-size: 12px; color: var(--text-mute); margin-left: 4px; }
.fcp-x { width: 22px; height: 22px; border: 0; background: transparent; color: var(--text-mute); border-radius: 6px;
    cursor: pointer; font-size: 15px; line-height: 1; vertical-align: middle; }
.fcp-x:hover { color: #c2333a; background: #fdecec; }
.fcp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fcp-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 7px 12px; font-size: 13.5px; }
.fcp-chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.fcp-chip .fcp-fact { font-size: 12px; color: var(--text-mute); }
.fcp-chip .fcp-fact.diff { color: #8a4b00; }
.fcp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.fcp-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
    display: flex; flex-direction: column; gap: 2px; }
.fcp-tile b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fcp-tile span { font-size: 12px; color: var(--text-mute); }
.fcp-ok { font-size: 13px; color: #11663f; }
.fcp-cell-lo { color: var(--text-mute); }
.fcp-st { display: inline-flex; font-size: 11.5px; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.fcp-st.m { background: #e6f6ee; color: #11663f; }
.fcp-st.s { background: #fdf4e2; color: #8a4b00; }
.fcp-st.t { background: #f1f5f9; color: #475569; }
.fcp-eq { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 11.5px; color: var(--text-soft);
    line-height: 1.45; }
.fcp-chart { width: 100%; height: 190px; display: block; }
.fcp-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-soft); }
.fcp-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.fcp-msg { font-size: 13px; color: var(--text-mute); padding: 6px 2px; }
.fcp-msg.err { color: #c2333a; }
html[data-theme="dark"] .fcp-in { background: var(--surface-2, #131c2b); border-color: var(--border); }
html[data-theme="dark"] .fcp-in.set { border-color: #c07a1e; }
html[data-theme="dark"] .fcp-code { background: #1d2a40; color: #b9cdf0; }
html[data-theme="dark"] .fcp-t .eff.man, html[data-theme="dark"] .fcp-chip .fcp-fact.diff,
html[data-theme="dark"] .fcp-lo { color: #f0b968; }
html[data-theme="dark"] .fcp-ok { color: #6fd6a2; }
html[data-theme="dark"] .fcp-st.m { background: #143424; color: #7fdcac; }
html[data-theme="dark"] .fcp-st.s { background: #3a2a10; color: #f0c27a; }
html[data-theme="dark"] .fcp-st.t { background: #1f2a3a; color: #a9b6c8; }
html[data-theme="dark"] .fcp-x:hover { background: #3a1a1c; }
html[data-theme="dark"] .fcp-sec { background: var(--surface-2, #131c2b); }

/* ── «Прогноз» page ── */
.fc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: 13px; color: var(--text-mute); }
.fc-head b { color: var(--text); font-weight: 600; }
.fc-head .fc-state { font-size: 12.5px; }
.fc-head .fc-state.busy::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary); margin-right: 6px; animation: fcPulse 1.2s ease-in-out infinite; }
@keyframes fcPulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .fc-head .fc-state.busy::before { animation: none; } }
.fc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fc-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 3px; }
.fc-kpi .t { font-size: 12px; color: var(--text-mute); }
.fc-kpi .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.fc-kpi .r { font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.fc-chart { width: 100%; height: 240px; display: block; }
.fc-band { opacity: .14; }
.fc-tbl { min-width: 980px; }
.fc-tbl th.m, .fc-tbl td.m { text-align: right; white-space: nowrap; }
.fc-tbl th.m.now0 { color: var(--text-soft); }
.fc-tbl td.now, .fc-tbl th.now { color: var(--text-mute); border-right: 1px solid var(--border); }
.fc-tbl td.tot, .fc-tbl th.tot { font-weight: 600; border-left: 1px solid var(--border);
    background: color-mix(in srgb, var(--sp) 5%, var(--surface)); }
.fc-tbl tr.sub td:first-child { padding-left: 26px; color: var(--text-soft); }
.fc-tbl tr.sub td { font-size: 12.5px; }
.fc-tbl td.lbl { white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.fc-tbl tr.grp td.lbl { background: color-mix(in srgb, var(--sp) 6%, var(--surface)); }
.fc-tbl .rng { display: block; font-size: 10.5px; color: var(--text-mute); font-weight: 400; }
.fc-tbl td.m:hover { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.fc-foot { font-size: 12.5px; color: var(--text-mute); line-height: 1.5; }
.fc-foot a { white-space: nowrap; }
.fc-kpi .w { font-size: 12px; color: #8a4b00; }
.fc-tbl tr.key td { font-weight: 600; }
.fc-tbl td.neg { color: #c2333a; }
html[data-theme="dark"] .fc-kpi .w { color: #f0b968; }
html[data-theme="dark"] .fc-tbl td.neg { color: #ff8a8f; }

/* ── «Сценарії» page ── */
.fcp-tin { height: 30px; box-sizing: border-box; padding: 0 10px; border: 1px solid #cfe0f5; background: #e8f1fc;
    border-radius: 8px; font: inherit; font-size: 13.5px; color: var(--text); width: 220px; }
.fcp-tin.sc-note { width: 280px; }
.fcp-tin:focus { outline: none; border-color: var(--primary); background: #fff; }
.fcp-tin[readonly] { background: transparent; border-color: transparent; padding-left: 0; }
.sc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.sc-cards[hidden] { display: none; }
.sc-card { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 3px; padding: 11px 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; min-height: 92px; }
.sc-card b { font-size: 14px; font-weight: 600; color: var(--text); }
.sc-card .sc-n { font-size: 12px; color: var(--text-mute); line-height: 1.35; overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sc-card .sc-v { margin-top: auto; font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; line-height: 1.45; }
.sc-card .sc-v i { color: var(--text-mute); }
.sc-card .up { color: #11663f; }
.sc-card .dn { color: #c2333a; }
.sc-card.base { cursor: default; background: color-mix(in srgb, var(--text-mute) 6%, var(--surface)); }
.sc-card:not(.base):hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.sc-card.is-sel { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent); }
.sc-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sc-card.sc-new { align-items: center; justify-content: center; color: var(--primary); font-weight: 500; font-size: 13.5px;
    border: 1px dashed color-mix(in srgb, var(--primary) 55%, var(--border)); background: transparent; }
.sc-bar { gap: 8px; }
.sc-bar .btn { white-space: nowrap; height: 30px; padding: 0 11px; font-size: 13px; display: inline-flex; align-items: center; }
.sc-bar .sc-del:hover { color: #c2333a; }
.sc-add { position: relative; }
.sc-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 240px; padding: 5px;
    background: color-mix(in srgb, var(--surface) 62%, transparent); backdrop-filter: blur(6px) saturate(1.5);
    -webkit-backdrop-filter: blur(6px) saturate(1.5); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14); display: flex; flex-direction: column; }
.sc-menu[hidden] { display: none; }
.sc-menu button { all: unset; padding: 7px 10px; border-radius: 7px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.sc-menu button:hover, .sc-menu button:focus-visible { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.sc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-mute); align-items: center; }
.sc-legend i { font-style: normal; display: inline-block; min-width: 34px; text-align: right; padding: 1px 6px; border-radius: 5px;
    margin-right: 5px; font-variant-numeric: tabular-nums; border: 1px solid var(--border); background: var(--surface); }
.sc-legend .lg-hist { color: var(--text-mute); font-style: italic; }
.sc-legend .lg-typed { color: var(--text); font-weight: 600; background: #fff6e6; border-color: #e0a24a; }
.sc-legend .lg-above { color: var(--text-soft); background: #fbf7ef; }
.sc-tbl { min-width: 900px; font-size: 13px; }
.sc-tbl th { text-align: center; }
.sc-tbl th.sc-m, .sc-tbl td.sc-m { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1;
    white-space: nowrap; }
.sc-tbl th.sc-g { color: var(--sp); border-left: 1px solid var(--border); }
.sc-tbl th.sc-l { text-transform: none; letter-spacing: 0; font-size: 11.5px; white-space: normal; line-height: 1.2;
    min-width: 54px; max-width: 90px; }
.sc-tbl td { padding: 3px 4px; }
.sc-tbl td.sc-m { padding: 3px 12px; }
.sc-in { width: 100%; min-width: 50px; height: 28px; box-sizing: border-box; padding: 0 7px; border: 1px solid transparent;
    background: transparent; border-radius: 6px; font: inherit; font-size: 13px; text-align: right; color: var(--text);
    font-variant-numeric: tabular-nums; }
.sc-in::placeholder { color: var(--text-soft); opacity: 1; }
.sc-tbl td.is-hist .sc-in::placeholder { color: var(--text-mute); font-style: italic; opacity: .8; }
.sc-tbl td.is-typed .sc-in { font-weight: 600; background: #fff6e6; border-color: #f0cf96; }
.sc-tbl td.is-above { background: #fbf7ef; }
.sc-tbl td.is-err .sc-in { border-color: #e5484d; background: #fdecec; color: #c2333a; }
.sc-in:hover:not([readonly]) { border-color: #cfe0f5; }
.sc-in:focus { outline: none; border-color: var(--primary); background: #fff; font-weight: 400; }
.sc-in[readonly] { cursor: default; }
.sc-cmp { min-width: 720px; }
.sc-cmp th.m, .sc-cmp td.m { text-align: right; white-space: nowrap; }
.sc-cmp th.sc-g { text-align: center; color: var(--sp); border-left: 1px solid var(--border); }
.sc-cmp td.m.d { font-weight: 600; border-right: 1px solid var(--border); }
.sc-cmp td.up { color: #11663f; }
.sc-cmp td.dn { color: #c2333a; }
.sc-cmp tr.tot td { font-weight: 600; background: color-mix(in srgb, var(--sp) 6%, var(--surface)); }
.sc-cmp td.lbl { white-space: nowrap; }
.fcp-sec .fc-state:empty { display: none; }
.fcp-sec .fc-state { font-size: 12.5px; color: var(--text-mute); }
.fcp-sec .fc-state.busy::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary); margin-right: 6px; animation: fcPulse 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .fcp-sec .fc-state.busy::before { animation: none; } }
@media (max-width: 760px) { .fcp-tin, .fcp-tin.sc-note { width: 100%; } }
html[data-theme="dark"] .fcp-tin { background: var(--surface-2, #131c2b); border-color: var(--border); }
html[data-theme="dark"] .sc-card .up, html[data-theme="dark"] .sc-cmp td.up { color: #6fd6a2; }
html[data-theme="dark"] .sc-card .dn, html[data-theme="dark"] .sc-cmp td.dn { color: #ff8a8f; }
html[data-theme="dark"] .sc-tbl td.is-typed .sc-in, html[data-theme="dark"] .sc-legend .lg-typed { background: #3a2a10; border-color: #8a5a1a; }
html[data-theme="dark"] .sc-tbl td.is-above, html[data-theme="dark"] .sc-legend .lg-above { background: #1d2433; }
html[data-theme="dark"] .sc-tbl td.is-err .sc-in { background: #3a1a1c; color: #ff8a8f; }
html[data-theme="dark"] .sc-in:focus { background: var(--surface-2, #131c2b); }
html[data-theme="dark"] .sc-menu { background: color-mix(in srgb, var(--surface-2, #131c2b) 66%, transparent); }

/* ── «План/факт» page ── */
.pf-alert { background: #fdf4e2; border: 1px solid #f0cf96; color: #7a4300; border-radius: 10px; padding: 9px 12px;
    font-size: 13px; line-height: 1.45; }
.pf-alert[hidden] { display: none; }
.pf-sel { height: 30px; border: 1px solid #cfe0f5; background: #e8f1fc; border-radius: 8px; font: inherit; font-size: 13.5px;
    padding: 0 8px; color: var(--text); max-width: 260px; }
.pf-chart { width: 100%; height: 230px; display: block; }
.pf-tbl { min-width: 760px; }
.pf-tbl th.m, .pf-tbl td.m { text-align: right; white-space: nowrap; }
.pf-tbl th.sc-g { text-align: center; color: var(--sp); border-left: 1px solid var(--border); }
.pf-tbl td.m.d { border-right: 1px solid var(--border); color: var(--text-soft); }
.pf-tbl td.m.f { font-weight: 600; }
.pf-tbl td.out { color: #c2333a; }
.pf-tbl td.lbl { white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.pf-tbl tr.sub td.lbl { padding-left: 26px; color: var(--text-soft); }
.pf-tbl td.tot { background: color-mix(in srgb, var(--sp) 5%, var(--surface)); }
.pf-acc { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
html[data-theme="dark"] .pf-alert { background: #3a2a10; border-color: #8a5a1a; color: #f0c27a; }
html[data-theme="dark"] .pf-sel { background: var(--surface-2, #131c2b); border-color: var(--border); }
html[data-theme="dark"] .pf-tbl td.out { color: #ff8a8f; }
.fc-head .fc-sc { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.fc-head .fc-sc span { font-size: 12.5px; }
.fc-head .fc-sc .pf-sel { height: 28px; }
.fc-head .fc-sc a { white-space: nowrap; font-size: 12.5px; }
@media (max-width: 760px) {
    .sc-cards { grid-template-columns: 1fr 1fr; }
    .sc-card { min-height: 0; }
    .sc-card.sc-new { min-height: 44px; }
}
@media (max-width: 760px) {
    .fcp-sec > h2 { flex-wrap: wrap; }
    .fcp-sec > h2 .fcp-h-r.segmented { margin-left: 0; max-width: 100%; overflow-x: auto; }
}

/* ── «Агрегати» page ── */
.ag-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.ag-form label { display: flex; flex-direction: column; gap: 4px; }
.ag-form label > span { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); }
.ag-form .ag-grp { width: 180px; }
.ag-fxrow { display: flex; align-items: center; gap: 8px; }
.ag-fx-l { font-style: italic; font-weight: 600; color: var(--sp); font-size: 15px; }
.ag-fxwrap { position: relative; flex: 1 1 auto; background: #e8f1fc; border: 1px solid #cfe0f5; border-radius: 8px; }
.ag-fxwrap:focus-within { border-color: var(--primary); background: #fff; }
.ag-fx, .ag-under { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 13.5px; padding: 0 10px;
    height: 34px; line-height: 34px; box-sizing: border-box; letter-spacing: 0; }
.ag-fx { position: relative; z-index: 1; width: 100%; border: 0; background: transparent; color: var(--text); }
.ag-fx:focus { outline: none; }
.ag-under { position: absolute; inset: 0; color: transparent; white-space: pre; overflow: hidden; pointer-events: none; }
.ag-under mark { background: transparent; color: transparent; border-bottom: 2px solid #e5484d; }
.ag-fxmsg { font-size: 12.5px; color: #11663f; min-height: 17px; }
.ag-fxmsg.err { color: #c2333a; }
.ag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-chip, .ag-tok { all: unset; cursor: pointer; font-size: 12px; color: var(--text-soft); border: 1px solid var(--border);
    background: var(--surface); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.ag-chip code, .ag-tok code { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; color: #1f3f7a; font-size: 12px; }
.ag-chip:hover, .ag-tok:hover, .ag-chip:focus-visible, .ag-tok:focus-visible { border-color: var(--primary); }
.ag-ref summary { cursor: pointer; font-size: 12.5px; color: var(--primary); }
.ag-ref[open] summary { margin-bottom: 8px; }
.ag-rblk { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; border-top: 1px dashed var(--border); }
.ag-rblk > b { flex: 0 0 150px; font-size: 12px; font-weight: 600; color: var(--text-mute); padding-top: 4px; }
.ag-rblk > div { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; flex: 1 1 auto; }
.ag-rblk .sm { font-size: 11.5px; color: var(--text-mute); }
.ag-btns { display: flex; gap: 8px; }
.ag-tbl { min-width: 760px; }
.ag-tbl td { vertical-align: top; }
.ag-tbl .sm { display: block; font-size: 11.5px; color: var(--text-mute); }
.ag-tbl .sm.err { color: #c2333a; }
.ag-tbl td.nw { white-space: nowrap; }
.ag-tbl td.act { text-align: right; }
.ag-tbl tr.sub td:first-child { padding-left: 26px; color: var(--text-soft); }
.ag-code { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 12px; background: #eef3fb; color: #1f3f7a;
    padding: 1px 6px; border-radius: 5px; word-break: break-word; cursor: default; }
#agNat .ag-code { cursor: copy; }
.ag-sw { position: relative; display: inline-block; width: 30px; height: 17px; }
.ag-sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.ag-sw span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background .15s; cursor: pointer; }
.ag-sw span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%;
    background: #fff; transition: transform .15s; }
.ag-sw input:checked + span { background: #1aa86b; }
.ag-sw input:checked + span::after { transform: translateX(13px); }
.ag-sw input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.ag-sw input:disabled + span { cursor: default; opacity: .6; }
@media (prefers-reduced-motion: reduce) { .ag-sw span, .ag-sw span::after { transition: none; } }
html[data-theme="dark"] .ag-fxwrap { background: var(--surface-2, #131c2b); border-color: var(--border); }
html[data-theme="dark"] .ag-code, html[data-theme="dark"] .ag-chip code, html[data-theme="dark"] .ag-tok code { background: #1d2a40; color: #b9cdf0; }
html[data-theme="dark"] .ag-fxmsg { color: #6fd6a2; }
html[data-theme="dark"] .ag-fxmsg.err, html[data-theme="dark"] .ag-tbl .sm.err { color: #ff8a8f; }
.fcp-sec > h2 .fc-rows-link { margin-left: auto; font-size: 12.5px; font-weight: 500; }
.fcp-sec > h2 .fc-rows-link + .fcp-h-r { margin-left: 10px; }
.fcp-rules { min-width: 860px; }
.fcp-rules td { padding: 5px 8px; }
.fcp-rules .fcp-rn { width: 170px; }
.fcp-rules .fcp-rc { width: 100%; min-width: 180px; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 12.5px; }
.fcp-rules .fcp-rc.is-bad { border-color: #e5484d; background: #fdecec; }
.fcp-rules tr.fcp-rerr td { color: #c2333a; font-size: 12px; padding-top: 0; border-bottom: 1px solid var(--border); }
.fcp-rules td.nw { white-space: nowrap; }
.fcp-rules .fcp-tin[readonly] { background: transparent; border-color: transparent; }
html[data-theme="dark"] .fcp-rules .fcp-rc.is-bad { background: #3a1a1c; }
html[data-theme="dark"] .fcp-rules tr.fcp-rerr td { color: #ff8a8f; }

/* ── «Змінні» page (step 1, as Variables in Forecast IDE) ── */
.fv-tbl { min-width: 860px; }
.fv-tbl td { vertical-align: top; }
.fv-tbl .sm { display: block; font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
.fv-tbl .sm.err { color: #c2333a; }
.fv-tbl td.nw { white-space: nowrap; }
.fv-tbl tr.is-sys td { background: color-mix(in srgb, var(--sp) 3%, var(--surface)); }
.fv-name { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 13px; font-weight: 600; }
.fv-how { font-size: 12.5px; color: var(--text-soft); font-style: italic; }
.fv-sbar { display: flex; align-items: center; gap: 10px; }
.fv-sbar .fcp-msg { white-space: nowrap; }
#fv .fcp-bar .btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
#fv input.fv-q { width: 220px; flex: 0 0 auto; }
.fv-tbl .sm.fv-why { color: #8a4b00; }
.fv-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.fv-badge.is-sys { background: #eef4fd; color: #2f5fb0; }
.fv-badge.is-calc { background: #e6f6ee; color: #1a7f4e; }
.fv-badge.is-start { background: #f0f2f5; color: #5b7083; }
.fv-badge.is-frozen { background: #fdf3e6; color: #a34700; }
html[data-theme="dark"] .fv-badge.is-sys { background: #1d2a40; color: #9dbcf0; }
html[data-theme="dark"] .fv-badge.is-calc { background: #173326; color: #5fd39a; }
html[data-theme="dark"] .fv-badge.is-start { background: #232b38; color: #a9b6c6; }
html[data-theme="dark"] .fv-badge.is-frozen { background: #3a2a14; color: #f0b968; }
.fv-sbar { flex-wrap: wrap; margin-bottom: 8px; }
.fv-start { font-size: 12.5px; }
.fv-start th, .fv-start td { white-space: nowrap; padding: 6px 10px; }
.fv-start th { text-transform: none; letter-spacing: 0; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
    font-size: 11.5px; }
.fv-start th.has-err { color: #c2333a; }
.fv-start .fv-st-id { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; }
.fv-start .fv-st-id .sm { display: block; font-size: 11px; color: var(--text-mute); }
.fv-start td.err { color: #c2333a; font-weight: 700; cursor: help; }
html[data-theme="dark"] .fv-tbl tr.is-sys td { background: color-mix(in srgb, var(--sp) 6%, var(--surface)); }
html[data-theme="dark"] .fv-tbl .sm.fv-why { color: #f0b968; }
html[data-theme="dark"] .fv-tbl .sm.err, html[data-theme="dark"] .fv-start td.err,
html[data-theme="dark"] .fv-start th.has-err { color: #ff8a8f; }
@media (max-width: 760px) { #fv input.fv-q { width: 100%; flex: 1 1 100%; } }

/* step 2 «Агрегати» — the Agg Editor table */
.ag2-tbl { min-width: 980px; }
.ag2-tbl td { vertical-align: top; }
.ag2-tbl td.nw { white-space: nowrap; }
.ag2-tbl td.act { text-align: right; width: 1%; }
.ag2-tbl .sm { display: block; font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
.ag2-tbl .sm.err { color: #c2333a; }
.ag2-name { width: 190px; }
.ag2-fxc { min-width: 320px; width: 45%; }
.ag2-tbl .ag-fx, .ag2-tbl .ag-under { height: 30px; line-height: 30px; }
.ag2-tbl tr.is-err .ag-fxwrap { border-color: #e5a3a5; }
.ag2-tbl tr.is-off td:not(.act) { opacity: .55; }
.ag2-in-fmt { min-width: 76px; }
.ag2-in-mo { min-width: 150px; }
.ag2-mo { font-size: 12.5px; color: var(--text-soft); font-style: italic; line-height: 30px; }
.ag2-sys { min-width: 760px; }
.ag2-sys td { vertical-align: middle; }
.ag2-nm, .ag2-tg { all: unset; cursor: pointer; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 12.5px;
    font-weight: 600; color: var(--text); border-radius: 5px; }
.ag2-nm:hover, .ag2-nm:focus-visible { color: var(--primary); text-decoration: underline; }
.ag2-tg:focus-visible, .ag2-nm:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ag2-ch { display: inline-block; width: 14px; color: var(--sp); transition: transform .15s; }
.ag2-fam.is-open .ag2-ch { transform: rotate(90deg); }
.ag2-fam td { background: color-mix(in srgb, var(--sp) 5%, var(--surface)); }
.ag2-mem td:first-child { padding-left: 34px; }
.ag2-mem td { font-size: 12.5px; }
.ag2-ide td { padding: 2px 6px 2px 0; border: 0; font-size: 12px; color: var(--text-mute); }
#ag .fcp-bar .btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .ag2-ch { transition: none; } }
html[data-theme="dark"] .ag2-tbl .sm.err { color: #ff8a8f; }
html[data-theme="dark"] .ag2-fam td { background: color-mix(in srgb, var(--sp) 9%, var(--surface)); }

/* step 3 «Осіменіння» — quota rules as cards */
.qr-list { display: flex; flex-direction: column; gap: 10px; }
.qr-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 9px;
    display: flex; flex-direction: column; gap: 6px; }
.qr-card.is-err { border-color: #e5a3a5; }
.qr-card.is-off > :not(.qr-head) { opacity: .55; }
.qr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qr-name { width: 240px; font-weight: 600; }
.qr-nm { font-size: 14px; }
.qr-sp { flex: 1 1 auto; }
.qr-onl { display: inline-flex; align-items: center; }
.qr-row { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: center; }
.qr-l { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute);
    text-align: right; cursor: help; }
.qr-row .ag-fx, .qr-row .ag-under { height: 30px; line-height: 30px; font-size: 13px; }
.qr-row.is-err .ag-fxwrap { border-color: #e5484d; }
/* the typical rules read as sentences with fields */
.qr-say { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.qr-say b { font-weight: 600; }
.qr-say .qr-num { height: 28px; text-align: right; padding: 0 7px; font-variant-numeric: tabular-nums; }
.qr-cb { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-soft); cursor: pointer; white-space: nowrap; }
.qr-cb input { margin: 0; }
.qr-seg { margin-left: 2px; }
.qr-seg .seg-btn { padding: 3px 11px; font-size: 12.5px; }
.qr-farm { font-size: 12px; color: #11663f; background: #e6f6ee; border-radius: 999px; padding: 1px 8px; white-space: nowrap; cursor: help; }
.qr-farmb { all: unset; cursor: pointer; font-size: 12px; color: var(--primary); white-space: nowrap; }
.qr-farmb:hover, .qr-farmb:focus-visible { text-decoration: underline; }
.qr-man { all: unset; cursor: pointer; align-self: flex-start; font-size: 12px; color: var(--text-mute); }
.qr-man:hover, .qr-man:focus-visible { color: var(--primary); }
.qr-words { font-size: 13px; color: var(--text-soft); line-height: 1.45; }
.qr-warn { flex-basis: 100%; color: #8a5a00; background: #fdf4dc; border-radius: 6px; padding: 3px 8px; }
.qr-mv { white-space: nowrap; }
.ag-tok span { color: var(--text-soft); font-size: 12px; }
.ag-more { flex-basis: 100%; }
.ag-more summary { cursor: pointer; font-size: 12px; color: var(--text-mute); margin: 2px 0 4px; }
.ag-more[open] { display: flex; flex-wrap: wrap; gap: 5px; }
.ag-more[open] summary { flex-basis: 100%; }
.qr-err { font-size: 12.5px; color: #c2333a; }
.qr-err:empty { display: none; }
.qr-foot { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--text-soft);
    font-variant-numeric: tabular-nums; border-top: 1px dashed var(--border); padding-top: 6px; margin-top: 2px; }
.qr-foot:empty { display: none; }
.qr-foot b { color: var(--text); font-weight: 600; }
.qr-tags { color: var(--text-mute); font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 11.5px; }
#qr .fcp-bar .btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
@media (max-width: 760px) {
    .qr-row { grid-template-columns: 1fr; gap: 3px; }
    .qr-l { text-align: left; }
    .qr-name { width: 100%; }
}
html[data-theme="dark"] .qr-err { color: #ff8a8f; }
html[data-theme="dark"] .qr-farm { color: #6fd6a2; background: #173b2a; }
html[data-theme="dark"] .qr-warn { color: #f3c969; background: #3a2f12; }

/* step 4 «Правила» — weekdays of a rule */
.rl-days { display: inline-flex; border: 1px solid #cfe0f5; border-radius: 999px; overflow: hidden; background: #e8f1fc; }
.rl-d { all: unset; cursor: pointer; font-size: 12px; padding: 4px 8px; color: var(--text-soft); line-height: 1.2; }
.rl-d + .rl-d { border-left: 1px solid #cfe0f5; }
.rl-d.is-on { background: var(--primary); color: #fff; }
.rl-d:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.rl-d[disabled] { cursor: default; }
html[data-theme="dark"] .rl-days { background: var(--surface-2, #131c2b); border-color: var(--border); }
html[data-theme="dark"] .rl-d + .rl-d { border-color: var(--border); }
#rl .fcp-bar .btn:disabled { opacity: .5; cursor: default; box-shadow: none; }

/* step 5 «Крива лактації» */
.cv-k { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-mute); }
.cv-k .seg-btn { padding: 4px 10px; font-size: 12.5px; }
#cvCurve[hidden] { display: none; }
#cvMore { align-self: center; }
#cvLact .seg-btn.cv-borrow:not(.is-active) { opacity: .55; }
.cv-mute { color: var(--text-mute); font-weight: 400; }
.seg-btn.is-active .cv-mute { color: inherit; opacity: .75; }
.cv-empty { font-size: 13px; color: #7a4300; background: #fdf4e2; border: 1px solid #f0cf96; border-radius: 8px; padding: 7px 10px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cv-empty[hidden] { display: none; }
.cv-params { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.cv-p { display: flex; flex-direction: column; gap: 3px; }
.cv-p > span:first-child { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); }
.cv-pin { display: inline-flex; align-items: center; gap: 4px; }
.cv-pin .fcp-in { width: 72px; text-align: right; }
.cv-pin i { font-style: normal; font-size: 12px; color: var(--text-mute); }
.cv-tot .fcp-in { width: 84px; font-weight: 600; }
.cv-tot + .cv-tot .fcp-in { width: 64px; }
.cv-all { margin-left: auto; }
.cv-plot { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
.cv-plot-in { min-width: 800px; padding-bottom: 10px; }
.cv-chart { width: 100%; height: 230px; display: block; }
.cv-chart .cv-pt.is-hot { fill: var(--primary); stroke-width: 2.5; }
.cv-chart.can-grab, .cv-chart.is-drag { cursor: ns-resize; }
.cv-chart.is-drag { user-select: none; }
.cv-chart .cv-guide { stroke: var(--primary); stroke-opacity: .25; stroke-width: 1; }
.cv-cells { position: relative; height: 28px; }
.cv-cells.has-hist { height: 44px; }
.cv-cell { position: absolute; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cv-cell .cv-m { width: 100%; padding: 0 2px; font-size: 12px; }
.cv-cell.is-hot .cv-m { border-color: var(--primary); }
.cv-hv { font-size: 11px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.cv-cell.is-hot .cv-hv { color: var(--text); }
.cv-chart .cv-grid { stroke: var(--border); stroke-width: 1; }
.cv-chart .cv-ax { font-size: 10.5px; fill: var(--text-mute); font-variant-numeric: tabular-nums; }
.cv-chart .cv-305 { stroke: var(--text-mute); stroke-dasharray: 3 3; }
.cv-chart .cv-line { fill: none; stroke: var(--primary); stroke-width: 2; }
.cv-chart .cv-hist { fill: none; stroke: #8a96a8; stroke-width: 1.5; stroke-dasharray: 5 4; }
.cv-chart .cv-pt { fill: var(--surface); stroke: var(--primary); stroke-width: 1.5; }
.cv-legend i, .fcp-legend .cv-dash { display: inline-block; width: 18px; height: 0; border-top: 2px dashed #8a96a8; vertical-align: middle; margin-right: 6px; }
.cv-means, .cv-season { font-size: 12.5px; }
.cv-means th, .cv-means td, .cv-season th, .cv-season td { padding: 5px 4px; }
.cv-means td.nw, .cv-season td.nw { padding-left: 12px; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cv-m, .cv-s { width: 52px; height: 26px; box-sizing: border-box; border: 1px solid transparent; background: #e8f1fc; border-radius: 6px;
    text-align: right; font: inherit; font-variant-numeric: tabular-nums; padding: 0 5px; color: var(--text); }
.cv-s { width: 56px; color: var(--text-mute); }
.cv-s.is-set { color: var(--text); font-weight: 600; background: #fff6e6; border-color: #f0cf96; }
.cv-m:focus, .cv-s:focus { outline: none; border-color: var(--primary); background: #fff; }
.cv-m[readonly], .cv-s[readonly] { background: transparent; }
.cv-hrow td { color: var(--text-mute); }
.cv-season td.up { color: #11663f; }
.cv-season td.dn { color: #c2333a; }
.cv-season th.cv-yr { border-left: 1px solid var(--border); }
#cv .fcp-bar .btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
html[data-theme="dark"] .cv-m, html[data-theme="dark"] .cv-s { background: var(--surface-2, #131c2b); }
html[data-theme="dark"] .cv-s.is-set { background: #3a2a10; border-color: #8a5a1a; }
html[data-theme="dark"] .cv-empty { background: #3a2a10; border-color: #8a5a1a; color: #f0c27a; }
html[data-theme="dark"] .cv-season td.up { color: #6fd6a2; }
html[data-theme="dark"] .cv-season td.dn { color: #ff8a8f; }
.fcp-sec > .fcp-bar { margin-top: -2px; }
#cvCurve, #cvLact { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
#cvCurve::-webkit-scrollbar, #cvLact::-webkit-scrollbar { display: none; }
#cvCurve .seg-btn, #cvLact .seg-btn { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 520px) { #cvCurve .cv-mute { display: none; } }
.cv-fline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; margin: 2px 0 10px; }
.cv-fline .fcp-in { width: 64px; text-align: right; }
.cv-fline .cv-sub { font-weight: 600; color: var(--sp); margin-right: 4px; }
.cv-dry { margin: 12px 0 2px; }
.cv-feed { font-size: 12.5px; width: auto; }
.cv-feed th, .cv-feed td { padding: 5px 6px; }
.cv-feed td.nw { white-space: nowrap; }
.cv-feed .cv-f { width: 58px; height: 26px; box-sizing: border-box; border: 1px solid transparent; background: #e8f1fc; border-radius: 6px;
    text-align: right; font: inherit; font-variant-numeric: tabular-nums; padding: 0 6px; }
.cv-feed .cv-f.wide { width: 140px; text-align: left; }
.cv-feed .cv-f.days { width: 46px; }
.cv-feed .cv-f:focus { outline: none; border-color: var(--primary); background: #fff; }
.cv-feed .cv-f[readonly] { background: transparent; }
.cv-feed td.cv-calc { color: var(--text-mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv-feed .cv-x { opacity: .5; }
.cv-feed tr:hover .cv-x { opacity: 1; }
html[data-theme="dark"] .cv-feed .cv-f:not([readonly]) { background: var(--surface-2, #131c2b); }
/* «Ріст і вага» */
.gw-breed { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-mute); }
.gw-breed select { width: 230px; height: 30px; text-align: left; padding: 0 8px; }
.gw-subh { margin: 6px 0 0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); }
.gw-end { font-weight: 600; font-variant-numeric: tabular-nums; }
.gw-feedl { gap: 8px 14px; }
.gw-two { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.gw-two .fcp-isle { flex: 0 1 auto; }
.gw-caps, .gw-young, .gw-cows, .gw-today { width: auto; font-size: 12.5px; }
.gw-caps th, .gw-caps td, .gw-young th, .gw-young td, .gw-cows th, .gw-cows td, .gw-today th, .gw-today td { padding: 5px 8px; }
.gw-cows th small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 10.5px; }
.gw-f { width: 58px; height: 26px; box-sizing: border-box; border: 1px solid transparent; background: #e8f1fc; border-radius: 6px;
    text-align: right; font: inherit; font-variant-numeric: tabular-nums; padding: 0 6px; }
.gw-f.days { width: 46px; }
.gw-f:focus { outline: none; border-color: var(--primary); background: #fff; }
.gw-f[readonly] { background: transparent; }
.gw-today.is-stale tbody { opacity: .55; }
.gw-stale-note { font-size: 11.5px; text-align: right; }
#gwChart .gw-line { fill: none; stroke: #b45309; stroke-width: 2; }
#gwChart .gw-cap { stroke: var(--primary); stroke-width: 1; stroke-dasharray: 4 4; opacity: .6; }
#gwChart .gw-cap.m { stroke: #b45309; }
#gwChart .gw-dot { fill: var(--primary); opacity: .35; }
#gwChart .gw-dot.m { fill: #b45309; }
.fcp-legend .gw-li { display: inline-block; width: 18px; height: 0; border-top: 2px solid #b45309; vertical-align: middle; margin-right: 6px; }
.fcp-legend .gw-li.dot { width: 7px; height: 7px; border: 0; border-radius: 50%; background: var(--primary); opacity: .5; }
html[data-theme="dark"] .gw-f:not([readonly]) { background: var(--surface-2, #131c2b); }
html[data-theme="dark"] #gwChart .gw-line, html[data-theme="dark"] #gwChart .gw-cap.m { stroke: #f0a35a; }
html[data-theme="dark"] #gwChart .gw-dot.m { fill: #f0a35a; }
html[data-theme="dark"] .fcp-legend .gw-li { border-top-color: #f0a35a; }
.gw-today td:first-child, .gw-caps td:first-child, .gw-cows td:first-child { white-space: nowrap; }
/* «Запуск» */
.rn-busy[hidden] { display: none; }
.rn-busy { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-mute); }
.rn-spin { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: rnspin .8s linear infinite; }
@keyframes rnspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rn-spin { animation: none; } }
.rn-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
@media (max-width: 520px) { .rn-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .rn-kpi .rn-kv { font-size: 17px; } }
.rn-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.rn-kl { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); }
.rn-kv { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.rn-ks { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.rn-t { font-size: 12.5px; }
.rn-t th, .rn-t td { padding: 5px 6px; }
.rn-kpi .rn-ks a { color: var(--primary); }
#rnRunsBox .rn-opt { display: inline-flex; align-items: center; gap: 6px; }
#rnRunsBox .rn-ol { display: none; }
.rn-t td.nw { white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.rn-t .rn-h td { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sp); background: var(--spbg); padding-top: 10px; }
.rn-t .rn-tot { font-weight: 600; border-left: 1px solid var(--border); }
.rn-t .rn-fam-row td { color: var(--text-mute); }
.rn-fam { margin-left: auto; margin-right: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 400; color: var(--text-mute); text-transform: none; letter-spacing: 0; }
.rn-chart2 { height: 160px; margin-top: 6px; }
@media (max-width: 520px) { .rn-kv { font-size: 17px; } .rn-kpi { padding: 8px 10px; } }
.rn-t .rn-strong td { font-weight: 700; }
.rn-t .rn-rg td { color: var(--text-mute); font-size: 12px; white-space: nowrap; }
#rnRange.is-on { border-color: var(--primary); color: var(--primary); }
.rn-opt[hidden] { display: none; }
.rn-opt { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.rn-ol { font-size: 12.5px; color: var(--text-mute); }
.rn-opt .segmented { flex: 0 0 auto; }
.rn-opt .seg-btn { padding: 4px 10px; font-size: 12.5px; white-space: nowrap; }
.rn-opt .seg-btn:disabled { opacity: .55; cursor: default; }
.rn-part { font-size: 17px; margin: 22px 0 8px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rn-part-sub { font-size: 12.5px; font-weight: 400; color: var(--text-mute); }

/* ── step 8 «Плани» ── */
.pl-pers { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.pl-pers::-webkit-scrollbar { display: none; }
.pl-pers .seg-btn { white-space: nowrap; }
.pl-pers[hidden] { display: none; }
.pl-addsel { width: 150px; text-align: left; }
.pl-per { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.pl-per[hidden] { display: none; }
.pl-per .sm { color: var(--text-mute); }
.pl-per .pl-from { width: 130px; margin-left: 6px; }
.fcp-t .pl-pct { width: 64px; text-align: right; }
.fcp-t .pl-m { width: 58px; text-align: right; }
.fcp-t .pl-rc { width: 124px; }
.pl-repro th.pl-grp { text-align: center; border-bottom: 1px solid var(--border); }
.pl-repro .pl-pct.set, .pl-cull .pl-pct.set { background: #fff4d6; border-color: #e9c46a; }
.pl-nohist { display: inline-block; margin-left: 8px; font-size: 11px; color: #8a5a00; background: #fdf4dc; border-radius: 999px; padding: 0 7px; cursor: help; }
.pl-sx td:first-child { color: var(--text-soft); }
.pl-sext { margin: 6px 0 0 2px; }
.pl-bulk { gap: 6px 8px; }
.pl-bulk #plBT { width: 100px; text-align: left; }
.pl-bulk #plBS { width: 124px; text-align: left; }
.pl-cull td.nw { white-space: nowrap; }
.fcp-t .pl-rc { text-align: left; }
.pl-gs { margin-left: 10px; color: var(--text-soft); font-weight: 400; font-variant-numeric: tabular-nums; }
.pl-from { display: inline-block; min-width: 22px; text-align: right; color: var(--text-soft); font-variant-numeric: tabular-nums; }
html[data-theme="dark"] .pl-repro .pl-pct.set, html[data-theme="dark"] .pl-cull .pl-pct.set { background: #3a2f12; border-color: #8a6a1a; }
html[data-theme="dark"] .pl-nohist { color: #f3c969; background: #3a2f12; }
.pl-repro td:first-child { white-space: nowrap; }
.pl-repro .sm, .pl-cull .sm { color: var(--text-mute); font-size: 12px; }
.pl-repro .sm { display: inline; margin-left: 4px; }
.pl-cull tr.grp td { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.pl-gh { font-weight: 600; color: var(--sp); }
.pl-radd { margin-left: 8px; padding: 2px 8px; font-size: 12px; }
.rn-vlink { font-size: 13px; color: var(--primary); text-decoration: none; }
.rn-vlink:hover { text-decoration: underline; }
.rn-cmp tr.rn-dr td { padding-top: 2px; font-size: 12px; color: var(--text-mute); border-bottom-width: 1px; }
.rn-cmp tr.rn-strong td { border-bottom: 0; padding-bottom: 2px; }
.rn-cmp .rn-d.up { color: #1a7f4e; }
.rn-cmp .rn-d.dn { color: #c2333a; }
html[data-theme="dark"] .rn-cmp .rn-d.up { color: #5fd39a; }
html[data-theme="dark"] .rn-cmp .rn-d.dn { color: #f08a8f; }

/* ── «Сценарії» (forecast_home): the tiles on the left, the chosen one's steps and result on the right ── */
.fh-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.fh-grid[hidden] { display: none; }
.fh-list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px;
    display: flex; flex-direction: column; gap: 6px; }
.fh-cap { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-mute);
    padding: 2px 4px 4px; }
#fhTiles { display: flex; flex-direction: column; gap: 6px; }
.fh-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
    font: inherit; cursor: pointer; }
.fh-tile:hover { border-color: #b9cdea; background: #f7faff; }
.fh-tile.is-on { border-color: var(--primary); background: #eef4fd; box-shadow: inset 3px 0 0 var(--primary); }
.fh-tt { font-weight: 600; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fh-ts { font-size: 11.5px; color: var(--text-mute); line-height: 1.3; }
.fh-tn { font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; margin-top: 2px; }
.fh-mute { color: var(--text-mute); }
.fc-sadd { margin: 2px 0; padding: 6px 12px; border: 1px dashed var(--primary); border-radius: 999px; background: transparent;
    color: var(--primary); font: inherit; font-size: 12.5px; cursor: pointer; align-self: flex-start; }
.fc-sadd:hover { background: #eef4fd; }
.fh-main { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
    display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.fh-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.fh-head h2 { margin: 0; font-size: 18px; }
.fh-head .fcp-sp { flex: 1 1 auto; }
.fh-chip { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: #eef1f5; color: var(--text-soft); white-space: nowrap; }
.fh-chip.is-own { background: #e6f6ee; color: #11663f; }
.fh-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.fh-acts .fh-del { color: #c2333a; }
.fh-per { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.fh-per[hidden] { display: none; }
.fh-st .fc-reset { padding: 0 0 0 6px; }
.fh-pl { font-weight: 600; }
.fh-pt { color: var(--text-mute); }
.fh-pd { font-variant-numeric: tabular-nums; }
.fh-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fh-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
    text-decoration: none; }
a.fh-step:hover { border-color: var(--primary); background: #f7faff; text-decoration: none; }
.fh-n { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; background: #eef1f5; color: var(--text-soft); }
.fh-step.is-own .fh-n { background: var(--primary); color: #fff; }
.fh-sb { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fh-sb b { font-size: 14px; }
.fh-what { font-size: 12px; color: var(--text-mute); }
.fh-sum { font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.fh-st { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: #eef1f5; color: var(--text-mute); white-space: nowrap; }
.fh-step.is-own .fh-st { background: #eef4fd; color: var(--primary); }
.fh-go { font-size: 12.5px; color: var(--primary); white-space: nowrap; }
.fh-res { border: 1px solid var(--border); border-radius: 10px; padding-bottom: 12px; }
.fh-res .fh-step { border: 0; grid-template-columns: 28px minmax(0, 1fr) auto; }
.fh-res .fh-n { background: #1aa86b; color: #fff; }
.fh-main { container-type: inline-size; }
.fh-kpis { padding: 0 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@container (min-width: 1080px) { .fh-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container (max-width: 480px) { .fh-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fh-cmp td .fh-d { font-size: 11px; line-height: 1.2; }
.fh-calc { margin-left: auto; margin-right: 6px; font-size: 12px; font-weight: 600; }
.fh-d { font-variant-numeric: tabular-nums; }
.fh-d.up { color: #11663f; }
.fh-d.dn { color: #c2333a; }
.fh-wait { font-size: 12.5px; color: var(--text-mute); padding: 4px 12px 0; }
.fh-cmp td.nw { white-space: nowrap; }
.fh-cmp tr.is-on td { background: #eef4fd; font-weight: 600; }
@media (max-width: 900px) { .fh-grid { grid-template-columns: 1fr; } }
@media (max-width: 620px) {
    .fh-step { grid-template-columns: 28px minmax(0, 1fr); }
    .fh-step .fh-st, .fh-step .fh-go { grid-column: 2; justify-self: start; }
    .fh-res .fh-step { grid-template-columns: 28px minmax(0, 1fr) auto; }
}

/* the bar on a step page: the scenario, its steps in order, «Далі» */
.fc-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; }
.fc-sback { font-size: 13px; white-space: nowrap; }
.fc-sname { font-weight: 600; font-size: 13.5px; padding-right: 12px; border-right: 1px solid var(--border); max-width: 220px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-sname.is-base { color: var(--text-soft); }
.fc-sl { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.fc-s { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px;
    color: var(--text-soft); white-space: nowrap; text-decoration: none; }
.fc-s i { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center;
    justify-content: center; font-size: 11px; font-weight: 600; background: #eef1f5; color: var(--text-soft); }
.fc-s:hover { background: #f2f6fc; text-decoration: none; }
.fc-s.is-own i { background: #dce8fa; color: var(--primary); }
.fc-s.is-on { background: var(--primary); color: #fff; }
.fc-s.is-on i { background: rgba(255, 255, 255, .25); color: #fff; }
.fc-snext { font-size: 13px; font-weight: 600; white-space: nowrap; margin-left: auto; }
.fc-s.is-own::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.fc-s.is-on.is-own::after { background: #fff; }
.fc-chip { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: #eef1f5; color: var(--text-mute); white-space: nowrap; cursor: default; }
.fc-chip.is-own { background: #eef4fd; color: var(--primary); }
.fc-reset { border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 12.5px; padding: 2px 4px; cursor: pointer; white-space: nowrap; }
.fc-reset:hover { text-decoration: underline; }
html[data-theme="dark"] .fc-chip { background: #263247; color: var(--text-soft); }
html[data-theme="dark"] .fc-chip.is-own { background: #1b2b45; color: #8db5f0; }
.fc-basebar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--text);
    background: #eef4fd; border: 1px solid #cfe0f5; border-radius: 10px; padding: 8px 12px; }
.fc-basebar .btn { margin-left: auto; }
html[data-theme="dark"] .fh-tile:hover, html[data-theme="dark"] a.fh-step:hover,
html[data-theme="dark"] .fc-s:hover, html[data-theme="dark"] .fc-sadd:hover { background: var(--surface-2, #131c2b); }
html[data-theme="dark"] .fh-tile.is-on, html[data-theme="dark"] .fh-cmp tr.is-on td { background: #1b2b45; }
html[data-theme="dark"] .fh-chip, html[data-theme="dark"] .fh-n, html[data-theme="dark"] .fh-st,
html[data-theme="dark"] .fc-s i { background: #263247; color: var(--text-soft); }
html[data-theme="dark"] .fh-chip.is-own { background: #103a28; color: #6fd6a2; }
html[data-theme="dark"] .fh-step.is-own .fh-st, html[data-theme="dark"] .fc-s.is-own i { background: #1b2b45; color: #8db5f0; }
html[data-theme="dark"] .fh-step.is-own .fh-n { background: var(--primary); color: #fff; }
html[data-theme="dark"] .fh-res .fh-n { background: #1aa86b; color: #fff; }
html[data-theme="dark"] .fh-d.up { color: #6fd6a2; }
html[data-theme="dark"] .fh-d.dn { color: #ff8a8f; }
html[data-theme="dark"] .fc-basebar { background: var(--surface-2, #131c2b); border-color: var(--border); }
/* «Осіменіння й правила»: one «Зберегти» on top (rqBar) — the blocks' own are clicked by it */
#qrDirty, #qrCancel, #qrSave, #rlDirty, #rlCancel, #rlSave, #rmDirty, #rmCancel, #rmSave { display: none !important; }
#rqBar { position: sticky; top: var(--sticky-top, 0px); z-index: 5; background: var(--bg); padding: 4px 0; }
#rqBar[hidden] { display: none; }

/* phones: the first column stays while a wide table scrolls sideways */
@media (max-width: 600px) {
    .pl-repro td:first-child, .pl-repro tr:first-child th:first-child, .pl-cull td:first-child, .pl-cull th:first-child,
    .gw-young td:first-child, .gw-young th:first-child, .gw-cows td:first-child, .gw-cows th:first-child {
        position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 4px 0 6px -4px rgba(0, 0, 0, .18); }
    .pl-cull tr.grp td:first-child { position: static; box-shadow: none; }
    .pl-repro td:first-child { white-space: normal; min-width: 96px; max-width: 120px; }
    .pl-nohist { display: block; margin: 2px 0 0; width: max-content; max-width: 110px; white-space: normal; }
}

/* «Осіменіння й правила» by month: months down, the rules' numbers across */
#rm .fcp-isle { align-self: flex-start; max-width: 100%; }
.rm-t { width: auto; min-width: 0; }
.rm-t th.sc-l { min-width: 64px; max-width: 96px; text-align: right; }
.rm-t th.sc-g { text-align: center; }
.rm-t th.rm-off { color: var(--text-mute); text-decoration: line-through; }
.rm-t .rm-gl { border-left: 1px solid var(--border); }
.rm-t td { min-width: 0; }
.rm-t .sc-in { width: 70px; min-width: 0; }
.rm-t .rm-sel { width: 112px; }
.rm-t td.sc-m { font-weight: 500; }
.rm-t tr.rm-cur td.sc-m { color: var(--sp); }
.rm-now { font-size: 10.5px; font-weight: 600; letter-spacing: .03em; color: var(--sp); margin-left: 4px; }
.rm-t td.num { text-align: right; padding-inline: 10px; }
.rm-inh { color: var(--text-mute); }
.rm-sel { text-align: left; padding: 0 6px; cursor: pointer; appearance: none; -webkit-appearance: none; }
.rm-t td.is-hist .rm-sel, .rm-t td.is-above .rm-sel { color: var(--text-mute); }
.rm-t td.is-hist .rm-sel { font-style: italic; }
.rm-t td.is-hist .rm-sel option, .rm-t td.is-above .rm-sel option { font-style: normal; color: var(--text); }
#rm .sc-legend { font-weight: 400; cursor: default; }
@media (max-width: 760px) { #rm .sc-legend { display: none; } }

/* the result's tiles: a click shows what the number is made of */
.rn-kpi.fx-xpt { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.rn-kpi.fx-xpt:hover, .rn-kpi.fx-xpt:focus-visible, .rn-kpi.fx-xpt.is-xp { border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.fx-xp { position: absolute; z-index: 60; box-sizing: border-box; padding: 10px 12px 10px; border: 1px solid var(--border);
    border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); font-size: 13px; }
.fx-xp .xp-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.fx-xp .xp-h b { font-size: 13.5px; }
.fx-xp .xp-h span { color: var(--text-mute); font-size: 12px; }
.fx-xp .xp-x { margin-left: auto; border: 0; background: transparent; color: var(--text-mute); cursor: pointer; font-size: 13px;
    width: 24px; height: 24px; border-radius: 6px; }
.fx-xp .xp-x:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.xp-t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.xp-t td { padding: 5px 4px; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); vertical-align: top; }
.xp-t td:first-child { white-space: nowrap; font-weight: 500; padding-right: 10px; }
.xp-t td.xp-how { color: var(--text-soft); font-size: 12.5px; }
.xp-t td.xp-v { text-align: right; white-space: nowrap; padding-left: 10px; }
.xp-t tr.xp-tot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--border); }
.xp-note { margin: 8px 0 0; font-size: 12px; color: var(--text-mute); }
@media (max-width: 600px) { .xp-t td:first-child { white-space: normal; } }
/* the page's reference on a phone: the label above, the tokens wrap within the screen */
@media (max-width: 600px) {
    .ag-rblk { flex-direction: column; gap: 4px; }
    .ag-rblk > b { flex: none; }
    .ag-rblk .sm, .ag-rblk code { overflow-wrap: anywhere; white-space: normal; }
    .ag-tok { max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }
}
