/*
  QuarryIQ components. Each one has one job; use these instead of ad-hoc page CSS.
    .q-kpi        headline figure (+ change + sparkline)
    .q-table      data table (desktop)         .q-rowcard   the same rows on a phone
    .q-status     state pill (icon + label)    .q-meter     ratio against a limit
    .q-field      form field wrapper           .q-segmented  small option switch
    .q-chart      chart container              .q-empty     empty state
*/

.q-num { font-variant-numeric: tabular-nums; }
.q-muted { color: var(--q-ink-3); }

/* ---- KPI tile ------------------------------------------------------------------------------- */
.q-kpis { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px)  { .q-kpis { gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .q-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } .q-kpis--six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.q-kpi {
  display: flex; flex-direction: column; gap: .35rem; min-width: 0;
  background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card);
  box-shadow: var(--q-shadow-card); padding: 1rem 1.1rem 1rem;
}
.q-kpi__label { font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2); }
.q-kpi__figure { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.q-kpi__value {
  font-family: var(--q-font-display); font-weight: 600; font-size: var(--q-text-3xl);
  line-height: 1; letter-spacing: -.03em; color: var(--q-ink); font-variant-numeric: lining-nums tabular-nums;
}
.q-kpi__unit { font-size: var(--q-text-md); color: var(--q-ink-3); font-weight: 500; }
.q-kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .35rem; min-height: 2rem; }
.q-kpi__period { font-size: var(--q-text-xs); color: var(--q-ink-3); line-height: 1.3; }
.q-kpi__spark { width: 5.5rem; height: 2rem; flex: none; overflow: visible; }
.q-kpi__spark .area { fill: var(--q-s1); opacity: .12; }
.q-kpi__spark .line { fill: none; stroke: var(--q-s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.q-kpi__spark .dot  { fill: var(--q-s1); stroke: var(--q-surface); stroke-width: 2; }
@media (min-width: 1200px) { .q-kpi--lead { grid-column: span 2; } .q-kpi--lead .q-kpi__spark { width: 12rem; height: 3rem; } }
@media (max-width: 575.98px) {
  .q-kpi { padding: .85rem .9rem; }
  .q-kpi__foot { flex-direction: column; align-items: flex-start; gap: .35rem; }
  .q-kpi__spark { width: 100%; height: 1.75rem; }
}

/* Change indicator: arrow + signed figure; colour says better/worse, the arrow says up/down */
.q-delta { display: inline-flex; align-items: center; gap: .15rem; font-size: var(--q-text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.q-delta .q-icon { width: 1rem; height: 1rem; }
.q-delta.is-good { color: var(--q-good-ink); }
.q-delta.is-bad  { color: var(--q-critical-ink); }
.q-delta.is-flat { color: var(--q-ink-3); }

/* ---- Status pill ----------------------------------------------------------------------------- */
.q-status {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .15rem .6rem .15rem .45rem; border-radius: var(--q-r-pill);
  font-size: var(--q-text-sm); font-weight: 500; line-height: 1.5;
  background: var(--q-surface-sunk); color: var(--q-ink-2);
}
.q-status .q-icon { width: .95rem; height: .95rem; }
.q-status.is-good     { background: var(--q-good-soft);     color: var(--q-good-ink); }
.q-status.is-warning  { background: var(--q-warning-soft);  color: var(--q-warning-ink); }
.q-status.is-serious  { background: var(--q-serious-soft);  color: var(--q-serious-ink); }
.q-status.is-critical { background: var(--q-critical-soft); color: var(--q-critical-ink); }

/* ---- Table (desktop) ------------------------------------------------------------------------ */
.q-table-wrap { background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); overflow-x: auto; }
.q-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.q-table th {
  position: sticky; top: 0; background: color-mix(in srgb, var(--q-surface-sunk) 50%, var(--q-surface));
  padding: .55rem .75rem; text-align: center; vertical-align: middle; white-space: nowrap;
  font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2);
  border-bottom: 1px solid var(--q-line-strong);
}
.q-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--q-line); text-align: center; vertical-align: middle; }
.q-table tbody tr:last-child td { border-bottom: 0; }
.q-table tbody tr:hover td { background: var(--q-surface-sunk); }
.q-table .num { text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-table th.num { text-align: center; }
.q-table .unit { color: var(--q-ink-3); font-size: var(--q-text-sm); font-weight: 400; margin-left: .2rem; }
.q-table tfoot td { font-weight: 600; background: var(--q-surface-sunk); border-top: 1px solid var(--q-line-strong); border-bottom: 0; }
.q-table--compact td, .q-table--compact th { padding-top: .4rem; padding-bottom: .4rem; }
.q-table .is-best td { background: var(--q-primary-soft); }
.q-table caption { caption-side: top; padding: .85rem .9rem .35rem; text-align: left; font-family: var(--q-font-display); font-weight: 600; font-size: var(--q-text-md); color: var(--q-ink); }

/* ---- Row card (the same rows on a phone) --------------------------------------------------- */
.q-rowcards { display: grid; gap: .6rem; }
@media (min-width: 992px) { .q-rowcards { grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: 1rem; } }
.q-rowcard { background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); padding: .85rem 1rem; }
.q-rowcard.is-best { border-color: #9fd0da; background: var(--q-primary-soft); }
.q-rowcard__head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.q-rowcard__title { font-weight: 600; }
.q-rowcard__main { font-family: var(--q-font-display); font-weight: 600; font-size: var(--q-text-xl); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-rowcard__main small { font-family: var(--q-font-body); font-size: var(--q-text-sm); color: var(--q-ink-3); font-weight: 400; margin-left: .15rem; }
.q-rowcard dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .7rem 0 0; }
.q-rowcard dt { font-size: var(--q-text-xs); font-weight: 400; color: var(--q-ink-3); }
.q-rowcard dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; font-size: var(--q-text-base); }

/* ---- Panel / cards with titles ------------------------------------------------------------- */
.q-panel { background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); }
.q-panel__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--q-line); }
.q-panel__head h2, .q-panel__head h3 { margin: 0; font-size: var(--q-text-md); }
.q-panel__body { padding: 1rem 1.25rem 1.25rem; }
@media (max-width: 575.98px) { .q-panel__body { padding: 1rem; } .q-panel__head { padding: .8rem 1rem; } }

/* ---- Meter (ratio against a limit) --------------------------------------------------------- */
.q-meter { display: grid; gap: .35rem; }
.q-meter__row { display: flex; justify-content: space-between; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.q-meter__row strong { color: var(--q-ink); font-variant-numeric: tabular-nums; }
.q-meter__track { height: .5rem; border-radius: var(--q-r-pill); background: var(--q-seq-100); overflow: hidden; }
.q-meter__fill { height: 100%; border-radius: var(--q-r-pill); background: var(--q-seq-500); }

/* ---- Form fields ---------------------------------------------------------------------------- */
.q-form-grid { display: grid; gap: 1.1rem 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .q-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .q-form-grid .is-wide { grid-column: 1 / -1; } }

.q-field { display: flex; flex-direction: column; min-width: 0; }
.q-field > label, .q-field > legend { font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2); margin-bottom: .35rem; padding: 0; float: none; width: auto; }
.q-field.is-required > label::after, .q-field.is-required > legend::after { content: " *"; color: var(--q-ink-3); }
.q-field__control { position: relative; display: flex; align-items: stretch; }
.q-field__control .form-control, .q-field__control .form-select { flex: 1; min-width: 0; }
.q-field__control.has-unit .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; text-align: right; font-variant-numeric: tabular-nums; }
.q-field__unit {
  display: inline-flex; align-items: center; padding: 0 .8rem; min-width: 3.5rem; justify-content: center;
  background: var(--q-surface-sunk); border: 1px solid var(--q-line-strong); border-left: 0;
  border-radius: 0 var(--q-r-ctrl) var(--q-r-ctrl) 0; color: var(--q-ink-2); font-size: var(--q-text-sm); white-space: nowrap;
}
.q-field__help { margin-top: .3rem; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.q-field__error { margin: .3rem 0 0; padding: 0; list-style: none; font-size: var(--q-text-sm); color: var(--q-critical-ink); font-weight: 500; }
.q-field.is-invalid .form-control, .q-field.is-invalid .form-select { border-color: var(--q-critical); }
.q-field.is-invalid .q-field__unit { border-color: var(--q-critical); }
.q-field .form-check { padding-left: 0; display: flex; align-items: center; gap: .6rem; min-height: 2.625rem; }
.q-field .form-check-input { margin: 0; float: none; flex: none; }
.q-field .form-switch .form-check-input { width: 2.5rem; height: 1.4rem; }

/* Segmented control (renders a RadioSelect: few options, one tap each) */
.q-field fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.q-field fieldset legend { font-family: var(--q-font-body); font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2); margin-bottom: .35rem; padding: 0; float: none; width: auto; }
.q-field.is-required fieldset legend::after { content: " *"; color: var(--q-ink-3); }
.q-segmented { display: inline-flex; align-self: flex-start; max-width: 100%; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); overflow: hidden; background: var(--q-surface); }
.q-segmented div { display: contents; }
.q-segmented label { margin: 0; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: .4rem .7rem; flex: 1 1 auto; font-size: var(--q-text-base); font-weight: 500; color: var(--q-ink-2); }
.q-segmented div + div label { border-left: 1px solid var(--q-line-strong); }
.q-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.q-segmented label:has(input:checked) { background: var(--q-primary-soft); color: var(--q-primary); }
.q-segmented label:has(input:focus-visible) { outline: 2px solid var(--q-primary); outline-offset: -2px; }
@media (max-width: 575.98px) { .q-segmented { display: flex; align-self: stretch; } .q-segmented > div { display: flex; flex: 1; } .q-segmented > div > div { display: block; flex: 1; } .q-segmented label { width: 100%; } }

/* iOS zooms into inputs smaller than 16px: keep phone inputs at 16px and finger-sized */
@media (max-width: 639.98px), (max-width: 991.98px) and (pointer: coarse) {
  .form-control, .form-select { font-size: 1rem; min-height: 3rem; }
  .q-field__unit { font-size: var(--q-text-base); }
}

/* ---- Chart container ------------------------------------------------------------------------ */
.q-chart { min-height: 14rem; }
.q-chart .js-plotly-plot, .q-chart .plotly-graph-div { width: 100% !important; }
.q-chart__title { font-family: var(--q-font-display); font-weight: 600; font-size: var(--q-text-md); margin: 0 0 .15rem; }
.q-chart__sub { color: var(--q-ink-3); font-size: var(--q-text-sm); margin: 0 0 .5rem; }

/* ---- Empty state ---------------------------------------------------------------------------- */
.q-empty { text-align: center; padding: 3rem 1.5rem; max-width: 34rem; margin: 0 auto; }
.q-empty__icon { width: 3.25rem; height: 3.25rem; border-radius: 50%; background: var(--q-primary-soft); color: var(--q-primary); display: inline-grid; place-items: center; margin-bottom: 1rem; }
.q-empty__icon .q-icon { width: 1.5rem; height: 1.5rem; }
.q-empty h2 { font-size: var(--q-text-lg); margin-bottom: .35rem; }
.q-empty p { color: var(--q-ink-2); margin-bottom: 1.25rem; }

/* ---- Style-guide helpers (only used on /styleguide/) ---------------------------------------- */
.sg-swatches { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); }
.sg-swatch { border: 1px solid var(--q-line); border-radius: var(--q-r-ctrl); overflow: hidden; background: var(--q-surface); font-size: var(--q-text-xs); }
.sg-swatch i { display: block; height: 2.75rem; }
.sg-swatch b { display: block; padding: .35rem .5rem 0; font-weight: 500; font-size: var(--q-text-sm); }
.sg-swatch code { display: block; padding: 0 .5rem .4rem; color: var(--q-ink-3); }
.sg-type > div { display: flex; align-items: baseline; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--q-line); }
.sg-type small { width: 9rem; flex: none; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.sg-note { color: var(--q-ink-3); font-size: var(--q-text-sm); }

/* ---- Table extras ---------------------------------------------------------------------------- */
.q-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .75rem 1rem; border-bottom: 1px solid var(--q-line); }
.q-toolbar__grow { flex: 1; }
.q-search { position: relative; min-width: 20rem; }
.q-search .q-icon { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--q-ink-3); pointer-events: none; }
.q-search input { padding-left: 2.1rem; min-height: 2.25rem; }
.q-toolbar .q-segmented label { min-height: 2.25rem; padding-top: .2rem; padding-bottom: .2rem; }
.q-count { color: var(--q-ink-3); font-size: var(--q-text-sm); font-variant-numeric: tabular-nums; }

.q-panel > .q-table-wrap, .q-panel > .q-table-scroll { border: 0; box-shadow: none; border-radius: 0 0 var(--q-r-card) var(--q-r-card); }
.q-table-scroll { overflow-x: auto; }

/* Sortable headers */
.q-table th[data-sort] { cursor: pointer; user-select: none; }
.q-table th[data-sort]::after { content: ""; display: inline-block; width: .5rem; margin-left: .35rem; opacity: .35; }
.q-table th[data-sort]:hover { color: var(--q-ink); }
.q-table th[aria-sort="ascending"]::after  { content: "\2191"; opacity: 1; }
.q-table th[aria-sort="descending"]::after { content: "\2193"; opacity: 1; }
.q-table th[aria-sort] { color: var(--q-ink); }
.q-table th.num[data-sort]::after { margin-left: .2rem; }

/* Density */
.q-table--compact td, .q-table--compact th { padding-top: .35rem; padding-bottom: .35rem; font-size: var(--q-text-sm); }
.q-table--zebra tbody tr:nth-child(even) td { background: var(--q-surface-sunk); }
.q-table--zebra tbody tr:hover td { background: var(--q-primary-soft); }

/* Sticky first column for wide tables */
.q-table--sticky-first th:first-child, .q-table--sticky-first td:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--q-surface); border-right: 1px solid var(--q-line);
}
.q-table--sticky-first thead th:first-child { background: color-mix(in srgb, var(--q-surface-sunk) 50%, var(--q-surface)); z-index: 2; }
.q-table--sticky-first tfoot td:first-child { background: var(--q-surface-sunk); }

/* Inline bar inside a cell: value shown as text, magnitude as a thin bar */
.q-cellbar { display: grid; gap: .25rem; min-width: 7rem; }
.q-cellbar span { text-align: center; font-variant-numeric: tabular-nums; }
.q-cellbar i { display: block; height: 4px; border-radius: 2px; background: var(--q-seq-100); position: relative; }
.q-cellbar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--v); border-radius: 2px; background: var(--q-seq-500); }

/* Heat cell: sequential ramp 100..700 for magnitude, with text that stays readable */
.q-heat { text-align: center; font-variant-numeric: tabular-nums; }
.q-heat[data-l="1"] { background: var(--q-seq-100) !important; }
.q-heat[data-l="2"] { background: var(--q-seq-200) !important; }
.q-heat[data-l="3"] { background: var(--q-seq-300) !important; }
.q-heat[data-l="4"] { background: var(--q-seq-400) !important; color: #fff; }
.q-heat[data-l="5"] { background: var(--q-seq-500) !important; color: #fff; }
.q-table td.q-heat { border-bottom-color: #fff; border-right: 1px solid #fff; }

.q-table .is-negative { color: var(--q-critical-ink); }
.q-table .cell-actions { text-align: center; white-space: nowrap; }
.q-table tr.is-hidden { display: none; }
.q-table .muted-row td { color: var(--q-ink-3); }

.q-pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 1rem; border-top: 1px solid var(--q-line); font-size: var(--q-text-sm); color: var(--q-ink-3); }
.q-pager__btns { display: flex; gap: .35rem; }
.q-pager .btn { min-height: 2rem; padding: .2rem .6rem; }

.q-subnav { display: flex; gap: .25rem; flex-wrap: wrap; margin: -.75rem 0 1.5rem; }
.q-subnav a { padding: .35rem .8rem; border-radius: var(--q-r-pill); color: var(--q-ink-2); text-decoration: none; font-size: var(--q-text-sm); font-weight: 500; }
.q-subnav a:hover { background: var(--q-line); }
.q-subnav a[aria-current="page"] { background: var(--q-primary); color: #fff; }

/* ---- Chips: toggle pills for filters (multi-select), tags and removable filter summary ------ */
.q-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.q-chip { position: relative; margin: 0; cursor: pointer; }
.q-chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.q-chip > span, .q-chip-btn {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 2.25rem; padding: .3rem .95rem;
  border: 1.5px solid var(--q-primary); border-radius: var(--q-r-pill); background: transparent; color: var(--q-primary);
  font-size: var(--q-text-sm); font-weight: 500; line-height: 1.2; user-select: none;
  font-family: inherit; cursor: pointer; transition: background-color .12s, color .12s;
}
.q-chip-btn small { color: inherit; opacity: .7; font-size: var(--q-text-xs); font-weight: 400; }
.q-chip > span .q-icon { display: none; width: .95rem; height: .95rem; }
.q-chip:hover > span, .q-chip-btn:hover { background: var(--q-primary-soft); }
.q-chip input:checked + span, .q-chip-btn.is-on { background: var(--q-primary); color: #fff; }
.q-chip input:checked + span .q-icon { display: inline-block; }
.q-chip-btn:focus-visible, .q-chip input:focus-visible + span { outline: 2px solid var(--q-primary); outline-offset: 2px; }
.q-chip input:disabled + span { opacity: .45; cursor: not-allowed; }
@media (max-width: 639.98px), (max-width: 991.98px) and (pointer: coarse) { .q-chip > span, .q-chip-btn { min-height: 2.5rem; font-size: var(--q-text-base); } }

.q-chipgroup { display: grid; gap: .6rem; }
.q-chipgroup__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.q-chipgroup__label { font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2); }
.q-chipgroup__title { display: inline-flex; align-items: baseline; gap: .6rem; }
.q-chipgroup__count { color: var(--q-ink-3); font-size: var(--q-text-sm); font-variant-numeric: tabular-nums; }
.q-miniseg { display: inline-flex; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); overflow: hidden; background: var(--q-surface); }
.q-miniseg button { display: inline-flex; align-items: center; gap: .35rem; min-height: 2rem; padding: .2rem .7rem; border: 0; background: none; color: var(--q-ink-2); font-size: var(--q-text-sm); font-weight: 500; }
.q-miniseg button + button { border-left: 1px solid var(--q-line-strong); }
.q-miniseg button:hover:not(:disabled) { background: var(--q-surface-sunk); color: var(--q-ink); }
.q-miniseg button:disabled { color: var(--q-ink-3); opacity: .5; cursor: default; }
.q-miniseg button:focus-visible { outline: 2px solid var(--q-primary); outline-offset: -2px; }
@media (max-width: 639.98px), (max-width: 991.98px) and (pointer: coarse) { .q-miniseg button { min-height: 2.25rem; font-size: var(--q-text-base); } }

.q-filters { display: grid; gap: 1.5rem; }
.q-filters__foot { display: flex; gap: .5rem; justify-content: flex-end; padding-top: .25rem; }
@media (max-width: 991.98px) {
  .q-filters__foot { position: sticky; bottom: 0; background: var(--q-surface); padding: .75rem 0 0; border-top: 1px solid var(--q-line); margin-top: .5rem; }
  .q-filters__foot .btn { flex: 1; min-height: 3rem; }
}

/* Tag: a small static pill (not interactive). Dot = series colour, so tags match charts. */
.q-tag { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .65rem; border-radius: var(--q-r-pill); background: var(--q-surface-sunk); border: 1px solid var(--q-line); color: var(--q-ink-2); font-size: var(--q-text-sm); font-weight: 500; white-space: nowrap; }
.q-tag i { width: .6rem; height: .6rem; border-radius: 50%; background: var(--dot, var(--q-s1)); flex: none; }
.q-tag button { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; margin: 0 -.35rem 0 -.1rem; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--q-ink-3); }
.q-tag button:hover { background: var(--q-line); color: var(--q-ink); }
.q-tag button .q-icon { width: .8rem; height: .8rem; }
.q-tags { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.q-tags__clear { background: none; border: 0; padding: 0 .25rem; color: var(--q-primary); font-size: var(--q-text-sm); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.q-count-badge { display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; border-radius: var(--q-r-pill); background: var(--q-primary); color: #fff; font-size: var(--q-text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Bottom sheet on phones (Bootstrap offcanvas-lg is inline on desktop) */
@media (max-width: 991.98px) {
  .q-sheet { height: 85vh; background: var(--q-surface); border-radius: var(--q-r-card) var(--q-r-card) 0 0; }
}

/* ---- Date range picker (.q-daterange) ---- */
.q-daterange { display: grid; gap: .9rem; border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.q-daterange__legend { float: none; width: auto; padding: 0; margin: 0; font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2); }
.q-daterange__dates { max-width: 30rem; display: flex; align-items: flex-end; gap: .6rem; }
.q-daterange__dates .q-field { flex: 1 1 0; min-width: 0; margin: 0; }
.q-daterange__dash { padding-bottom: .55rem; color: var(--q-ink-3); }
.q-daterange__summary { margin: 0; font-size: var(--q-text-sm); color: var(--q-ink-2); font-variant-numeric: tabular-nums; }
.q-daterange__summary--compare { color: var(--q-ink-3); margin-top: .4rem; }

/* Own calendar (replaces the browser's date picker) */
.q-daterange__field { display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 2.5rem; padding: .4rem .75rem; background: var(--q-surface); border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); color: var(--q-ink); font: inherit; text-align: left; font-variant-numeric: tabular-nums; }
.q-daterange__field:hover { border-color: var(--q-ink-3); }
.q-daterange__field:focus-visible { outline: 2px solid var(--q-primary); outline-offset: 1px; }
.q-daterange__field .q-icon { color: var(--q-ink-3); flex: none; }
.q-cal { max-width: 40rem; background: var(--q-surface); border: 1px solid var(--q-line-strong); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-pop); padding: .9rem 1rem 1rem; }
.q-cal[hidden] { display: none; }
.q-cal__months { position: relative; }
.q-cal__nav { position: absolute; inset: 0 0 auto 0; display: flex; justify-content: space-between; pointer-events: none; z-index: 1; }
.q-cal__step { pointer-events: auto; display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 0; border-radius: var(--q-r-ctrl); background: transparent; color: var(--q-ink-2); }
.q-cal__step:hover { background: var(--q-primary-soft); }
.q-cal__wrap { display: flex; gap: 1.5rem; }
.q-cal__month { flex: 1 1 0; min-width: 0; }
.q-cal__title { height: 2.25rem; display: flex; align-items: center; justify-content: center; font-weight: 600; text-transform: capitalize; }
.q-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.q-cal__dow { text-align: center; font-size: var(--q-text-sm); color: var(--q-ink-3); padding: .3rem 0; text-transform: capitalize; }
.q-cal__day { position: relative; height: 2.5rem; border: 0; background: transparent; border-radius: 0; font: inherit; font-variant-numeric: tabular-nums; color: var(--q-ink); }
.q-cal__day:hover { background: var(--q-primary-soft); border-radius: var(--q-r-ctrl); }
.q-cal__day.is-in { background: var(--q-primary-soft); }
.q-cal__day.is-edge { background: var(--q-primary); color: #fff; border-radius: var(--q-r-ctrl); }
.q-cal__day.is-first { border-radius: var(--q-r-ctrl) 0 0 var(--q-r-ctrl); }
.q-cal__day.is-last { border-radius: 0 var(--q-r-ctrl) var(--q-r-ctrl) 0; }
.q-cal__day.is-today:not(.is-edge)::after { content: ""; position: absolute; left: 50%; bottom: .3rem; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--q-accent); }
.q-cal__day:focus-visible, .q-cal__step:focus-visible { outline: 2px solid var(--q-primary); outline-offset: -2px; }
.q-cal__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--q-line); }
.q-cal__hint { color: var(--q-ink-3); font-size: var(--q-text-sm); }

/* ---- Feedback: alerts, toasts, confirm dialog, tooltips, loading ---- */
.alert .q-icon { flex: none; width: 1.25rem; height: 1.25rem; margin-top: .1rem; }
.q-alert__body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: .1rem .5rem; align-items: baseline; }
.q-alert__title { font-weight: 600; }
.q-alert__list { flex-basis: 100%; margin: .35rem 0 0; padding-left: 1.2rem; }
.q-alert__body > details { flex-basis: 100%; }
.q-alert__body > .glpk__log { width: auto; margin: .4rem 0 0; }
.q-alert__body a:not(.q-alert__action) { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.q-alert__action { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.alert-dismissible .btn-close { position: static; padding: .35rem; margin: -.2rem -.4rem 0 0; }

.q-toasts { position: fixed; z-index: 1090; right: 1.5rem; bottom: 1.5rem; display: grid; gap: .6rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.q-toast { pointer-events: auto; display: flex; gap: .7rem; align-items: flex-start; padding: .8rem .9rem; background: var(--q-surface); border: 1px solid var(--q-line-strong); border-left-width: 4px; border-radius: var(--q-r-ctrl); box-shadow: var(--q-shadow-pop); opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.q-toast.is-in { opacity: 1; transform: none; }
.q-toast .q-icon { flex: none; width: 1.25rem; height: 1.25rem; margin-top: .1rem; }
.q-toast__body { flex: 1; min-width: 0; display: grid; gap: .1rem; color: var(--q-ink); }
.q-toast__body strong { font-weight: 600; }
.q-toast__body span { color: var(--q-ink-2); }
.q-toast__close { flex: none; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; margin: -.25rem -.3rem 0 0; border: 0; border-radius: var(--q-r-ctrl); background: transparent; color: var(--q-ink-3); }
.q-toast__close:hover { background: var(--q-surface-sunk); color: var(--q-ink); }
.q-toast.is-info { border-left-color: var(--q-primary); } .q-toast.is-info .q-icon { color: var(--q-primary); }
.q-toast.is-success { border-left-color: var(--q-good); } .q-toast.is-success .q-icon { color: var(--q-good-ink); }
.q-toast.is-warning { border-left-color: var(--q-warning); } .q-toast.is-warning .q-icon { color: var(--q-warning-ink); }
.q-toast.is-danger { border-left-color: var(--q-critical); } .q-toast.is-danger .q-icon { color: var(--q-critical-ink); }
@media (max-width: 639.98px), (max-width: 991.98px) and (pointer: coarse) { .q-toasts { left: 1rem; right: 1rem; width: auto; bottom: calc(var(--q-bottomnav-h) + env(safe-area-inset-bottom) + .75rem); } }

.q-confirm .modal-content { border: 0; }
.q-confirm .modal-body { display: grid; grid-template-columns: auto 1fr; column-gap: .9rem; padding: 1.4rem 1.5rem .5rem; }
.q-confirm__icon { grid-row: span 2; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--q-primary-soft); color: var(--q-primary); }
.q-confirm.is-danger .q-confirm__icon { background: var(--q-critical-soft); color: var(--q-critical-ink); }
.q-confirm__title { font-size: var(--q-text-lg, 1.125rem); font-weight: 600; margin: .1rem 0 .3rem; }
.q-confirm__text { margin: 0; color: var(--q-ink-2); }
.q-confirm .modal-footer { border: 0; padding: .9rem 1.5rem 1.25rem; gap: .5rem; }
@media (max-width: 575.98px) {
  .q-confirm .modal-dialog { align-items: flex-end; margin: 0; min-height: 100%; max-width: none; }
  .q-confirm .modal-content { border-radius: var(--q-r-card) var(--q-r-card) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .q-confirm .modal-footer { flex-direction: column-reverse; align-items: stretch; }
  .q-confirm .modal-footer .btn { width: 100%; margin: 0; }
}

.tooltip { --bs-tooltip-bg: var(--q-basalt); --bs-tooltip-color: #fff; --bs-tooltip-border-radius: var(--q-r-ctrl); --bs-tooltip-padding-x: .7rem; --bs-tooltip-padding-y: .45rem; --bs-tooltip-font-size: var(--q-text-sm); --bs-tooltip-max-width: 18rem; --bs-tooltip-opacity: 1; }
.q-help { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; padding: 0; margin-left: .15rem; vertical-align: middle; border: 0; border-radius: 50%; background: transparent; color: var(--q-ink-3); }
.q-help:hover, .q-help:focus-visible { color: var(--q-primary); background: var(--q-primary-soft); }
.q-help:focus-visible { outline: 2px solid var(--q-primary); outline-offset: 1px; }
.q-help .q-icon { width: 1.05rem; height: 1.05rem; }

.q-spinner { display: inline-block; width: 1.1rem; height: 1.1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: q-spin .7s linear infinite; vertical-align: -.2em; }
@keyframes q-spin { to { transform: rotate(360deg); } }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: 1.1rem; height: 1.1rem; margin: -.55rem 0 0 -.55rem; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: q-spin .7s linear infinite; }
.btn-secondary.is-loading::after { border-color: var(--q-ink); border-right-color: transparent; }
.q-skeleton { display: block; height: 1rem; border-radius: 4px; background: linear-gradient(90deg, var(--q-surface-sunk) 25%, #e3e8e6 37%, var(--q-surface-sunk) 63%); background-size: 400% 100%; animation: q-shimmer 1.4s ease infinite; }
.q-skeleton--block { height: 6rem; }
@keyframes q-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.modal { --bs-modal-bg: var(--q-surface); }
.modal-open .q-toasts { z-index: 1040; }

/* ---- Error pages (400, 403, 404, 500): the app's empty state, in the shell or on its own ---- */
.q-errorpage { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 0; }
.q-errorpage__head { padding: 1.1rem 1.5rem; }
.q-errorpage .q-brand { color: var(--q-ink); }
.q-errorpage .q-brand:hover { color: var(--q-ink); }
.q-errorpage .q-brand__mark .m-face { fill: var(--q-basalt); }
.q-errorpage__main { flex: 1; display: grid; place-items: center; padding: 1.5rem 1.5rem 6vh; }
.q-error { width: 100%; padding-top: 4rem; }
.q-error__icon.is-critical { background: var(--q-critical-soft); color: var(--q-critical-ink); }
.q-error .q-error__code { margin: 0 0 .25rem; font-size: var(--q-text-sm); font-weight: 600; color: var(--q-ink-3); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.q-error .q-error__title { margin: 0 0 .5rem; font-size: var(--q-text-xl); line-height: 1.2; }
.q-error .q-error__text { margin: 0 auto 1.5rem; color: var(--q-ink-2); font-size: var(--q-text-base); max-width: 28rem; }
.q-error .q-error__detail { margin: -.75rem auto 1.5rem; max-width: 28rem; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.q-error__detail code { color: var(--q-ink-2); background: var(--q-surface-sunk); padding: .1rem .4rem; border-radius: 4px; font-size: inherit; letter-spacing: .03em; white-space: nowrap; display: inline-block; }
.q-error__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
@media (max-width: 575.98px) { .q-error__actions .btn { flex: 1 1 100%; } }

/* ---- P4P pipeline: step bar -------------------------------------------------------------- */
.q-steps { margin: 0 0 1rem; }
.q-steps ol { list-style: none; margin: 0; padding: 0; display: flex; gap: .5rem; }
.q-steps__item { flex: 1 1 0; min-width: 0; }
.q-steps__item a { display: flex; align-items: center; gap: .6rem; padding: .4rem .8rem; border: 1px solid var(--q-line); border-radius: var(--q-r-card); background: var(--q-surface); color: var(--q-ink); text-decoration: none; }
.q-steps__item a:hover { border-color: var(--q-line-strong); }
.q-steps__dot { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: var(--q-text-sm); background: var(--q-surface-sunk); color: var(--q-ink-2); border: 1px solid var(--q-line-strong); }
.q-steps__dot svg { width: .95rem; height: .95rem; }
.q-steps__text { display: grid; line-height: 1.25; min-width: 0; }
.q-steps__text small { color: var(--q-ink-3); font-size: var(--q-text-xs); }
.q-steps__item.is-doing .q-steps__dot { border-color: var(--q-warning-ink); color: var(--q-warning-ink); background: var(--q-warning-soft); }
.q-steps__item.is-done .q-steps__dot { background: var(--q-good-ink); border-color: var(--q-good-ink); color: #fff; }
.q-steps__item.is-current a { border-color: var(--q-primary); box-shadow: inset 0 -2px 0 var(--q-accent); }
.q-nav__link--step { padding-left: 1.6rem; }
.q-desktop-note { padding: 1rem; border: 1px solid var(--q-line); border-radius: var(--q-r-card); background: var(--q-surface); color: var(--q-ink-2); }

.q-switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 500; }
.q-switch input { width: 2.4rem; height: 1.35rem; accent-color: var(--q-primary); cursor: pointer; }

/* ---- P4P: production flow matrix ------------------------------------------------------------- */
.c2b__panel { overflow: hidden; }
.c2b__table { margin: 0; width: 100%; border-collapse: separate; border-spacing: 0; }
.c2b__table th, .c2b__table td { vertical-align: middle; }
.c2b__corner { min-width: 7.5rem; }
.c2b__corner small { display: block; font-weight: 400; color: var(--q-ink-3); white-space: pre; }
.c2b__head, .c2b__rowhead, .c2b__corner { white-space: normal !important; }
.c2b__head { min-width: 4.5rem; max-width: 8rem; text-align: center; padding: .5rem .3rem !important; }
.c2b__rowhead { min-width: 7.5rem; padding: .4rem .75rem !important; }
.c2b__name { font-weight: 600; display: block; overflow-wrap: break-word; hyphens: auto; line-height: 1.25; }
.c2b__cell { height: 1px; padding: 0 !important; background: var(--q-surface); border-right: 1px solid var(--q-line); border-bottom: 1px solid var(--q-line); }
.c2b__input {
  --v: 0; display: block; width: 100%; min-width: 3.75rem; height: 100%; min-height: 2.75rem; padding: 0 .25rem; text-align: center; border: 0; border-radius: 0;
  font-variant-numeric: tabular-nums; font-size: var(--q-text-base); color: var(--q-ink);
  background: color-mix(in srgb, var(--q-seq-500) calc(var(--v) * 0.55%), transparent);
  outline: none; transition: background .12s;
}
.c2b__cell { position: relative; }
.c2b__input:focus { box-shadow: inset 0 0 0 2px var(--q-primary); background-color: var(--q-surface); }
.c2b__input.is-saving { opacity: .6; }
.c2b__input.is-error { box-shadow: inset 0 0 0 2px var(--q-critical); background: var(--q-critical-soft); }
.c2b__input[readonly] { cursor: default; }
.c2b__tools { display: none; flex-wrap: wrap; gap: .1rem; margin-top: .3rem; justify-content: center; max-width: 3.3rem; margin-inline: auto; }
.c2b__rowhead .c2b__tools { max-width: none; margin-inline: 0; justify-content: flex-start; }
.c2b.is-structure .c2b__tools { display: flex; }
.c2b__tool { border: 1px solid var(--q-line); background: var(--q-surface); border-radius: .35rem; width: 1.25rem; height: 1.25rem; line-height: 1; padding: 0; font-size: .75rem; color: var(--q-ink-2); cursor: pointer; }
.c2b__tool:hover { background: var(--q-surface-sunk); color: var(--q-ink); }
.c2b__tool--del:hover { color: var(--q-critical-ink); border-color: var(--q-critical); }
.c2b__struct { display: none; }
.c2b.is-structure .c2b__bar { display: flex; }
.c2b__bar { flex-wrap: wrap; gap: .75rem 1.5rem; margin-bottom: .75rem; }
.c2b__addform { display: flex; gap: .4rem; align-items: center; }
.c2b__addform input { height: 2.1rem; padding: 0 .6rem; border: 1px solid var(--q-line-strong); border-radius: .4rem; min-width: 12rem; }
.c2b__addform .btn { display: inline-flex; align-items: center; gap: .3rem; }
.c2b__msg { min-height: 1.5rem; margin-bottom: .25rem; font-size: var(--q-text-sm); color: var(--q-critical-ink); }
.c2b__msg.is-ok { color: var(--q-good-ink); }
.c2b__hint { margin: .75rem 0 1.25rem; }
.c2b__rename { height: 2rem; padding: 0 .5rem; border: 1px solid var(--q-primary); border-radius: .4rem; width: 100%; font-weight: 600; }

.c2b__flow { margin-top: 1.25rem; padding: 1rem 1.25rem 1.25rem; }
.c2b__flowhead { position: relative; margin: 0 0 1.5rem; }
.c2b__flowtitle { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; margin: 0; text-align: center; }
.c2b__from { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.c2b__from label { min-height: 2rem; padding: .25rem .8rem; font-size: var(--q-text-sm); }
.c2b__flowsvg svg { display: block; width: 100%; height: auto; overflow: visible; }
.c2b__flowsvg .fl-link { fill: none; stroke-linecap: butt; opacity: .45; transition: opacity .12s; }
.c2b__flowsvg .fl-link.is-on { opacity: .9; }
.c2b__flowsvg.is-hover .fl-link:not(.is-on) { opacity: .08; }
.c2b__flowsvg .fl-node { fill: var(--q-surface-sunk); stroke: var(--q-line-strong); }
.c2b__flowsvg text { font-size: 13px; fill: var(--q-ink); }
.c2b__flowsvg .fl-head { font-weight: 700; font-size: 14.5px; fill: var(--q-ink); }
.c2b__flowsvg .fl-sub { fill: var(--q-ink-3); font-size: 11px; }

/* Arrow under the matrix: spans exactly the cost-box columns */
.c2b__legend td { border: 0 !important; background: transparent !important; padding: .6rem .5rem .75rem !important; }
.c2b__arrow { display: flex; align-items: center; gap: .75rem; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.c2b__arrow > span { text-align: center; max-width: 90ch; }
.c2b__arrow > i { flex: 1 1 1.5rem; height: 1px; background: currentColor; position: relative; }
.c2b__arrow > i:first-child::before { content: ""; position: absolute; left: 0; top: -.4rem; height: .8rem; border-left: 1px solid currentColor; }
.c2b__arrow > i:last-child::after { content: ""; position: absolute; right: 0; top: -4px; width: 7px; height: 7px; border-top: 1px solid currentColor; border-right: 1px solid currentColor; transform: rotate(45deg); }

/* Quarry name under a P4P page title: it says what the page is about */
.q-pagehead__quarry { display: flex; align-items: center; gap: .5rem; margin: .35rem 0 0; font-size: var(--q-text-lg); font-weight: 600; color: var(--q-ink); }
.q-pagehead__quarry .q-icon { color: var(--q-ink-3); }
/* The region is a small chip beside the quarry name, so the two never fight over a baseline. */
.q-pagehead__quarry small { padding: .15rem .65rem; border-radius: var(--q-r-pill); background: var(--q-surface-sunk); border: 1px solid var(--q-line-strong); font-size: var(--q-text-sm); font-weight: 500; line-height: 1.4; color: var(--q-ink-2); }

/* ---- P4P Product Allocation: product pills in lanes, one lane per product group ------------- */
.alloc__msg { min-height: 1.25rem; margin-bottom: .5rem; color: var(--q-critical-ink); }
.alloc__bar { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.alloc__bar .q-chipgroup__count { margin-left: auto; }
.alloc__panel { padding: 1rem 1.25rem 1.25rem; }
.alloc__targets { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; padding: 0 0 1.25rem; margin-bottom: 0; }
.alloc__targets-label { color: var(--q-ink-2); font-size: var(--q-text-sm); font-weight: 500; margin-right: .25rem; }
.alloc__target { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.25rem; padding: .3rem .9rem; border: 1.5px solid var(--g, var(--q-line-strong)); border-radius: var(--q-r-pill); background: transparent; color: var(--q-ink); font-size: var(--q-text-sm); font-weight: 500; }
.alloc__target i { width: .65rem; height: .65rem; border-radius: 50%; background: var(--g); flex: none; }
.alloc__target:hover:not(:disabled) { background: var(--q-surface-sunk); }
.alloc__target:disabled { opacity: .45; cursor: default; }
.alloc__target:focus-visible { outline: 2px solid var(--q-primary); outline-offset: 2px; }
.alloc__target--none { --g: var(--q-line-strong); color: var(--q-ink-2); }
.alloc__lane { padding: 1rem 0; border-top: 1px solid var(--q-line); }
.alloc__lane:first-of-type { border-top: 0; }
.alloc__lanehead { display: flex; align-items: center; gap: .6rem; margin-bottom: .65rem; }
.alloc__lanehead h3 { margin: 0; font-size: var(--q-text-base); font-weight: 600; }
.alloc__lanehead .q-miniseg { margin-left: auto; }
.alloc__dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--g); flex: none; }
.alloc__count { color: var(--q-ink-3); font-size: var(--q-text-sm); font-variant-numeric: tabular-nums; }
.alloc__empty { display: none; margin: 0; font-size: var(--q-text-sm); }
.alloc__lane.is-empty .alloc__empty { display: block; }
.alloc__lane.is-empty .q-miniseg { display: none; }
.alloc__pill[hidden] { display: none; }
.alloc__pdot { display: inline-block; width: .6rem; height: .6rem; margin-right: .35rem; border-radius: 50%; background: var(--g, var(--q-context)); vertical-align: middle; position: relative; top: -1px; }
.alloc__pill input:checked + span .alloc__pdot { box-shadow: 0 0 0 2px #fff; }
.alloc__lane--none .alloc__pills, .alloc__lane--none .alloc__lanehead { justify-content: flex-start; }
.alloc__lane--none .alloc__lanehead .q-miniseg { margin-left: 0; }
.alloc__pills { gap: .7rem .6rem; }
.alloc__pill > span { border-radius: 1.1rem; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 2.4rem; max-width: 24rem; padding: .15rem .75rem; text-align: center; line-height: 1.15; }
.alloc__pill > span b { display: block; min-width: 0; max-width: 100%; font-size: .8125rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one line: every chip has the same height; the full name is in the tooltip */
.alloc__pill > span small:not(.q-code) { font-size: .6875rem; line-height: 1.1; opacity: .75; font-variant-numeric: tabular-nums; }
.alloc__lane--none .alloc__pill > span { border-style: dashed; border-color: var(--q-ink-3); color: var(--q-ink-2); }
.alloc__lane--none .alloc__pill input:checked + span { border-style: solid; border-color: var(--q-primary); background: var(--q-primary); color: #fff; }
.alloc__hint { margin-top: .75rem; }

/* section titles: left-aligned and the size of the results titles, like every other page */
.alloc__section { text-align: left; margin-bottom: .9rem; }
.alloc__section h2 { margin: 0; font-size: var(--q-text-md); font-weight: 600; }
.alloc__section p { margin: .25rem 0 0; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.alloc__section--groups { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--q-line); }
.alloc__tools { display: flex; justify-content: flex-start; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.alloc__tools .q-chipgroup__count { margin-left: .4rem; min-width: 5rem; text-align: left; }
.alloc__lane--none .alloc__empty { text-align: left; }

.alloc__stats { margin: -.3rem 0 .5rem; color: var(--q-ink-2); font-size: var(--q-text-sm); font-variant-numeric: tabular-nums; }
.alloc__share { height: .3rem; margin-bottom: .75rem; border-radius: var(--q-r-pill); background: var(--q-surface-sunk); overflow: hidden; }
.alloc__share i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--g); transition: width .25s ease; }
.alloc__lane.is-empty .alloc__share, .alloc__lane.is-empty .alloc__stats { display: none; }
@media (prefers-reduced-motion: reduce) { .alloc__share i { transition: none; } }
.alloc__lanehead .alloc__count { display: none; }

/* ---- P4P: stock grid ------------------------------------------------------------------------- */
.stk__intro { text-align: center; margin-bottom: .75rem; }
.stk__intro h2 { margin: 0; font-size: var(--q-text-lg, 1.15rem); font-weight: 600; }
.stk__intro p { max-width: 46rem; margin: .3rem auto 0; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.stk__panel { overflow: hidden; padding: 0; }
.stk__msg { min-height: 1.25rem; padding: .35rem .9rem 0; color: var(--q-critical-ink); }
.stk__scroll { overflow-x: auto; }
.stk__table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.stk__table th, .stk__table td { vertical-align: middle; }
.stk__corner, .stk__month { padding: .55rem .3rem; font-size: var(--q-text-sm); font-weight: 600; text-align: center; border-bottom: 1px solid var(--q-line-strong); white-space: nowrap; }
.stk__corner { position: sticky; left: 0; z-index: 1; min-width: 11rem; max-width: 13rem; text-align: left; padding-left: .9rem; background: var(--q-surface); }
.stk__corner small { display: block; font-weight: 400; color: var(--q-ink-3); }
.stk__rowhead { position: sticky; left: 0; z-index: 1; min-width: 11rem; max-width: 13rem; padding: .4rem .9rem; text-align: left; background: var(--q-surface); border-bottom: 1px solid var(--q-line); border-right: 1px solid var(--q-line); }
.stk__name { display: block; font-size: var(--q-text-sm); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.stk__rowhead small { display: block; margin-top: .1rem; font-size: var(--q-text-xs); color: var(--q-ink-3); font-variant-numeric: tabular-nums; }
.stk__cell { padding: 0 !important; height: 1px; border-bottom: 1px solid var(--q-line); border-right: 1px solid var(--q-line); background: var(--q-surface); }
.stk__input { display: block; width: 100%; min-width: 4.25rem; height: 100%; min-height: 2.75rem; padding: 0 .15rem; text-align: center; border: 0; border-radius: 0; background: transparent; color: var(--q-ink); font-size: var(--q-text-base); font-variant-numeric: tabular-nums; outline: none; }
.stk__input:focus { box-shadow: inset 0 0 0 2px var(--q-primary); background: var(--q-surface); }
.stk__input.is-saving { opacity: .6; }
.stk__input.is-error { box-shadow: inset 0 0 0 2px var(--q-critical); background: var(--q-critical-soft); }
.stk__input[readonly] { cursor: default; }
.stk__total { padding: .55rem .35rem; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--q-surface-sunk); border-right: 1px solid var(--q-line); }
.stk__table tfoot .stk__rowhead { background: var(--q-surface-sunk); font-weight: 600; border-bottom: 0; }

.stk__month small { display: block; font-weight: 400; color: var(--q-ink-3); }
.stk__opening { border-right: 2px solid var(--q-line-strong) !important; background: var(--q-surface-sunk); }
.stk__opening .stk__input { background: transparent; }

/* P&L: the months, covered or missing; click to select */
.pnl__strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .5rem; }
.pnl__month { position: relative; display: grid; gap: .1rem; justify-items: center; padding: .6rem .25rem; border: 1.5px dashed var(--q-line-strong); border-radius: var(--q-r-ctrl); color: var(--q-ink-3); text-align: center; cursor: pointer; margin: 0; user-select: none; }
.pnl__month input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.pnl__month b { color: var(--q-ink-2); font-weight: 600; }
.pnl__month small, .pnl__month span { font-size: var(--q-text-xs); }
.pnl__month span { display: inline-flex; align-items: center; gap: .2rem; }
.pnl__month span .q-icon { width: .8rem; height: .8rem; }
.pnl__month.is-covered { border: 1.5px solid var(--q-good); background: var(--q-surface-sunk); color: var(--q-ink); }
.pnl__month:hover { background: var(--q-primary-soft); }
.pnl__month:has(input:checked) { background: var(--q-primary); border-color: var(--q-primary); color: #fff; }
.pnl__month:has(input:checked) b, .pnl__month:has(input:checked) small, .pnl__month:has(input:checked) span { color: #fff; }
.pnl__month:has(input:focus-visible) { outline: 2px solid var(--q-primary); outline-offset: 2px; }

/* Data upload portal */
.dp { display: grid; gap: 1.25rem; }
.dp__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.dp__quarry .q-pagehead__quarry { margin: 0 0 .25rem; }
.dp__scroll { overflow-x: auto; }
.dp__grid { border-collapse: separate; border-spacing: 0 .35rem; width: 100%; min-width: 46rem; table-layout: fixed; }
.dp__grid tbody th { width: 9rem; padding-right: 1rem; font-weight: 600; color: var(--q-ink-2); font-size: var(--q-text-sm); text-align: left; white-space: nowrap; }
.dp__grid thead td { width: 9rem; background: none; }
.dp__grid td { text-align: center; height: 2.75rem; background: var(--q-surface-sunk); border-radius: 6px; }
.dp__grid td.is-picked { background: var(--q-primary-soft); box-shadow: inset 0 0 0 1.5px var(--q-primary); }
.dp__month { display: grid; gap: 0; justify-items: center; width: calc(100% - .35rem); margin: 0 .175rem; padding: .45rem .2rem; border: 1.5px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); background: var(--q-surface); color: var(--q-ink-2); cursor: pointer; }
.dp__month small { color: var(--q-ink-3); font-size: var(--q-text-xs); }
.dp__month:hover { background: var(--q-primary-soft); }
.dp__month.is-picked { background: var(--q-primary); border-color: var(--q-primary); color: #fff; }
.dp__month.is-picked small { color: #fff; }
.dp__month:focus-visible { outline: 2px solid var(--q-primary); outline-offset: 2px; }
.dp__mark { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1.5px dashed var(--q-line-strong); }
.dp__mark .q-icon { width: .95rem; height: .95rem; }
.dp__mark.is-done { background: var(--q-good); border: 0; color: #fff; }
.dp__legend { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 1rem 0 0; padding: 0; list-style: none; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.dp__legend li { display: inline-flex; align-items: center; gap: .5rem; }
.dp__legend .dp__mark { width: 1.15rem; height: 1.15rem; }
.dp__legend .dp__mark .q-icon { width: .75rem; height: .75rem; }
.dp__steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.dp__step { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; align-items: start; padding: 1.25rem; border: 1.5px solid var(--q-line); border-radius: var(--q-r-card); background: var(--q-surface); }
.dp__step h3 { margin: 0 0 .25rem; font-size: var(--q-text-md); }
.dp__step p { margin: 0; color: var(--q-ink-2); font-size: var(--q-text-sm); min-height: 2.6em; }
.dp__step .btn { grid-column: 1 / -1; margin-top: .75rem; justify-self: start; }
.dp__num { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--q-surface-sunk); color: var(--q-ink-2); font-weight: 600; }
.dp__step.is-ready { border-color: var(--q-primary); }
.dp__step.is-ready .dp__num { background: var(--q-primary); color: #fff; }
.dp__step.is-done .dp__num { background: var(--q-good); color: #fff; }
.dp__step.is-locked { opacity: .75; }
@media (max-width: 991.98px) { .dp__steps { grid-template-columns: 1fr; } }
.q-chip-static { display: inline-flex; align-items: center; min-height: 2rem; padding: .2rem .8rem; border-radius: var(--q-r-pill); background: var(--q-primary); color: #fff; font-size: var(--q-text-sm); font-weight: 500; }
.stk__month.is-selected { background: var(--q-primary-soft); box-shadow: inset 0 -2px 0 var(--q-primary); }

/* Arrows at both ends of the strip, as on Home; the period is written above the frame. */
.dp__strip { display: flex; align-items: flex-start; gap: .5rem; margin: 0 0 .25rem; }
.dp__strip .pf__arrow { margin-top: 2.1rem; }
/* The base rule is shared with the Home slider: only the data upload strip gets the room above. */
.dp__timeline { position: relative; margin: 0 0 1.25rem; padding-bottom: 1.4rem; cursor: pointer; touch-action: none; user-select: none; }
/* no focus ring: the frame on the selected months already shows where the focus is */
.dp__timeline:focus-visible { outline: none; }
.dp__strip .dp__timeline { flex: 1 1 auto; min-width: 0; margin: 0; padding: 2.1rem 0 1.4rem; }
.dp__rangetag { position: absolute; top: 0; padding: .1rem 0; white-space: nowrap; font-weight: 600; font-size: var(--q-text-sm); font-variant-numeric: tabular-nums; color: var(--q-ink); pointer-events: none; transition: left .12s; }
.dp__ticks { display: flex; gap: 2px; height: 2.35rem; } /* as tall as the arrows */
.dp__tick { flex: 1 1 0; border-radius: 2px; background: var(--q-surface-sunk); border: 1px solid var(--q-line); }
.dp__tick.is-l1 { background: color-mix(in srgb, var(--q-good) 30%, var(--q-surface)); border-color: transparent; }
.dp__tick.is-l2 { background: color-mix(in srgb, var(--q-good) 60%, var(--q-surface)); border-color: transparent; }
.dp__tick.is-l3 { background: var(--q-good); border-color: transparent; }
.dp__years { position: absolute; left: 0; right: 0; bottom: 0; height: 1.2rem; font-size: var(--q-text-xs); color: var(--q-ink-3); }
.dp__years span { position: absolute; transform: translateX(2px); }
.dp__frame { position: absolute; top: -4px; height: calc(2.35rem + 8px); border: 2px solid var(--q-primary); border-radius: 6px; background: color-mix(in srgb, var(--q-primary) 8%, transparent); pointer-events: none; transition: left .12s, width .12s; }

.dp__strip .dp__frame { top: calc(2.1rem - 4px); }

/* ---- Busy overlay: three rock strata laid down one after the other ---------------------- */
.q-busy { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  background: color-mix(in srgb, var(--q-bg) 78%, transparent); backdrop-filter: blur(3px); }
.q-busy[hidden] { display: none; }
.q-busy__card { background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card);
  padding: 1.75rem 2.25rem; text-align: center; min-width: 17rem; max-width: 24rem;
  box-shadow: var(--q-shadow-pop); }
.q-busy__strata { display: grid; gap: 5px; width: 4.25rem; margin: 0 auto 1.1rem; }
.q-busy__strata i { display: block; height: 9px; border-radius: 2px; background: var(--q-primary);
  transform-origin: left center; animation: q-strata 1.5s cubic-bezier(.5, 0, .2, 1) infinite; }
.q-busy__strata i:nth-child(1) { background: var(--q-accent); animation-delay: 0s; }
.q-busy__strata i:nth-child(2) { width: 82%; animation-delay: .18s; opacity: .85; }
.q-busy__strata i:nth-child(3) { width: 64%; animation-delay: .36s; opacity: .7; }
@keyframes q-strata {
  0% { transform: scaleX(0); }
  40%, 70% { transform: scaleX(1); }
  100% { transform: scaleX(1); opacity: 0; }
}
.q-busy__title { font-weight: 600; color: var(--q-ink); }
.q-busy__sub { margin-top: .25rem; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.q-busy__note { max-width: 26rem; margin: .9rem auto 0; padding-top: .8rem; border-top: 1px solid var(--q-line); font-size: var(--q-text-sm); line-height: 1.4; color: var(--q-ink-2); }
@media (prefers-reduced-motion: reduce) {
  .q-busy__strata i { animation: none; }
  .q-busy { backdrop-filter: none; }
}

.dp__note { margin: .75rem 0 0; padding: .5rem .75rem; border-radius: var(--q-r-ctrl); font-size: var(--q-text-sm);
  color: var(--q-ink); background: color-mix(in srgb, var(--q-warning) 14%, var(--q-surface));
  border: 1px solid color-mix(in srgb, var(--q-warning) 45%, var(--q-surface)); }
.dp__note[hidden] { display: none; }

/* Stock suggestions: grey figures, and the "Same as last month" row under the months */
.stk__input::placeholder { color: var(--q-ink-3); opacity: .75; font-style: italic; }
.stk__msg.is-ok { color: var(--q-good-ink, var(--q-ink-2)); }
.stk__help { max-width: 46rem; margin: .6rem auto 0; padding: .65rem .9rem .65rem 1.9rem; text-align: left; font-size: var(--q-text-sm);
  color: var(--q-ink-2); background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-ctrl); }
.stk__help li + li { margin-top: .35rem; }
.stk__ghost { display: inline-block; min-width: 4.5rem; padding: 0 .4rem; text-align: center; font-style: italic; color: var(--q-ink-3);
  border: 1px dashed var(--q-line-strong); border-radius: 4px; }
.stk__fillrow th, .stk__fillrow td { padding: .55rem .25rem .2rem; vertical-align: bottom; border-bottom: 0; background: var(--q-surface); }
.stk__fillhead { border-bottom: 0 !important; }
.stk__fill { width: 100%; min-width: 4.25rem; padding: .2rem .25rem; font-size: var(--q-text-xs); line-height: 1.2; color: var(--q-ink);
  background: var(--q-surface); border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); cursor: pointer; }
.stk__fill:hover:not(:disabled) { background: var(--q-primary-soft); border-color: var(--q-primary); }
.stk__fill:disabled { color: var(--q-ink-3); border-style: dashed; cursor: default; opacity: .6; }
.stk__fill:focus-visible { outline: 2px solid var(--q-primary); outline-offset: 1px; }

.stk__fill.is-confirm { color: var(--q-warning-ink); background: var(--q-warning-soft); border-color: var(--q-warning); font-weight: 600; }

/* Cost Allocation */
.cst__intro { text-align: center; margin-bottom: .75rem; }
.cst__intro h2 { margin: 0; font-size: var(--q-text-lg, 1.15rem); font-weight: 600; }
.cst__panel { padding: 0; overflow: hidden; }
.cst__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1.25rem; border-bottom: 1px solid var(--q-line); }
.cst__period { display: inline-flex; align-items: center; gap: .4rem; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.cst__scroll { overflow-x: auto; }
.cst__table { width: 100%; margin: 0; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.cst__panel, .cst__table { --w-name: 11rem; --w-num: 4.6rem; --w-on: 4rem; --w-kind: 6.6rem; --w-sum: 4rem; }
.cst__c-name { width: var(--w-name); } .cst__c-num { width: var(--w-num); } .cst__c-on { width: var(--w-on); } .cst__c-kind { width: var(--w-kind); } .cst__c-sum { width: var(--w-sum); }
.cst__table th, .cst__table td { padding: .45rem .6rem; vertical-align: middle; border-bottom: 1px solid var(--q-line); font-size: var(--q-text-sm); }
.cst__table thead th { position: sticky; top: 0; z-index: 2; background: var(--q-surface); border-bottom: 1px solid var(--q-line-strong); font-weight: 600; text-align: center; white-space: nowrap; }
.cst__table thead th { vertical-align: middle; line-height: 1.25; }
.cst__table thead th span, .cst__table thead th small { display: block; }
.cst__table thead th span { font-size: .74rem; }
.cst__table thead th small { font-size: .7rem; font-weight: 400; color: var(--q-ink-3); white-space: nowrap; }
.cst__table thead th.cst__box span { white-space: normal; overflow-wrap: break-word; font-size: .74rem; }
.cst__table th.cst__name { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--q-surface); border-right: 1px solid var(--q-line); font-weight: 500; overflow-wrap: anywhere; }
.cst__table thead th.cst__name { z-index: 3; }
.cst__num { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cst__on, .cst__sum, .cst__box { text-align: center; }
.cst__on input { width: 1.1rem; height: 1.1rem; accent-color: var(--q-primary); cursor: pointer; }
.cst__kind { white-space: nowrap; text-align: center; }
.cst__table td.cst__kind, .cst__table th.cst__kind { padding-left: .3rem; padding-right: .3rem; }
/* Neutral track with a thumb only: no filled part, so 0 % (Fixed) looks as complete as 100 % (Variable). */
.cst__kind input { -webkit-appearance: none; appearance: none; display: block; width: 4.8rem; height: 1rem; margin: 0 auto; padding: 0; background: transparent; cursor: pointer; vertical-align: middle; }
.cst__kind input::-webkit-slider-runnable-track { height: .8rem; background: linear-gradient(var(--q-line-strong), var(--q-line-strong)) center / 100% 4px no-repeat; }
.cst__kind input::-moz-range-track { height: .8rem; background: linear-gradient(var(--q-line-strong), var(--q-line-strong)) center / 100% 4px no-repeat; }
.cst__kind input::-webkit-slider-thumb { -webkit-appearance: none; width: .8rem; height: .8rem; margin-top: 0; border-radius: 50%; border: 0; background: var(--q-primary); }
.cst__kind input::-moz-range-thumb { width: .8rem; height: .8rem; border-radius: 50%; border: 0; background: var(--q-primary); }
.cst__kind input:focus-visible { outline: 2px solid var(--q-primary); outline-offset: 2px; border-radius: 4px; }
.cst__vartext { display: block; margin-top: .1rem; text-align: center; line-height: 1.2; color: var(--q-ink-2); font-size: var(--q-text-xs); white-space: nowrap; }
.cst__share { --v: 0; display: block; width: 100%; height: 100%; min-height: 2.6rem; padding: 0 .15rem; text-align: center; border: 0; border-radius: 0; font-variant-numeric: tabular-nums; font-size: var(--q-text-sm); color: var(--q-ink); background: color-mix(in srgb, var(--q-seq-500) calc(var(--v) * 0.55%), transparent); outline: none; }
.cst__table td.cst__box { padding: 0; height: 1px; border-right: 1px solid var(--q-line); }
.cst__share:focus { box-shadow: inset 0 0 0 2px var(--q-primary); background-color: var(--q-surface); }
.cst__share.is-error { box-shadow: inset 0 0 0 2px var(--q-critical); background: var(--q-critical-soft); }
.cst__share:disabled, .cst__var:disabled { opacity: .35; }
.cst__row.is-excluded .cst__sum > *, .cst__row.is-excluded .cst__vartext { visibility: hidden; }
.cst__row.is-excluded td.cst__sum { color: transparent; }
.cst__table td.cst__sum, .cst__table th.cst__sum { padding-left: .25rem; padding-right: .25rem; white-space: nowrap; font-size: var(--q-text-xs); }
.cst__total { font-variant-numeric: tabular-nums; }
.cst__amt.is-neg { color: var(--q-critical-ink); }
.cst__amt.is-pos { color: var(--q-good-ink); }
.cst__amt.is-zero { color: var(--q-ink-3); }
.cst__new { display: none; margin-left: .4rem; padding: 0 .4rem; border-radius: 999px; background: var(--q-warning-soft); color: var(--q-warning-ink); font-size: var(--q-text-xs); font-style: normal; font-weight: 600; }
.cst__row.is-new .cst__new { display: inline-block; }
.cst__row.is-new th.cst__name { box-shadow: inset 3px 0 0 var(--q-warning); }
.cst__row.is-incomplete .cst__sum, .cst__row.is-new .cst__sum { background: var(--q-warning-soft); color: var(--q-warning-ink); }
.cst__row.is-ok .cst__sum { color: var(--q-good-ink); }
.cst__row.is-excluded th.cst__name span { opacity: .55; }
.cst__row.is-excluded .cst__num .cst__amt { color: var(--q-ink-3); }
.cst__row.is-saving { opacity: .7; }
/* The Total column stays in view when the table scrolls sideways: it shows what is done. */
.cst__table th.cst__sum, .cst__table td.cst__sum { position: sticky; right: 0; z-index: 1; background: var(--q-surface); border-left: 1px solid var(--q-line); }
.cst__table thead th.cst__sum { z-index: 3; }
.cst__row.is-incomplete td.cst__sum, .cst__row.is-new td.cst__sum { background: var(--q-warning-soft); }
.cst__table th.cst__num { padding-left: .2rem; padding-right: .2rem; }
.cst__table th.cst__box { padding-left: .15rem; padding-right: .15rem; }
.cst__bar .q-switch { gap: .4rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-2); }
.cst__bar .q-switch input { width: 1rem; height: 1rem; }
.cst__head { margin: 0; padding: 1rem 1.25rem .75rem; }

/* Production flow: a white frame, like the other steps */
.c2b__table th, .c2b__table tfoot td, .c2b__table thead th { background: var(--q-surface); }
.c2b__table tbody tr:hover td.c2b__cell { background: var(--q-surface); }
.c2b__msg { min-height: 1.25rem; margin-bottom: .5rem; }
.c2b__toolbar { justify-content: space-between; }
.c2b__hint { margin: 0; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.c2b__toolbar .q-switch { margin-left: auto; }
.cst__table thead th { padding-top: .8rem; padding-bottom: .8rem; }
/* Header band of the allocation tables: the same light grey and line as the results tables */
.c2b__table thead th, .c2b__table thead th.c2b__corner,
.cst__table thead th, .cst__table thead th.cst__name, .cst__table thead th.cst__num, .cst__table thead th.cst__on, .cst__table thead th.cst__kind, .cst__table thead th.cst__sum { background: #e9edec; color: var(--q-ink); font-weight: 600; border-bottom: 2px solid var(--q-line-strong); }
.cst__table thead th, .c2b__table thead th { font-size: .8125rem; }
.cst__row.is-ok td.cst__sum { background: var(--q-good-soft); }
.cst__row.is-over td.cst__sum { background: var(--q-critical-soft); color: var(--q-critical-ink); }

/* Only the cost boxes scroll sideways: the first columns stay on the left, Total on the right. */
.cst__table th.cst__num, .cst__table td.cst__num { position: sticky; left: var(--w-name); z-index: 1; background: var(--q-surface); }
.cst__table th.cst__on, .cst__table td.cst__on { position: sticky; left: calc(var(--w-name) + var(--w-num)); z-index: 1; background: var(--q-surface); }
.cst__table th.cst__kind, .cst__table td.cst__kind { position: sticky; left: calc(var(--w-name) + var(--w-num) + var(--w-on)); z-index: 1; background: var(--q-surface); border-right: 1px solid var(--q-line); }
.cst__table thead th.cst__num, .cst__table thead th.cst__on, .cst__table thead th.cst__kind { z-index: 3; }
.cst__table th.cst__name { border-right: 0; }
.cst__table td.cst__kind { padding-left: .15rem; padding-right: .15rem; }
.cst__scroll { overflow: auto; }
.cst__row.is-failed th.cst__name { box-shadow: inset 3px 0 0 var(--q-critical); }
.cst__scroll { scrollbar-width: thin; }

/* Cost Allocation: more lines on screen */
.cst__tools { display: inline-flex; align-items: center; gap: 1.25rem; }
.cst__helpbtn { padding: 0; border: 0; background: none; color: var(--q-ink-2); font-size: var(--q-text-sm); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.cst__helpbtn:hover { color: var(--q-ink); }
.cst__table td { padding-top: .3rem; padding-bottom: .3rem; }
.cst__kind input { margin-bottom: 0; }

/* ---- Electricity calculator (panel over Cost Allocation) ---- */
.elec__intro { margin: 0 0 1rem; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.elec__pick { display: block; margin-bottom: 1rem; font-size: var(--q-text-sm); font-weight: 500; }
.elec__pick select { margin-top: .3rem; max-width: 26rem; font-size: var(--q-text-sm); }
.elec__table { width: 100%; border-collapse: collapse; font-size: var(--q-text-sm); }
.elec__table th, .elec__table td { padding: .35rem .5rem; border-bottom: 1px solid var(--q-line); text-align: center; }
.elec__table thead th { font-weight: 500; font-size: var(--q-text-xs); color: var(--q-ink-2); border-bottom-color: var(--q-line-strong); vertical-align: middle; }
.elec__table th.elec__box { text-align: left; font-weight: 500; }
.elec__table tfoot th, .elec__table tfoot td { border-bottom: 0; border-top: 1px solid var(--q-line-strong); font-weight: 600; }
.elec__in { width: 6.5rem; padding: .3rem .4rem; text-align: center; font-variant-numeric: tabular-nums; font-size: var(--q-text-sm); border: 1px solid var(--q-line-strong); border-radius: var(--q-r-control, 6px); background: var(--q-surface); color: var(--q-ink); }
.elec__in:focus { outline: 2px solid var(--q-primary); outline-offset: 0; }
.elec__in:disabled { background: transparent; border-color: var(--q-line); }
.elec__out { font-variant-numeric: tabular-nums; white-space: nowrap; }
.elec__note { margin: .9rem 0 0; min-height: 1.3em; font-size: var(--q-text-sm); color: var(--q-good-ink); }
.elec__note.is-warn { color: var(--q-ink-2); }
.cst__action { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-control, 6px); background: var(--q-surface); color: var(--q-ink); font-size: var(--q-text-sm); cursor: pointer; }
.cst__action:hover { border-color: var(--q-primary); color: var(--q-primary); }
.cst__action .q-icon { fill: none; stroke: currentColor; }
.elec__type { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; font-size: var(--q-text-sm); font-weight: 500; }
.elec__kind { display: inline-block; min-width: 10rem; text-align: center; }
.elec__kind input { width: 10rem; }
#elec-var:disabled { opacity: .35; }
.elec__type { align-items: flex-start; }
.elec__typelabel { padding-top: .15rem; }
.elec__kind { padding: .15rem .35rem .1rem; }
.elec__kind .cst__vartext { margin-top: .45rem; }

/* ---- Attention: step cards, banner, markers ---- */
.q-steps__alert { margin-left: auto; flex: none; display: inline-flex; color: var(--q-warning-ink); }
.q-steps__alert[hidden] { display: none; }
.q-steps__alert .q-icon { width: 1.15rem; height: 1.15rem; fill: var(--q-warning-soft); }
.q-steps__item.is-attention a { border-color: var(--q-warning); }
.q-steps__item.is-attention .q-steps__text small { color: var(--q-warning-ink); }
.attn { display: flex; align-items: flex-start; gap: .75rem; margin: 0 0 1rem; padding: .7rem 1rem; border: 1px solid var(--q-warning); border-radius: var(--q-r-card); background: var(--q-warning-soft); color: var(--q-warning-ink); font-size: var(--q-text-sm); }
.attn[hidden] { display: none; }
.attn__icon { flex: none; display: inline-flex; margin-top: .1rem; }
.attn__icon .q-icon { width: 1.2rem; height: 1.2rem; }
.attn__body { flex: 1 1 auto; min-width: 0; }
.attn__line { margin: 0; }
.attn__line strong { font-weight: 600; margin-right: .35rem; }
.attn__chips { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin-top: .35rem; }
.attn__chips:empty { display: none; }
.attn__chip { display: inline-flex; align-items: center; gap: .5rem; padding: .15rem .25rem .15rem .6rem; border-radius: 999px; background: var(--q-surface); border: 1px solid var(--q-warning); color: var(--q-ink); }
.attn__chip button { border: 0; background: none; padding: .1rem .5rem; color: var(--q-warning-ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: var(--q-text-sm); }
.attn__chip button:disabled { opacity: .5; cursor: default; }
.attn__go { flex: none; align-self: center; padding: .25rem .8rem; border: 1px solid var(--q-warning-ink); border-radius: var(--q-r-control, 6px); background: var(--q-surface); color: var(--q-warning-ink); font-size: var(--q-text-sm); cursor: pointer; }
.attn__go:hover { background: var(--q-warning-soft); }
.cst__table thead th.cst__box.is-review, .alloc__lane.is-review .alloc__lanehead { background: var(--q-warning-soft); }
.cst__flag, .alloc__flag { display: inline-flex; vertical-align: -.15em; margin-right: .25rem; color: var(--q-warning-ink); }
.cst__flag[hidden] { display: none; }
.alloc__flag { margin: 0 0 0 .4rem; }
@keyframes attn-flash { 0%, 60% { box-shadow: 0 0 0 3px var(--q-warning); } 100% { box-shadow: 0 0 0 3px transparent; } }
.attn-flash { animation: attn-flash 1.6s ease-out 1; }
@media (prefers-reduced-motion: reduce) { .attn-flash { animation: none; box-shadow: 0 0 0 3px var(--q-warning); } }

/* ---- Detailed results ------------------------------------------------------------------ */
.res__bar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; margin: 0 0 1rem; }
.res__bar .q-field { flex: 1 1 14rem; max-width: 22rem; }
.res__apply { min-height: 2.5rem; }
/* Underline tabs: no fill, the current one is the dark label with the amber underline, which sits on
   the divider (drawn as an inset line, so the underline covers it). The first label is flush with
   the left edge of the filters and cards above and below. */
.res__tabs { display: flex; gap: 2rem; box-shadow: inset 0 -1px 0 var(--q-line-strong); margin: 1.1rem 0 1rem; overflow-x: auto; }
.res__tabs > * { padding: .6rem 0 .55rem; font-weight: 600; font-size: var(--q-text-base); color: var(--q-ink-2); border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; }
.res__tabs > a:hover, .res__tabs > button:hover { color: var(--q-ink); border-bottom-color: var(--q-line-strong); }
.res__tabs a[aria-current] { color: var(--q-ink); border-bottom-color: var(--q-accent); }
.res__tabs .is-soon { color: var(--q-ink-3); cursor: default; }
.res__kpis { margin-bottom: 1.75rem; display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1200px) { .res__kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.res__period { margin: .6rem 0 1.25rem; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.res__block { margin: 0 0 1.5rem; }
.res__block h2 { font-size: var(--q-text-md); margin: 0 0 .6rem; }
.res__name { text-align: left !important; font-weight: 500; }
.res__delta { display: inline-flex; align-items: center; gap: .25rem; font-size: var(--q-text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--q-ink-2); }
.res__delta .q-icon { width: .85rem; height: .85rem; }
.res__delta.is-good { color: var(--q-good-ink); }
.res__delta.is-bad { color: var(--q-critical-ink); }
.res__hint { margin: 0 0 .6rem; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.res__find { max-width: 22rem; margin: 0 0 .75rem; }
.res__loss { color: var(--q-critical-ink); display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.res__loss .q-icon, .res__gain .q-icon { width: .85rem; height: .85rem; }
.res__gain { color: var(--q-good-ink); display: inline-flex; align-items: center; gap: .25rem; }

/* Cost by block headings carry their period */
.res__block h2 small { margin-left: .5rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }
/* Section title with a product search on its right */
.res__headrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; margin: 0 0 .6rem; }
.res__headrow h2 { margin: 0; }
.res__tsearch { width: min(100%, 16rem); }

/* ---- Deviation from the average: bars grow left (cheaper) or right (more expensive) of the average line */
.dev__grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .dev__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dev { margin: 0; padding: 1.1rem 1.25rem 1rem; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); --dev-cheap: var(--q-s1); --dev-dear: var(--q-s2); }
.dev figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .75rem; font-weight: 600; margin: 0 0 .9rem; }
.dev figcaption span { font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-3); font-variant-numeric: tabular-nums; }
.dev__rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: max-content minmax(4rem, 1fr) max-content; column-gap: .75rem; }
.dev__row, .dev__axis { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; }
.dev__axis { grid-template-columns: subgrid; margin-bottom: .25rem; font-size: var(--q-text-xs); color: var(--q-ink-3); }
.dev__axis span { position: relative; white-space: nowrap; }
.dev__axis span:first-child { grid-column: 2; grid-row: 1; justify-self: start; padding-left: 1.1rem; }
.dev__axis span:last-child { grid-column: 2; grid-row: 1; justify-self: end; padding-right: 1.1rem; }
.dev__axis span:first-child::before, .dev__axis span:last-child::after { content: ""; position: absolute; top: 50%; width: .6rem; height: .6rem; margin-top: -.3rem; border-radius: 50%; }
.dev__axis span:first-child::before { left: 0; background: var(--dev-cheap); }
.dev__axis span:last-child::after { right: 0; background: var(--dev-dear); }
.dev__row { padding: .3rem .4rem; margin: 0 -.4rem; border-radius: var(--q-r-ctrl); transition: background .15s; }
.dev__row:hover { background: var(--q-surface-sunk); }
.dev__avgrow { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; margin-bottom: .45rem; }
.dev__avgrow span { grid-column: 2; justify-self: center; font-size: var(--q-text-xs); font-weight: 600; color: var(--q-ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dev--status .dev__value small { font-size: .6875rem; }
.dev__unit { font-size: var(--q-text-xs); font-weight: 500; color: var(--q-ink-3); }
.dev__name { font-size: var(--q-text-sm); font-weight: 500; white-space: nowrap; }
.dev__track { position: relative; height: 1.35rem; border-radius: var(--q-r-pill); background: linear-gradient(90deg, color-mix(in srgb, var(--dev-cheap) 7%, transparent), transparent 50%, color-mix(in srgb, var(--dev-dear) 7%, transparent)); }
.dev__track::after { content: ""; position: absolute; left: 50%; top: -.35rem; bottom: -.35rem; border-left: 2px dashed var(--q-ink-2); opacity: .55; }
.dev__bar { position: absolute; top: .2rem; bottom: .2rem; left: 50%; width: calc(var(--w) / 2); min-width: 3px; border-radius: 0 var(--q-r-pill) var(--q-r-pill) 0; background: linear-gradient(90deg, color-mix(in srgb, var(--dev-dear) 55%, #fff), var(--dev-dear)); transform-origin: left center; animation: dev-grow .7s cubic-bezier(.2, .7, .2, 1) both; }
.is-down .dev__bar { left: auto; right: 50%; border-radius: var(--q-r-pill) 0 0 var(--q-r-pill); background: linear-gradient(270deg, color-mix(in srgb, var(--dev-cheap) 55%, #fff), var(--dev-cheap)); transform-origin: right center; }
.is-flat .dev__bar { width: 3px; background: var(--q-ink-3); border-radius: 2px; left: calc(50% - 1.5px); }
.dev__value { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dev__value small { font-size: var(--q-text-xs); color: var(--q-ink-2); }
.is-up .dev__value small { color: var(--q-serious-ink); }
.is-down .dev__value small { color: #1b4a80; }
@keyframes dev-grow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .dev__bar { animation: none; } }

.q-table th.res__gap, .q-table td.res__gap { padding-left: 1.4rem; } /* a wider gap between groups of columns, no vertical line */
@media (max-width: 575px) {
  .dev__axis { display: flex; justify-content: space-between; }
  .dev__axis span:first-child, .dev__axis span:last-child { grid-column: auto; grid-row: auto; }
}

/* Row headers in the results tables read as data, not as a second header: white like the cells */
.res__block .q-table tbody th { position: static; background: var(--q-surface); color: var(--q-ink); font-size: inherit; border-bottom: 1px solid var(--q-line); }
.res__block .q-table tbody tr:last-child th { border-bottom: 0; }
.res__block .q-table tbody tr:hover th { background: var(--q-surface-sunk); }
.res__block .q-table thead th,
.rv__table thead th { background: color-mix(in srgb, var(--q-surface-sunk) 50%, var(--q-surface)); color: var(--q-ink); font-weight: 600; border-bottom: 1px solid var(--q-line-strong); }

/* Sortable headers in the results tables: the arrow shows on hover, and stays on the sorted column */
.res__block .q-table th[data-sort],
.rv__table th[data-sort] { cursor: pointer; }
.res__block .q-table th[data-sort]::after,
.rv__table th[data-sort]::after { content: "\2195"; width: auto; margin-left: .3rem; opacity: 0; font-size: .85em; transition: opacity .12s; }
.res__block .q-table th[data-sort]:hover::after,
.rv__table th[data-sort]:hover::after, .res__block .q-table th[data-sort]:focus-visible::after, .rv__table th[data-sort]:focus-visible::after { opacity: .7; }
.res__block .q-table th[aria-sort="ascending"]::after,
.rv__table th[aria-sort="ascending"]::after { content: "\2191"; opacity: 1; }
.res__block .q-table th[aria-sort="descending"]::after,
.rv__table th[aria-sort="descending"]::after { content: "\2193"; opacity: 1; }
.res__block .q-table th[data-sort]:focus-visible,
.rv__table th[data-sort]:focus-visible { outline: 2px solid var(--q-primary); outline-offset: -2px; }

/* Margins table: fits the page, names wrap on two lines, numeric headers wrap on two lines */
.res__margins { table-layout: auto; }
.res__margins th, .res__margins td { padding-left: .5rem; padding-right: .5rem; }
.res__margins tbody th { white-space: normal; width: 11rem; line-height: 1.3; }
.res__margins td.res__name { white-space: normal; width: 9rem; line-height: 1.3; }
.res__margins thead th { white-space: normal; line-height: 1.25; vertical-align: middle; }
.res__margins thead th.num { white-space: normal; }
.res__margins thead th.res__m { min-width: 5.4rem; }
.res__margins .res__unit { margin-left: .25em; font-weight: 400; white-space: nowrap; }
.res__margins .res__gap { padding-left: .8rem; }
.res__top { display: flex; flex-direction: column; gap: .1rem; font-size: var(--q-text-sm); color: var(--q-ink-2); line-height: 1.3; }
.res__top b { font-weight: 600; color: var(--q-ink); font-variant-numeric: tabular-nums; margin-left: .2rem; }

/* Margin waterfall: bars float from where the previous one ended; the last bar is the total */
.wf .dev__track { background: color-mix(in srgb, var(--q-ink) 4%, transparent); }
.wf .dev__track::after { left: var(--zero); }
.wf__bar { position: absolute; top: .2rem; bottom: .2rem; left: var(--l); width: var(--w); min-width: 3px; border-radius: var(--q-r-pill); background: var(--dev-cheap); transform-origin: left center; animation: dev-grow .7s cubic-bezier(.2, .7, .2, 1) both; }
.wf .is-down .wf__bar { background: var(--dev-dear); }
.wf .wf__total { margin-top: .35rem; border-top: 1px solid var(--q-line-strong); border-radius: 0; padding-top: .55rem; }
.wf .wf__total .dev__name { font-weight: 700; }
.wf .wf__total .wf__bar { background: var(--q-primary); }
.wf .wf__total.is-total-down .wf__bar { background: var(--q-critical); }
.wf .dev__value { flex-direction: row; }
@media (prefers-reduced-motion: reduce) { .wf__bar { animation: none; } }
.wf .dev__value { align-items: baseline; gap: .5rem; min-width: 8.5rem; justify-content: flex-end; }
.wf .dev__value small { min-width: 3.2rem; text-align: right; color: var(--q-ink-3); font-variant-numeric: tabular-nums; }
.wf .dev__value .res__loss { white-space: nowrap; }

/* Picking a product highlights it in the table and in both waterfalls, the rest steps back */
.res__pick { cursor: pointer; }
.res__pick:focus-visible { outline: 2px solid var(--q-primary); outline-offset: -2px; }
.res__block .q-table tbody tr.is-picked th, .res__block .q-table tbody tr.is-picked td { background: var(--q-seq-100); }
.res__block .q-table tbody tr.is-picked th { box-shadow: inset 3px 0 0 var(--q-accent); }
.wf .wf__row[data-product] { cursor: pointer; }
.wf.has-pick .wf__row[data-product]:not(.is-picked) { opacity: .35; }
.wf .wf__row.is-picked { background: var(--q-seq-100); opacity: 1; box-shadow: inset 3px 0 0 var(--q-accent); }
.wf .wf__row, .wf__bar { transition: opacity .15s; }

/* Picking a product highlights it in the table and in both waterfalls, the rest steps back */
.res__pick { cursor: pointer; }
.res__pick:focus-visible { outline: 2px solid var(--q-primary); outline-offset: -2px; }
.res__block .q-table tbody tr.is-picked th, .res__block .q-table tbody tr.is-picked td { background: var(--q-seq-100); }
.res__block .q-table tbody tr.is-picked th { box-shadow: inset 3px 0 0 var(--q-accent); }
.wf .wf__row[data-product] { cursor: pointer; }
.wf.has-pick .wf__row[data-product]:not(.is-picked) { opacity: .35; }
.wf .wf__row.is-picked { background: var(--q-seq-100); opacity: 1; box-shadow: inset 3px 0 0 var(--q-accent); }
.wf .wf__row { transition: opacity .15s; }

/* View switch above the Products tables */
.res__views { display: inline-flex; gap: 0; margin: 1.25rem 0 .9rem; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); overflow: hidden; background: var(--q-surface); }
.res__views button { border: 0; background: transparent; padding: .5rem 1rem; font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2); }
.res__views button + button { border-left: 1px solid var(--q-line-strong); }
.res__views button.is-on { background: var(--q-primary); color: #fff; }
.res__views button:focus-visible { outline: 2px solid var(--q-primary); outline-offset: -2px; }
.res__panel[hidden] { display: none; }
.res__margins td .res__delta { display: flex; justify-content: center; margin-top: .1rem; font-size: var(--q-text-xs); }
.res__flagtext { display: block; font-size: var(--q-text-xs); color: var(--q-critical-ink); font-weight: 500; }

/* Phone: one card per product */
.res__cards { display: grid; gap: .75rem; margin: 1.25rem 0; }
.res__card { background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); padding: .9rem 1rem; }
.res__card header { display: flex; flex-direction: column; margin-bottom: .6rem; }
.res__card h3 { font-size: var(--q-text-md); margin: 0; }
.res__card header small { color: var(--q-ink-3); }
.res__card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; margin: 0 0 .75rem; }
.res__card dl > div { min-width: 0; }
.res__card dt { font-size: var(--q-text-xs); color: var(--q-ink-3); font-weight: 400; }
.res__card dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.res__card dd.res__big { grid-column: 1 / -1; font-size: var(--q-text-xl); }
.res__card dl > div:first-child { grid-column: 1 / -1; }
.res__card dd small { font-weight: 400; color: var(--q-ink-3); }
.res__card.is-picked { box-shadow: inset 3px 0 0 var(--q-accent); }
.res__card .q-icon { width: .85rem; height: .85rem; }

/* Bridge: the opening bar reads like the total bar */
.wf .wf__start .wf__bar { background: var(--q-ink-3); }
.wf .wf__start.is-total-down .wf__bar { background: var(--q-critical); }
.wf .wf__row.is-up .wf__bar { background: var(--dev-cheap); }

/* Price versus cost */
.sc { margin: 0; padding: 1rem 1.25rem; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); --sc-ok: var(--q-s1); --sc-tight: var(--q-s2); --sc-loss: var(--q-critical); }
.sc svg { display: block; width: 100%; max-width: 820px; height: auto; margin: 0 auto; }
.sc__zone { fill: color-mix(in srgb, var(--q-serious) 10%, transparent); }
.sc__grid { stroke: var(--q-line); stroke-width: 1; }
.sc__diag { stroke: var(--q-ink-2); stroke-width: 2; stroke-dasharray: 6 5; }
.sc__tick { font-size: 11px; fill: var(--q-ink-3); font-variant-numeric: tabular-nums; }
.sc__axis { font-size: 12px; fill: var(--q-ink-2); font-weight: 500; }
.sc__pt { cursor: pointer; transition: opacity .15s; outline: none; }
.sc__pt circle, .sc__pt rect { stroke: var(--q-surface); stroke-width: 2; }
.sc__pt.is-ok circle { fill: var(--sc-ok); fill-opacity: .85; }
.sc__pt.is-tight circle { fill: var(--q-surface); stroke: var(--sc-tight); stroke-width: 3.5; }
.sc__pt.is-loss rect { fill: var(--sc-loss); }
.sc__pt:focus-visible circle, .sc__pt:focus-visible rect { stroke: var(--q-ink); }
.sc__label { display: none; font-size: 12px; font-weight: 600; fill: var(--q-ink); paint-order: stroke; stroke: var(--q-surface); stroke-width: 4px; }
.sc__pt:hover .sc__label, .sc__pt.is-picked .sc__label { display: block; }
.sc.has-pick .sc__pt:not(.is-picked) { opacity: .25; }
.sc.has-pick .sc__pt.is-picked circle, .sc.has-pick .sc__pt.is-picked rect { stroke: var(--q-accent); stroke-width: 3; }
.sc__legend { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: center; margin-top: .6rem; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.sc__legend i { display: inline-block; width: .8rem; height: .8rem; margin-right: .4rem; vertical-align: -.1rem; }
.sc__legend .is-ok i { background: var(--sc-ok); border-radius: 50%; }
.sc__legend .is-tight i { border: 3px solid var(--sc-tight); border-radius: 50%; }
.sc__legend .is-loss i { background: var(--sc-loss); transform: rotate(45deg) scale(.85); }

/* Results tables: headers stay in view while scrolling the page (the wrapper must not scroll). */
.res__block .q-table-wrap { overflow: visible; }
.res__block .q-table thead th { position: sticky; top: var(--res-sticky, 0px); z-index: 3; }
/* Two-row headers: the second row sticks right under the first (its height is measured in results.js). */
.res__block .q-table thead tr + tr th { top: calc(var(--res-sticky, 0px) + var(--res-head1, 0px)); }
.res__block .q-table tbody tr:last-child > :first-child { border-bottom-left-radius: var(--q-r-card); }
.res__block .q-table tbody tr:last-child > :last-child { border-bottom-right-radius: var(--q-r-card); }

/* Zoom of the price-versus-cost chart */
.sc { position: relative; }
.sc { user-select: none; -webkit-user-select: none; }
.sc__tools { position: absolute; top: .6rem; right: .9rem; z-index: 2; display: flex; flex-direction: column; gap: .45rem; width: 9rem; }
.sc__pm { display: flex; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); overflow: hidden; background: var(--q-surface); }
.sc__pm button { flex: 1; border: 0; background: transparent; padding: .25rem 0; font-size: var(--q-text-base); font-weight: 600; color: var(--q-ink-2); }
.sc__pm button + button { border-left: 1px solid var(--q-line-strong); }
.sc__pm button:hover { background: var(--q-surface-sunk); }
.sc__reset { display: none; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); background: var(--q-surface); padding: .25rem 0; font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2); }
.sc__reset:hover { background: var(--q-surface-sunk); }
.sc.is-zoomed .sc__reset { display: block; }
.sc.is-zoomed svg { cursor: grab; }
.sc.is-panning svg { cursor: grabbing; }
.sc__help--in, .sc.is-zoomed .sc__help--out { display: none; }
.sc.is-zoomed .sc__help--in { display: inline; }
.sc svg { touch-action: none; cursor: crosshair; user-select: none; }
.sc__frame { fill: none; stroke: var(--q-line-strong); }
.sc__sel { fill: color-mix(in srgb, var(--q-primary) 12%, transparent); stroke: var(--q-primary); stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; }
.sc__help { color: var(--q-ink-3); }
.sc__pt { cursor: pointer; }

/* Customers of one product, and who buys it at the best and worst prices */
.res__filter { margin: 0 0 .8rem; padding: .5rem .8rem; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-ctrl); display: inline-flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; font-size: var(--q-text-sm); }
.res__filter a { text-decoration: underline; }
.res__buyers { margin-top: 1rem; padding: 1rem 1.1rem; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); }
.res__buyers[hidden], .sh[hidden], [data-detail-empty][hidden] { display: none; }
.res__buyers h3, .sh h3 { margin: 0 0 .7rem; font-size: var(--q-text-md); }
.res__buyers h3 small, .sh h3 small { margin-left: .5rem; font-weight: 400; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.res__buyers h4 { margin: 0 0 .35rem; font-size: var(--q-text-sm); font-weight: 600; color: var(--q-ink-2); }
.res__buyers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.25rem; margin-bottom: .9rem; }
.res__mini { width: 100%; font-size: var(--q-text-sm); }
.res__mini td, .res__mini th { padding: .35rem .5rem; text-align: left; border-bottom: 1px solid var(--q-line); }
.res__mini td.num { text-align: right; white-space: nowrap; }
.res__mini tr:last-child > * { border-bottom: 0; }

/* Stock evolution */
.res__kpis--3 { grid-template-columns: repeat(3, 1fr); }
.sh { margin-top: .5rem; padding: 1rem 1.1rem; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); }
@media (max-width: 767.98px) { .res__kpis--3 { grid-template-columns: 1fr; } }

/* Customers of a product: equal row heights, reference prices, difference with the average */
.res__block .res__mini { table-layout: fixed; }
.res__block .res__mini thead th { position: static; background: transparent; border-bottom: 1px solid var(--q-line-strong); font-size: var(--q-text-xs); font-weight: 500; color: var(--q-ink-3); padding: .3rem .5rem; text-align: left; white-space: nowrap; }
.res__block .res__mini thead th.num { text-align: right; }
.res__mini th:nth-child(2), .res__mini td:nth-child(2) { width: 5.5rem; }
.res__mini th:nth-child(3), .res__mini td:nth-child(3) { width: 14rem; }
.res__mini th:nth-child(4), .res__mini td:nth-child(4) { width: 4.5rem; }
.res__mini tbody th, .res__mini td { height: 2.3rem; vertical-align: middle; }
.res__mini tbody th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res__mini .res__flagtext { display: inline; margin-right: .5rem; font-size: var(--q-text-xs); }
.res__vs { color: var(--q-ink-3); }
.res__ref { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; margin: 0 0 1.1rem; }
.res__tile { --tile: var(--q-ink-3); position: relative; display: flex; flex-direction: column; gap: .15rem; padding: .8rem 1rem .75rem; background: var(--q-surface); border: 1px solid var(--q-line); border-top: 4px solid var(--tile); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); }
.res__tile small { font-size: var(--q-text-sm); color: var(--q-ink-3); }
.res__tile strong { font-size: 1.85rem; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--q-ink); }
.res__tile em { margin-left: .3rem; font-style: normal; font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-3); }
.res__tile span { font-size: var(--q-text-xs); color: var(--q-ink-3); }
.res__tile .res__delta span { font-size: inherit; color: inherit; } /* the words of a change take its green or red, not the grey of the tile */
.res__tile.is-sold { --tile: var(--q-s1); }
.res__tile.is-rank { --tile: var(--q-accent); }
.res__tile.is-floor { --tile: var(--q-line-strong); }
.res__tile.is-cost { --tile: var(--q-ink-2); }
.res__tile.is-ok { --tile: var(--q-good); }
.res__tile.is-tight { --tile: var(--q-warning); }
.res__tile.is-loss { --tile: var(--q-critical); }
.res__tile.is-ok span { color: var(--q-good-ink); font-weight: 600; }
.res__tile.is-tight span { color: var(--q-warning-ink); font-weight: 600; }
.res__tile.is-loss span { color: var(--q-critical-ink); font-weight: 600; }

/* Month calendar of the results page (period and comparison) */
.res__bar .q-field .wp { position: relative; }
.wp__btn { border-left: 4px solid var(--q-primary); }
.wp--compare .wp__btn { border-left-color: var(--q-accent); }
.wp__text.is-none { color: var(--q-ink-3); }
.wp__pop { position: absolute; top: calc(100% + .35rem); left: 0; z-index: 1060; width: min(34rem, calc(100vw - 2rem)); max-width: none; }
.wp__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.wp__m { position: relative; height: 2.6rem; border: 0; border-radius: var(--q-r-ctrl); background: transparent; font: inherit; text-transform: capitalize; color: var(--q-ink); }
.wp__m:hover:not(:disabled) { background: var(--q-primary-soft); }
.wp__m:disabled { color: var(--q-ink-3); opacity: .5; cursor: default; }
.wp__m.is-in { background: var(--q-primary-soft); opacity: 1; }
.wp__m.is-edge { background: var(--q-primary); color: #fff; opacity: 1; }
.wp__m.is-hover:not(.is-edge) { box-shadow: inset 0 0 0 2px var(--q-primary); opacity: 1; }
.wp--compare .wp__m.is-in { background: var(--q-warning-soft); }
.wp--compare .wp__m.is-edge { background: var(--q-accent); color: var(--q-ink); }
.wp--compare .wp__m:hover:not(:disabled) { background: var(--q-warning-soft); }
.wp--compare .wp__m.is-hover:not(.is-edge) { box-shadow: inset 0 0 0 2px var(--q-accent); }
.wp__m.is-ref::after { content: ""; position: absolute; left: .45rem; right: .45rem; bottom: .25rem; height: 3px; border-radius: 2px; background: var(--q-primary); }
.wp__m:focus-visible { outline: 2px solid var(--q-primary); outline-offset: -2px; }
.wp__tools { display: flex; gap: .5rem; flex-wrap: wrap; }
.wp__pop .q-cal__foot { flex-wrap: wrap; }

/* Products with a negative margin */
.res__neg { display: inline-flex; align-items: center; gap: .3rem; margin: .2rem 0 0; padding: .1rem .5rem; width: fit-content; border-radius: var(--q-r-pill); background: var(--q-critical-soft); color: var(--q-critical-ink); border: 1px solid var(--q-critical); font-size: var(--q-text-xs); font-weight: 600; white-space: nowrap; }
.res__neg.is-gross { background: var(--q-critical); color: #fff; }
.res__name .res__neg { display: flex; }
.res__block .q-table tbody tr.is-neg > * { background: color-mix(in srgb, var(--q-critical) 7%, var(--q-surface)); }
.res__block .q-table tbody tr.is-neg > th { box-shadow: inset 3px 0 0 var(--q-critical); }
.res__block .q-table tbody tr.is-neg.is-picked > * { background: var(--q-seq-100); }
.res__card header .res__neg { margin-top: .4rem; }

/* Little "i" with a tooltip */
.res__tip { position: relative; display: inline-grid; place-items: center; width: 1rem; height: 1rem; margin-left: .3rem; border-radius: 50%; border: 1px solid var(--q-ink-3); color: var(--q-ink-3); font-size: .65rem; font-weight: 700; font-style: normal; line-height: 1; cursor: help; vertical-align: middle; text-transform: none; }
.res__tip:hover, .res__tip:focus-visible { background: var(--q-ink-2); color: #fff; border-color: var(--q-ink-2); outline: none; }
.res__tipbox { position: fixed; z-index: 1000; max-width: 15rem; padding: .5rem .65rem; border-radius: var(--q-r-ctrl); background: var(--q-ink); color: #fff; font-size: var(--q-text-xs); font-weight: 400; line-height: 1.35; text-align: left; text-transform: none; letter-spacing: 0; box-shadow: var(--q-shadow-pop); pointer-events: none; opacity: 0; transition: opacity .12s; }
.res__tipbox.is-on { opacity: 1; }
.res__tipsub { display: flex; align-items: center; gap: .5rem; margin-top: .3rem; opacity: .9; font-variant-numeric: tabular-nums; }
.res__tipbox .q-code { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; }


/* Price check: the two last columns wrap instead of pushing the table past its card */
.res__margins td .res__flagtext { white-space: normal; max-width: 8.5rem; margin-inline: auto; line-height: 1.3; }
.res__margins th:last-child, .res__margins td:last-child { padding-right: 1rem; }
.res__margins td.num { white-space: normal; }
/* One compact table layout for every results table (P4P and S4P): same figure, header and name sizes. */
.q-table.res__margins th, .q-table.res__margins td, .q-table.res__costs th, .q-table.res__costs td { padding-left: .35rem; padding-right: .35rem; }
.q-table.res__margins th:last-child, .q-table.res__margins td:last-child, .q-table.res__costs th:last-child, .q-table.res__costs td:last-child { padding-right: 1rem; }
.q-table.res__margins td.num, .q-table.res__costs td.num { font-size: .875rem; }
.q-table.res__margins td.num strong, .q-table.res__costs td.num strong { font-size: inherit; }
.q-table.res__margins thead th, .q-table.res__costs thead th { font-size: .8125rem; }
.q-table.res__margins tbody th, .q-table.res__costs tbody th { font-size: .8125rem; }
.q-table.res__margins tbody td.res__name, .q-table.res__costs tbody td.res__name { font-size: .75rem; color: var(--q-ink-3); }
.q-table.res__margins tbody th { width: 8rem; }
.q-table.res__margins tbody th a { font-size: inherit; }
/* Customer profitability and Saved evaluations: a figure and its unit stay together on one line. */
.rv__table.res__margins td.num { white-space: nowrap; }
.rv__table.res__margins td.num .rv__prod { white-space: normal; }  /* the product name may wrap */

/* Customers: search, detail of the picked customer */
.res__cfind { margin-bottom: 1rem; }
.sc__pt.is-dim { opacity: .12; }
.res__cd { padding: 1.1rem 1.25rem 1.25rem; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); scroll-margin-top: calc(var(--res-sticky, 0px) + 1rem); }
.cd__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.cd__head h3 { margin: 0; font-size: var(--q-text-lg, 1.15rem); }
.cd__head small { margin-left: .5rem; font-weight: 400; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.cd__close { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); background: var(--q-surface); color: var(--q-ink-2); cursor: pointer; }
.cd__close:hover { background: var(--q-surface-2, var(--q-line)); }
.cd h4 { margin: 1.25rem 0 .5rem; font-size: var(--q-text-md); }
.cd__bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 1.25rem; }
.cd__bar h4 { margin: 0; }
.cd__when { margin-left: .5rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }
.cd__switch { display: inline-flex; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); overflow: hidden; }
.cd__switch button { padding: .35rem .8rem; border: 0; border-left: 1px solid var(--q-line); background: var(--q-surface); color: var(--q-ink-2); font-size: var(--q-text-sm); cursor: pointer; }
.cd__switch button:first-child { border-left: 0; }
.cd__switch button.is-on { background: var(--q-ink); color: #fff; }
.cd__chart { display: block; width: 100%; height: auto; max-height: 15rem; margin: .5rem 0 1rem; }
.cd__zero { stroke: var(--q-line-strong); stroke-width: 1; }
.cd__col { fill: var(--q-s1); }
.cd__col.is-neg { fill: var(--q-critical, #c0392b); }
.cd__tick { font-size: 11px; fill: var(--q-ink-3); }
.cd__table { margin-bottom: .5rem; }
.cd__table .res__margins th, .cd__table .res__margins td { padding-left: .6rem; padding-right: .6rem; }
.cd .cd__none td { color: var(--q-ink-3); }
.res__cd .q-table-wrap { overflow-x: auto; } /* narrow screens scroll sideways */
@media (min-width: 1100px) { .res__cd .q-table-wrap { overflow: visible; } } /* wide enough: no scroll box, so the header can stick to the page */

/* Customer detail: stacked months, product legend, expandable months */
.res__kpis--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1200px) { .res__kpis--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.res__split { display: block; height: .45rem; margin: .4rem 0 .15rem; border-radius: 999px; background: var(--q-s2); overflow: hidden; }
.res__split i { display: block; height: 100%; background: var(--q-s1); }
.cd__legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .6rem 0 0; padding: 0; list-style: none; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.cd__legend li { display: inline-flex; align-items: center; gap: .4rem; }
.cd__legend i, .cd__sub i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; flex: none; }
.cd__sub i { margin-right: .5rem; }
.cd i.is-c0, .cd__seg.is-c0 { background: var(--q-line-strong); fill: var(--q-line-strong); }
.cd i.is-c1, .cd__seg.is-c1 { background: var(--q-s1); fill: var(--q-s1); }
.cd i.is-c2, .cd__seg.is-c2 { background: var(--q-s2); fill: var(--q-s2); }
.cd i.is-c3, .cd__seg.is-c3 { background: var(--q-s3); fill: var(--q-s3); }
.cd i.is-c4, .cd__seg.is-c4 { background: var(--q-s4); fill: var(--q-s4); }
.cd i.is-c5, .cd__seg.is-c5 { background: var(--q-s6); fill: var(--q-s6); }
.cd i.is-c6, .cd__seg.is-c6 { background: var(--q-s7); fill: var(--q-s7); }
.cd i.is-c7, .cd__seg.is-c7 { background: var(--q-s8); fill: var(--q-s8); }
.cd__seg { stroke: var(--q-surface); stroke-width: 1.5; }
.cd__grid { stroke: var(--q-line); stroke-width: 1; }
.cd__chart { max-height: 17rem; }
.cd__tools { display: flex; justify-content: flex-end; margin: 0 0 .4rem; }
.cd__all { border: 0; background: none; color: var(--q-accent-ink, var(--q-ink-2)); font-size: var(--q-text-sm); text-decoration: underline; cursor: pointer; padding: .2rem .3rem; }
.cd__tgl { display: inline-flex; align-items: center; gap: .35rem; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.cd__tgl .q-icon { width: .9rem; height: .9rem; transition: transform .12s; }
.cd__tgl[aria-expanded="true"] .q-icon { transform: rotate(90deg); }
.cd__plain { padding-left: 1.25rem; }
.cd__sub { background: color-mix(in srgb, var(--q-line) 35%, transparent); }
.cd__sub th { padding-left: 2.1rem; font-weight: 400; }
.cd__sub td { color: var(--q-ink-2); }

/* Customer detail: unit caption, legend used as a product filter */
.cd__unit { font-size: 11px; fill: var(--q-ink-2); font-weight: 600; }
.cd__lg { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .5rem; border: 1px solid transparent; border-radius: var(--q-r-ctrl); background: transparent; color: var(--q-ink-2); font: inherit; cursor: pointer; }
.cd__lg:hover { border-color: var(--q-line-strong); }
.cd__lg[aria-pressed="true"] { border-color: var(--q-ink); color: var(--q-ink); background: var(--q-surface); }
.cd__legend.is-filtered .cd__lg[aria-pressed="false"] { opacity: .45; }
.cd__reset { color: var(--q-ink-3); text-decoration: underline; }
.cd__reset[hidden] { display: none; }
.cd__seg { transition: height .15s, y .15s; }
@media (prefers-reduced-motion: reduce) { .cd__seg { transition: none; } }

.cd--pick .cd__seg { cursor: pointer; }
.cd--pick .cd__seg:hover { opacity: .85; }

/* Link between the products and the price checks tabs: shown while a product is selected */
.res__tabs > .res__link { align-self: center; display: inline-flex; padding: .3rem .45rem; margin-left: -.6rem; border: 1px solid var(--q-accent); border-radius: 999px; color: var(--q-accent-ink, var(--q-ink)); background: var(--q-surface); }
.res__tabs > .res__link[hidden] { display: none; }
.res__tabs > .res__link:hover { background: var(--q-seq-100); }
.res__tabs > .res__link .q-icon { width: 1rem; height: 1rem; }
.cd__kpis { margin: .6rem 0 1.6rem; }
.cd__kpis[hidden] { display: none; }
.cd__kpiset { margin: 0; }
.res__tile.is-s2 { --tile: var(--q-s2); }
.res__tile.is-s3 { --tile: var(--q-s3); }
.cd__scope { margin: 1rem 0 0; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.cd__scope strong { font-size: 1.25rem; font-weight: 700; color: var(--q-ink); }
.cd__scope .q-code { margin-left: .55rem; }
.cd__scope.is-product strong { color: var(--q-ink); }
.cd__scope.is-product strong::before { content: ""; display: inline-block; width: .7rem; height: .7rem; margin-right: .5rem; border-radius: 2px; background: var(--scope-c, var(--q-accent)); vertical-align: baseline; }
.res__buyers { scroll-margin-top: calc(var(--res-sticky, 0px) + 1rem); }

/* Customers: the best matches for the search, listed under the search box */
.res__cfind { position: relative; }
.res__finds { list-style: none; margin: -.25rem 0 .75rem; padding: .25rem; max-width: 34rem; background: var(--q-surface); border: 1px solid var(--q-line-strong); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); }
.res__finds[hidden] { display: none; }
.res__finds button { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .45rem .65rem; border: 0; border-radius: var(--q-r-ctrl); background: none; font: inherit; text-align: left; cursor: pointer; }
.res__finds button:hover, .res__finds button:focus-visible { background: var(--q-seq-100); }
.res__finds button.is-picked { background: var(--q-seq-100); box-shadow: inset 3px 0 0 var(--q-accent); }
.res__finds small { color: var(--q-ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.res__finds-note { padding: .35rem .65rem .2rem; font-size: var(--q-text-xs); color: var(--q-ink-3); }

/* Cost figures: green is cheaper (good), red is dearer (bad) */
.dev--status { --dev-cheap: var(--q-good); --dev-dear: var(--q-critical); }
.dev--status.is-down .dev__value small, .dev--status .is-down .dev__value small { color: var(--q-good-ink); }
.dev--status .is-up .dev__value small { color: var(--q-critical-ink); }
.dev--status .dev__bar { background: linear-gradient(90deg, color-mix(in srgb, var(--dev-dear) 55%, #fff), var(--dev-dear)); }
.dev--status .is-down .dev__bar { background: linear-gradient(270deg, color-mix(in srgb, var(--dev-cheap) 55%, #fff), var(--dev-cheap)); }
.wf.dev--status .is-up .wf__bar { background: var(--q-good); }
.wf.dev--status .is-down .wf__bar { background: var(--q-critical); }

/* Cost tables: each figure carries its own movement underneath */
.res__costs th, .res__costs td { padding-left: .6rem; padding-right: .6rem; }
.res__costs td .res__delta, .res__costs tfoot td .res__delta { display: flex; justify-content: center; margin-top: .1rem; font-size: var(--q-text-xs); }
.res__costs tfoot td { font-weight: 700; }

/* Month by month: the compared period is drawn under the current one, on the same scale */
.cd__period { margin: 1rem 0 .25rem; font-size: var(--q-text-md); }
.cd__period small { margin-left: .5rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }

/* Margins table: the change under a figure wraps before the percentage ("+8,371" then "(+3.0%)") */
.res__margins td .res__delta { display: block; max-width: 7.2rem; margin-inline: auto; text-align: center; white-space: normal; line-height: 1.25; }
.res__margins td .res__delta > span { white-space: normal; }
.res__margins td .res__delta .q-icon { display: inline-block; vertical-align: -.15em; margin-right: .15rem; }
/* A screen too narrow for the table: the card scrolls sideways (the sticky header gives way) */
.res__block .q-table-wrap.is-scroll { overflow-x: auto; }

/* A second row of tiles for the compared period */
.res__rowtitle { margin: 1.25rem 0 .6rem; font-size: var(--q-text-md); }
.res__rowtitle small { margin-left: .5rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }
.q-kpi__period .res__delta { display: flex; margin-top: .2rem; font-size: var(--q-text-sm); }

.res__subhead { margin: 1rem 0 .25rem; font-size: var(--q-text-sm); font-weight: 600; }
.res__drivers { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .25rem; font-size: var(--q-text-sm); }
.res__drivers li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; }
.res__drivername { font-weight: 500; }
.res__drivers small { color: var(--q-ink-3); }

.cd__tip { position: fixed; z-index: 50; max-width: 18rem; padding: .55rem .7rem; border-radius: var(--q-r-card, 8px); background: var(--q-ink); color: #fff; font-size: var(--q-text-xs); line-height: 1.45; box-shadow: var(--q-shadow-card); pointer-events: none; }
.cd__tip[hidden] { display: none; }
.cd__tip strong { display: block; margin-bottom: .2rem; font-size: var(--q-text-sm); }
.cd__tip span { display: block; font-variant-numeric: tabular-nums; }
.res__block .q-table-wrap + .res__hint { margin-top: .6rem; }
.sh .cd__period { margin-top: 1.75rem; }

/* Products sold in the compared period and not in this one */
.res__goneRow th, .res__goneRow td { color: var(--q-ink-3); background: var(--q-surface-2, transparent); }
.res__goneRow .res__neg { background: transparent; color: var(--q-ink-3); padding-left: 0; }

/* Plant flowsheet (Production flow) */
.fs { margin-top: 1.25rem; padding: 1rem 1.25rem 1.25rem; }
.fs__meta { margin: .75rem 0 .5rem; color: var(--q-ink-2); font-size: var(--q-fs-sm, .875rem); }
.fs__empty { margin: 1rem 0; color: var(--q-ink-3); }
.fs__view { border: 1px solid var(--q-line); border-radius: var(--q-r-ctrl); background: var(--q-surface); overflow: hidden; }
.fs__img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.fs__pdf { display: block; width: 100%; height: max(40rem, calc(100vh - 7rem)); border: 0; }
.fs__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1rem; }
.fs__form { display: flex; align-items: center; gap: .6rem; margin: 0; }
.fs__form label { margin: 0; cursor: pointer; }
.fs__hint { color: var(--q-ink-3); }

/* S4P plant set-up */
.s4p__panel, .res__panel, .q-panel--page { margin-top: 1.25rem; padding: 1rem 1.25rem 1.25rem; }
.s4p__panel:first-child, .res__panel:first-child, .q-panel--page:first-child { margin-top: 0; }
.s4p__raws { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; list-style: none; margin: .75rem 0; padding: 0; }
.s4p__raw { display: flex; align-items: center; border: 1px solid var(--q-line); border-radius: var(--q-r-pill); background: var(--q-surface); padding: .1rem .35rem .1rem .75rem; }
.s4p__grip { cursor: grab; color: var(--q-ink-3); padding: 0 .35rem 0 0; user-select: none; line-height: 1; }
.s4p__raw.is-dragging { opacity: .4; }
.s4p__raw.is-over { box-shadow: -3px 0 0 var(--q-primary); }
.s4p__rename, .s4p__raw form { margin: 0; }
.s4p__rename input { border: 0; background: transparent; font: inherit; width: 9rem; padding: .25rem 0; }
.s4p__rename input:focus { outline: 2px solid var(--q-primary); border-radius: var(--q-r-ctrl); }
.s4p__del { border: 0; background: transparent; color: var(--q-ink-3); font-size: 1.1rem; line-height: 1; padding: .2rem .45rem; cursor: pointer; }
.s4p__del:hover { color: var(--q-critical-ink); }
.s4p__none { color: var(--q-ink-3); }
.s4p__add { display: flex; justify-content: center; gap: .5rem; align-items: center; margin-top: .5rem; }
.s4p__add input { max-width: 16rem; }
.s4p__msg { min-height: 1.4rem; color: var(--q-critical-ink); font-size: var(--q-fs-sm, .875rem); }
.s4p__msg.is-ok { color: var(--q-ink-2); }
.s4p__recipes { margin-top: 1.25rem; }
.s4p.is-compact .s4p__rawpanel { display: none; }
.s4p.is-compact .s4p__recipes { margin-top: 0; }
.s4p__todo { border: 0; border-radius: 999px; padding: .15rem .7rem; background: var(--q-warning-soft); color: var(--q-warning-ink); font-size: var(--q-text-xs); font-weight: 600; cursor: pointer; }
.s4p__todo[hidden] { display: none; }
.s4p__table .cst__row.is-empty th.cst__name, .s4p__table .cst__row.is-incomplete th.cst__name, .s4p__table .cst__row.is-over th.cst__name { box-shadow: inset 3px 0 0 var(--q-warning); }
.s4p__sold { display: block; font-weight: 400; color: var(--q-ink-3); font-variant-numeric: tabular-nums; }
.s4p__table { --w-name: 10rem; }
.s4p__table td.cst__box { position: relative; height: 2.6rem; }
.s4p__table .cst__share { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; }
.s4p__table th.cst__name { border-right: 1px solid var(--q-line); }
.s4p__table th.cst__name small { display: block; font-weight: 400; color: var(--q-ink-3); }
.s4p__table thead th.cst__name { text-align: left; }
.cst__row.is-empty .cst__sum { color: var(--q-ink-3); }

/* S4P shared bits */
.s4p__period { margin: 0 0 1rem; }
.s4p__period small { color: var(--q-ink-3); margin-left: .5rem; }
.s4p__note { margin: 0 0 1rem; padding: .75rem 1rem; border-radius: var(--q-r-ctrl); background: var(--q-warning-soft); color: var(--q-ink); }
.s4p__note p { margin: .15rem 0; }
.s4p__go { text-align: center; margin-top: 1rem; }
.s4p__out { list-style: none; margin: .5rem 0 0; padding: 0; columns: 2; }
.s4p__out li { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border-bottom: 1px solid var(--q-line); break-inside: avoid; }
.s4p__out small { color: var(--q-ink-3); }

/* S4P plant set-up */
.s4p__panel--slim { padding: .3rem 1.25rem; }
.s4p__figs { display: flex; justify-content: center; flex-wrap: wrap; gap: .75rem 0; margin: 0; }
.s4p__fig { display: flex; align-items: center; gap: .5rem; padding: 0 1.75rem; }
.s4p__fig + .s4p__fig { border-left: 1px solid var(--q-line); }
.s4p__figname { font-size: var(--q-text-xs); font-weight: 600; color: var(--q-ink-2); }
.s4p__figbox { display: flex; align-items: baseline; justify-content: center; gap: .4rem; }
.s4p__figbox input { width: 5rem; text-align: center; font: inherit; font-size: 1.3rem; font-weight: 650; line-height: 1.2; border-color: transparent !important; background: transparent; font-variant-numeric: tabular-nums; padding: .45rem .6rem; border: 1px solid var(--q-line-strong, var(--q-line)); border-radius: var(--q-r-ctrl); background: var(--q-surface); }
.s4p__figbox input.is-error { outline: 2px solid var(--q-critical); background: var(--q-critical-soft); }
.s4p__figbox i { font-style: normal; font-size: var(--q-text-xs); font-weight: 600; color: var(--q-ink-2); }
.s4p__figbox input[data-fig="hours"] { width: 7rem; }
.s4p__figbox input:hover { background: var(--q-surface-2, #f4f6f5); }
.s4p__figbox input:focus, .s4p__figbox input:focus-visible { outline: none; background: var(--q-surface); border-color: var(--q-line-strong, var(--q-ink-3)) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--q-ink-3) 22%, transparent); }
.s4p__name { display: inline-block; vertical-align: middle; resize: none; overflow: hidden; line-height: 1.25; text-align: center; white-space: normal; overflow-wrap: anywhere; border: 1px solid transparent; background: transparent; font: inherit; font-weight: 600; line-height: 1.25; width: calc(100% - 1.6rem); padding: .3rem .4rem; border-radius: var(--q-r-ctrl); transition: background-color .12s, border-color .12s, box-shadow .12s; }
.s4p__name:hover { background: var(--q-surface-2, #f4f6f5); }
.s4p__name:focus, .s4p__name:focus-visible { outline: none; background: var(--q-surface); border-color: var(--q-line-strong, var(--q-ink-3)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--q-ink-3) 22%, transparent); }
.s4p__modes thead th.cst__box small { display: block; font-weight: 400; color: var(--q-ink-3); }
.s4p__plain { background: transparent !important; }
.s4p__refnote { color: var(--q-ink-3); text-align: left; padding: .6rem .8rem; }
.s4p__addmode { margin: 0; }
.s4p__modes .cst__name { text-align: left; }
.s4p__modes .cst__name small { margin-left: .35rem; font-weight: 400; color: var(--q-ink-3); }
.s4p__modehead { position: relative; white-space: nowrap; }
.s4p__modehead .s4p__name { width: calc(100% - 1.6rem); text-align: center; }
.s4p__modehead form { display: inline; margin: 0; }
.s4p__modehead.is-empty, .s4p__modehead.is-incomplete, .s4p__modehead.is-nothroughput:not(.is-over) { box-shadow: inset 0 3px 0 var(--q-warning); }
.s4p__modehead.is-over { box-shadow: inset 0 3px 0 var(--q-critical); }
.s4p__obshead small { display: block; font-weight: 400; color: var(--q-ink-3); }
.s4p__obs { color: var(--q-ink-2); font-variant-numeric: tabular-nums; }
.s4p__obscell { display: inline-flex; align-items: center; gap: .55rem; margin: 0; cursor: pointer; min-width: 5.5rem; justify-content: flex-start; }
.s4p__obscell input { accent-color: var(--q-primary); width: 1rem; height: 1rem; margin: 0; cursor: pointer; }
.s4p__obsval { min-width: 3.4rem; text-align: right; }
.s4p__obs.is-off .s4p__obsval { color: var(--q-ink-3); }
.s4p__obs.is-off { background: var(--q-surface-2, #f4f6f5); }
.s4p__considered { font-weight: 600; color: var(--q-ink-2); text-align: center; border-top: 2px solid var(--q-line); }
.s4p__copy { position: relative; margin-top: .35rem; display: inline-flex; gap: .3rem; justify-content: center; }
.s4p__just { display: inline-block; margin-top: .25rem; padding: .1rem .55rem; border-radius: 999px; font-size: var(--q-text-xs); font-weight: 600; background: var(--q-good-soft); color: var(--q-good-ink); animation: s4p-pop .25s ease-out; }
@keyframes s4p-pop { from { opacity: 0; transform: translateY(-3px) scale(.92); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .s4p__just { animation: none; } }
.s4p__undobtn { padding-inline: .5rem; display: inline-flex; align-items: center; }
.s4p__undobtn[hidden] { display: none; }
.s4p__copybtn:disabled { opacity: .5; cursor: not-allowed; }
.s4p__menu { position: absolute; right: 0; top: calc(100% + .25rem); z-index: 30; min-width: 12rem; max-height: min(24rem, 60vh); overflow-y: auto; padding: .3rem; text-align: left; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-ctrl); box-shadow: 0 8px 24px rgba(20, 30, 35, .14); }
.s4p__menu[hidden] { display: none; }
.s4p__menufollow input { accent-color: var(--q-primary); width: 1rem; height: 1rem; margin: 0; cursor: pointer; }
.s4p__menufollow { display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; margin-bottom: .2rem; border-bottom: 1px solid var(--q-line); font-size: var(--q-text-sm); font-weight: 500; cursor: pointer; }
.s4p__menu button:disabled { opacity: .45; cursor: not-allowed; }
.s4p__followcell { text-align: center; }
.s4p__following[hidden], .s4p__nofollow[hidden] { display: none; }
.s4p__nofollow { font-size: var(--q-text-xs); font-weight: 500; color: var(--q-ink-3); cursor: default; }
.s4p__allcell { vertical-align: middle; }
/* The table is made of cells to click, not text to select: a stray drag or double-click used to leave a blue selection that would not clear. The fields stay selectable. */
.s4p__modes th, .s4p__modes td { -webkit-user-select: none; user-select: none; }
.s4p__modes input[type=text], .s4p__modes textarea { -webkit-user-select: text; user-select: text; }
/* The "+" that adds a mode: a column of its own after the last mode. */
.s4p__table th.s4p__addcol, .s4p__table td.s4p__addcell { width: 3.5rem; min-width: 3.5rem; padding: 0; text-align: center; background: var(--q-surface); }
.s4p__table th.s4p__addcol { background: inherit; }
.s4p__addbtn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border: 1px dashed var(--q-ink-3); border-radius: 50%; background: transparent; color: var(--q-ink-2); cursor: pointer; }
.s4p__addbtn:hover, .s4p__addbtn:focus-visible { border-style: solid; border-color: var(--q-ink); color: var(--q-ink); background: var(--q-surface); outline: none; }
.s4p__following { display: inline-block; padding: .2rem .7rem; border: 1px dashed var(--q-line); border-radius: 999px; font: inherit; font-size: var(--q-text-xs); font-weight: 600; background: transparent; color: inherit; opacity: .7; cursor: pointer; }
.s4p__following.is-on { border: 1px solid transparent; background: var(--q-good-soft); color: var(--q-good-ink); opacity: 1; }
.s4p__following:disabled { cursor: default; }
.s4p__following:hover:not(:disabled), .s4p__following:focus-visible:not(:disabled) { filter: brightness(.95); outline: none; }
.s4p__menu button { display: block; width: 100%; padding: .45rem .7rem; border: 0; border-radius: .35rem; background: transparent; font: inherit; font-weight: 500; text-align: left; color: var(--q-ink); cursor: pointer; }
.s4p__menu button:hover, .s4p__menu button:focus-visible { background: var(--q-surface-2, #f4f6f5); outline: none; }
.s4p__menunew { margin-top: .2rem; border-top: 1px solid var(--q-line) !important; border-radius: 0 0 .35rem .35rem !important; color: var(--q-ink-2) !important; }
.s4p__modes input.is-ghost { font-style: italic; color: var(--q-ink-3); }
.s4p__ctotal { border-right: 1px solid var(--q-line); text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; border-top: 2px solid var(--q-line); position: sticky; bottom: 0; z-index: 1; background: var(--q-surface); }
.s4p__totrow th.cst__name { position: sticky; bottom: 0; z-index: 3; border-top: 2px solid var(--q-line); }
.s4p__totrow td.cst__sum { position: sticky; bottom: 0; z-index: 3; }
.s4p__ctotal.is-ok { background: var(--q-good-soft); color: var(--q-good-ink); }
.s4p__ctotal.is-incomplete { background: var(--q-warning-soft); color: var(--q-warning-ink); }
.s4p__ctotal.is-over { background: var(--q-critical-soft); color: var(--q-critical-ink); }
.s4p__ctotal.is-empty { color: var(--q-ink-3); }
.s4p__refnote { color: var(--q-ink-3); padding: .6rem .8rem; }
.s4p__modehead { padding-top: 1rem; }
.s4p__grab { position: absolute; top: 0; left: 0; right: 0; height: .85rem; display: flex; align-items: center; justify-content: center; font-size: .6rem; letter-spacing: -.1em; line-height: 1; color: var(--q-ink-3); opacity: .45; cursor: grab; user-select: none; }
.s4p__modehead:hover .s4p__grab { opacity: 1; background: var(--q-surface-2, #f4f6f5); }
.s4p__modehead.is-dragging { opacity: .4; }
.s4p__modehead.is-over-left { box-shadow: inset 3px 0 0 var(--q-primary); }
.s4p__modehead.is-over-right { box-shadow: inset -3px 0 0 var(--q-primary); }

.s4p__modes th.cst__name small { display: inline; margin-left: .35rem; }
.s4p__modes th.cst__name small.s4p__nomode { display: none; font-size: var(--q-text-xs); font-weight: 600; color: var(--q-warning-ink); white-space: nowrap; }
.s4p__modes .cst__row.is-uncovered th.cst__name { box-shadow: inset 3px 0 0 var(--q-warning); }
.s4p__modes .cst__row.is-uncovered th.cst__name small.s4p__nomode { display: block; margin: .1rem 0 0; } /* its own line: the name and the volume stay together above it */

.s4p__table th.cst__name { position: sticky; }
.s4p__modes th.cst__name small.s4p__rawvol { font-variant-numeric: tabular-nums; color: var(--q-ink-3); white-space: nowrap; }
.s4p__modes thead th.cst__name { white-space: normal; }
.s4p__modes thead th.cst__name small.s4p__rawperiod { display: block; white-space: normal; overflow-wrap: anywhere; margin: 0; font-size: .7rem; font-weight: 400; color: var(--q-ink-3); }
.s4p__tphcell.is-missing { background: var(--q-warning-soft); }
.s4p__tphcell.is-missing input::placeholder { color: var(--q-warning-ink); opacity: .8; }
/* The row under the mouse is lightly shaded, over any tint, so it is easy to follow across the table. */
.s4p__table tbody tr.cst__row > th.cst__name::after, .s4p__table tbody tr.cst__row > td.cst__box::after, .s4p__table tbody tr.cst__row > td.cst__sum::after { content: ""; position: absolute; inset: 0; background: rgba(20, 30, 35, .045); opacity: 0; pointer-events: none; transition: opacity .08s; }
.s4p__table tbody tr.cst__row:hover > th.cst__name::after, .s4p__table tbody tr.cst__row:hover > td.cst__box::after, .s4p__table tbody tr.cst__row:hover > td.cst__sum::after { opacity: 1; }
.s4p__table tbody tr.cst__row > td.cst__sum { position: sticky; }
.s4p__all { padding: .2rem .7rem; border: 1px solid var(--q-line); border-radius: 999px; background: var(--q-surface); font: inherit; font-size: var(--q-text-xs); font-weight: 600; color: var(--q-ink-2); cursor: pointer; transition: border-color .12s, color .12s; }
.s4p__all:hover, .s4p__all:focus-visible { border-color: var(--q-ink-3); color: var(--q-ink); }
/* A negative share: the mode takes this raw product out of stock (recrushing). */
.cst__share.is-consume { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--q-ink-3) 14%, transparent) 6px 12px); color: var(--q-critical-ink); font-weight: 600; }
.s4p__ctotal .s4p__sep { color: var(--q-ink-3); font-weight: 400; }
.s4p__negtotal.is-ok { color: var(--q-good-ink); }
.s4p__negtotal.is-incomplete { color: var(--q-warning-ink); }
.s4p__negtotal.is-over { color: var(--q-critical-ink); }

/* S4P deal impact */
/* Deal input: three steps, each in the usual white frame. */
.deal__step { padding-bottom: 1.5rem; }
.deal__head { display: flex; align-items: flex-start; gap: 1rem; padding: 1.5rem 1.75rem 1.1rem; max-width: 52rem; margin: 0 auto; }
.deal__head h2 { margin: 0 0 .15rem; font-size: var(--q-text-lg); }
.deal__head p { margin: 0; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.deal__no { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--q-basalt); color: #fff; font-weight: 600; font-size: var(--q-text-sm); box-shadow: 0 0 0 3px var(--q-primary-soft); }

/* The search field, for customers and for products. */
.deal__finder { position: relative; display: flex; align-items: center; flex: 1 1 22rem; min-width: 0; background: var(--q-surface); border: 1.5px solid var(--q-line-strong); border-radius: 14px; box-shadow: var(--q-shadow-card); transition: border-color .12s, box-shadow .12s; }
.deal__finder:focus-within { border-color: var(--q-primary); box-shadow: 0 0 0 4px var(--q-primary-ring); }
.deal__finder > .q-icon { flex: none; width: 1.2rem; height: 1.2rem; margin-left: 1rem; color: var(--q-ink-3); }
.deal__finder input { flex: 1; width: 0; min-width: 0; height: 3.1rem; padding: 0 1rem 0 .75rem; border: 0; background: transparent; color: var(--q-ink); font-size: var(--q-text-md); outline: 0; }
.deal__finder input::placeholder { color: var(--q-ink-3); }
.deal__finder--products { max-width: 30rem; margin: 0 auto 1rem; }
.deal__count { margin-right: .6rem; padding: .15rem .6rem; border-radius: var(--q-r-pill); background: var(--q-primary); color: #fff; font-size: var(--q-text-xs); font-weight: 600; white-space: nowrap; }
.deal__results { position: absolute; z-index: 5; inset: 100% -1.5px auto; margin: .35rem 0 0; padding: .35rem; list-style: none; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: 12px; box-shadow: var(--q-shadow-pop); max-height: 18rem; overflow: auto; }
.deal__results li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .6rem .8rem; border-radius: 8px; cursor: pointer; }
.deal__results li:hover, .deal__results li.is-active { background: var(--q-primary-soft); }
.deal__placebox { display: inline-block; margin: 0; min-width: 12rem; }
.deal__search { flex: 1 1 22rem; margin: 0; }
.deal__search--products { width: calc(100% - 3.5rem); max-width: 40rem; margin: 0 auto 1rem; }
.deal__search .deal__count { position: absolute; top: 50%; right: 3rem; transform: translateY(-50%); margin: 0; }
#deal-results li.is-active button { background: var(--q-seq-100); }
#deal-results small { color: var(--q-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.deal__results small { color: var(--q-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.deal__who { display: flex; flex-wrap: wrap; gap: .75rem; align-items: stretch; max-width: 40rem; margin: 0 auto; padding: 0 1.75rem; }
.deal__who[hidden], .deal__finder[hidden], .deal__chosen[hidden], .deal__new[hidden] { display: none; }
.deal__new { flex: none; display: inline-flex; align-items: center; gap: .5rem; height: 3.1rem; padding: 0 1.25rem; border: 1.5px solid var(--q-line-strong); border-radius: 14px; background: var(--q-surface); color: var(--q-ink); font-size: var(--q-text-base); font-weight: 500; cursor: pointer; box-shadow: var(--q-shadow-card); transition: border-color .12s, background-color .12s; }
.deal__new .q-icon { width: 1.05rem; height: 1.05rem; }
.deal__new:hover { border-color: var(--q-primary); background: var(--q-primary-soft); }
.deal__new.is-on { border-color: var(--q-primary); background: var(--q-primary); color: #fff; }
.deal__chosen { flex: 1 1 22rem; display: flex; align-items: center; gap: .85rem; min-height: 3.1rem; padding: .35rem .6rem .35rem .5rem; border: 1.5px solid var(--q-primary); border-radius: 14px; background: var(--q-surface); }
.deal__chosen div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.deal__chosen b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal__chosen small { color: var(--q-ink-3); font-variant-numeric: tabular-nums; }
.deal__avatar { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--q-basalt); color: #fff; font-weight: 600; }
.deal__chosen button { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: transparent; color: var(--q-ink-2); cursor: pointer; }
.deal__chosen button:hover { background: var(--q-primary-soft); }
.deal__chosen button .q-icon { width: 1rem; height: 1rem; }
.deal__where { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem; max-width: 40rem; margin: .9rem auto 0; padding: .8rem 1.1rem; background: var(--q-surface-sunk); border-radius: 12px; }
.deal__where[hidden] { display: none; }
.deal__where label { margin: 0; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.deal__where input { height: 2.5rem; width: 13rem; padding: 0 .9rem; border: 1.5px solid var(--q-line-strong); border-radius: 10px; background: var(--q-surface); font-size: var(--q-text-base); }
.deal__where input:focus { outline: 0; border-color: var(--q-primary); box-shadow: 0 0 0 3px var(--q-primary-ring); }

.deal__pills { padding: .25rem 1.75rem .25rem; justify-content: center; padding-bottom: .5rem; }
.deal__nomatch { margin: .5rem 0; color: var(--q-ink-3); }
.deal__nomatch[hidden] { display: none; }
.deal__hint { margin: 0; padding: .75rem 1.75rem 0; text-align: center; color: var(--q-ink-3); font-size: var(--q-text-sm); }

/* One line per product: tonnes, price, revenue, and the price helper underneath. */
.deal__lines { display: flex; flex-direction: column; gap: .85rem; max-width: 76rem; margin: 0 auto; padding: 0 1.75rem; }
.dline { position: relative; display: grid; grid-template-columns: minmax(10rem, 1fr) 10.5rem 10.5rem 8.5rem; gap: .5rem 1.1rem; align-items: end; padding: 1.1rem 1.25rem 1rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.dline > * { min-width: 0; }
.dline__name { align-self: center; display: flex; align-items: center; gap: .5rem; min-width: 0; }
.dline__name b { font-size: var(--q-text-md); font-weight: 600; }
.q-code, .dline__code { padding: .05rem .5rem; border: 1px solid var(--q-line); border-radius: var(--q-r-pill); background: color-mix(in srgb, var(--q-primary-soft) 35%, #fff); color: var(--q-ink-2); font-size: var(--q-text-xs); font-weight: 500; line-height: 1.4; font-variant-numeric: tabular-nums; white-space: nowrap; vertical-align: middle; }
.res__name .q-code, .cd__tgl .q-code, .cd__plain .q-code, .res__buyers h3 .q-code { margin-left: .45rem; }
.dline__x { position: absolute; top: -.8rem; right: -.8rem; z-index: 3; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border: 1px solid var(--q-line); border-radius: 50%; background: var(--q-surface); box-shadow: var(--q-shadow-card); color: var(--q-ink-2); cursor: pointer; }
.dline__x:hover { background: var(--q-critical-soft); color: var(--q-critical-ink); }
.dline__x .q-icon { width: .9rem; height: .9rem; }
.dline__field { display: flex; flex-direction: column; gap: .3rem; margin: 0; }
.dline__lab { color: var(--q-ink-3); font-size: var(--q-text-xs); font-weight: 500; }
.dline__box { display: flex; align-items: center; height: 3rem; border: 1.5px solid var(--q-line-strong); border-radius: 10px; background: var(--q-surface); transition: border-color .12s, box-shadow .12s; }
.dline__box:focus-within { border-color: var(--q-primary); box-shadow: 0 0 0 3px var(--q-primary-ring); }
.dline__box.is-error { border-color: var(--q-critical); background: var(--q-critical-soft); }
.dline__box input { flex: 1; width: 0; min-width: 0; height: 100%; padding: 0 .4rem 0 .8rem; border: 0; background: transparent; outline: 0; text-align: right; font-size: var(--q-text-lg); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--q-ink); }
.dline__box i { flex: none; padding: 0 .8rem 0 .15rem; color: var(--q-ink-3); font-style: normal; font-size: var(--q-text-sm); }
.dline__rev { display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; }
.dline__rev b { display: flex; align-items: center; height: 3rem; font-size: var(--q-text-lg); font-variant-numeric: tabular-nums; }
.dline__help { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; padding-top: .7rem; border-top: 1px dashed var(--q-line); }
.dline__help:empty { display: none; }
.deal__use { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .9rem; border: 1.5px solid var(--q-accent); border-radius: var(--q-r-pill); background: var(--q-warning-soft); color: var(--q-ink); font-size: var(--q-text-sm); font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color .12s; }
.deal__use .q-icon { width: .9rem; height: .9rem; color: var(--q-accent-ink); }
.deal__use:hover { background: var(--q-accent); }
.deal__why { flex: 1 1 14rem; min-width: 0; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.deal__verdict { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; padding: .4rem .85rem; border-radius: 10px; font-size: var(--q-text-sm); }
.deal__verdict[hidden] { display: none; }
.deal__verdict span { color: inherit; font-weight: 500; }
.deal__verdict span:not(:empty)::before { content: "– "; }
.deal__verdict.is-bad { background: var(--q-critical-soft); color: var(--q-critical-ink); }
.deal__verdict.is-mid { background: var(--q-warning-soft); color: var(--q-warning-ink); }
.deal__verdict.is-good { background: var(--q-good-soft); color: var(--q-good-ink); }
.deal__zones { position: relative; flex: 1 1 100%; padding-top: 3.6rem; }
.zsug { position: absolute; inset: 0 0 auto; height: 1.6rem; }
.zsug__b { white-space: nowrap; position: absolute; top: 0; transform: translateX(-50%); z-index: 2; padding: .1rem .65rem; border: 1.5px solid var(--q-accent); border-radius: var(--q-r-pill); background: var(--q-warning-soft); color: var(--q-ink); font-size: var(--q-text-sm); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.zsug__b .q-icon { width: .85em; height: .85em; }
.zsug__b:hover { background: var(--q-accent); }
.zseen { position: absolute; inset: 2.15rem 0 auto; height: 1.2rem; }
.zseen__n { position: absolute; top: 0; line-height: 1; transform: translateX(-50%); white-space: nowrap; font-size: var(--q-text-xs); font-weight: 600; color: var(--q-ink); font-variant-numeric: tabular-nums; z-index: 1; padding: 0 .2rem; background: #fff; }
.zseen__c { position: absolute; top: 0; line-height: 1; transform: translateX(-50%); white-space: nowrap; font-size: var(--q-text-xs); color: var(--q-ink-3); }
.zseen__t { position: absolute; top: 1.05rem; width: 2px; height: .4rem; margin-left: -1px; background: var(--q-basalt); }
.zbar { --f: 0%; --b: 0%; position: relative; height: 22px; border-radius: 7px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--q-critical) 60%, #fff) 0 var(--f),
    color-mix(in srgb, var(--q-warning) 75%, #fff) var(--f) var(--b),
    color-mix(in srgb, var(--q-good) 55%, #fff) var(--b) 100%); }
.zmarket { position: absolute; top: -3px; bottom: -3px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 2px solid var(--q-basalt); border-radius: 8px; background: rgba(255, 255, 255, .22); }
.zmarket em { font-style: normal; font-size: var(--q-text-xs); font-weight: 600; color: var(--q-basalt); white-space: nowrap; pointer-events: none; }
.zmarket[hidden] { display: none; }
.ztick { position: absolute; top: -2rem; width: 3px; height: calc(2rem + 29px); margin-left: -1.5px; border-radius: 2px; background: var(--q-accent); box-shadow: 0 0 0 1.5px #fff; }
.zdot { position: absolute; top: 1px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--q-basalt); box-shadow: 0 0 0 3px #fff, var(--q-shadow-card); }
.ztick[hidden], .zdot[hidden] { display: none; }
.zlabels { position: relative; height: 1.3rem; margin-top: 8px; }
.zmark { position: absolute; top: 0; white-space: nowrap; font-size: var(--q-text-xs); color: var(--q-ink-2); font-variant-numeric: tabular-nums; }
.zmark i { position: absolute; top: -9px; width: 1.5px; height: 22px; background: var(--q-ink-2); opacity: .5; }
.zmark b { font-weight: 600; }
.zlabels.has-low { height: 2.5rem; }
.zmark.is-low { top: 1.15rem; }
.zmark.is-left { transform: translateX(-100%); padding-right: .45rem; }
.zmark.is-left i { right: 0; }
.zmark.is-right { padding-left: .45rem; }
.zmark.is-right i { left: 0; }
.zmark.k-floor b { color: var(--q-critical-ink); }
.zmark.k-be b { color: var(--q-good-ink); }
.deal__why { flex: 1 1 100%; margin: .25rem 0 0; text-align: left; }
.deal__whybox { flex: 1 1 100%; }
.deal__whybtn { padding: 0; border: 0; background: none; color: var(--q-ink-3); font-size: var(--q-text-sm); text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.deal__whybtn:hover { color: var(--q-ink); }
.deal__why[hidden] { display: none; }
.deal__none, .deal__warn { color: var(--q-ink-3); font-size: var(--q-text-sm); }
.deal__warn { color: var(--q-warning-ink); }
.deal__sum { width: calc(min(100%, 76rem) - 3.5rem); margin: 1rem auto 0; padding: 1rem 1.25rem .5rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); font-variant-numeric: tabular-nums; }
.deal__sum[hidden] { display: none; }
.deal__sum h3 { margin: 0 0 .5rem; font-size: var(--q-text-md); font-weight: 700; }
.sum__head, .sum__row { display: grid; grid-template-columns: minmax(12rem, 1fr) 6.5rem 7.5rem 8rem; gap: .35rem 1rem; align-items: center; }
.sum__head { padding-bottom: .35rem; border-bottom: 1px solid var(--q-line); color: var(--q-ink-3); font-size: var(--q-text-xs); }
.sum__head span:nth-child(n+2), .sum__row > span:nth-child(2), .sum__row > span:nth-child(3), .sum__row > b { text-align: right; }
.sum__row { padding: .7rem 0; border-bottom: 1px dashed var(--q-line); }
.sum__n { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; min-width: 0; }
.sum__n b { font-weight: 600; }
.sum__pct { margin-left: auto; color: var(--q-ink-3); font-size: var(--q-text-xs); }
.sum__bar { flex: 1 1 100%; height: 5px; border-radius: 3px; background: var(--q-surface-sunk); overflow: hidden; }
.sum__bar i { display: block; height: 100%; border-radius: 3px; background: var(--q-accent); }
.sum__row--total { border-bottom: 0; padding: .8rem 0 .6rem; font-size: var(--q-text-md); }
.sum__row--total b, .sum__row--total span { font-weight: 700; }
.deal__morewrap { display: flex; justify-content: center; margin-top: .5rem; }
.deal__more { min-height: 2.25rem; padding: .3rem 1.1rem; border: 1.5px solid var(--q-line-strong); border-radius: var(--q-r-pill); background: var(--q-surface); color: var(--q-ink-2); font-size: var(--q-text-sm); font-weight: 500; cursor: pointer; }
.deal__more:hover { background: var(--q-surface-sunk); color: var(--q-ink); }
.deal__more[hidden] { display: none; }
@media (max-width: 720px) {
  .deal__sum { width: calc(100% - 2rem); }
  .sum__head { display: none; }
  .sum__row { grid-template-columns: 1fr 1fr 1fr; }
  .sum__row .sum__n { grid-column: 1 / -1; }
  .sum__row > span:nth-child(2) { text-align: left; }
  .sum__row > span:nth-child(3) { text-align: center; }
}
.deal__go { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; width: calc(min(100%, 76rem) - 3.5rem); margin: 1.1rem auto 0; padding: 1rem 1.25rem; border-radius: 14px; background: var(--q-basalt); }
.deal__ready { margin: 0; color: rgba(255, 255, 255, .7); font-size: var(--q-text-sm); }
.deal__ready.is-ready { color: #fff; font-weight: 600; }
.deal__ready.is-ready::before { content: ""; display: inline-block; width: .55rem; height: .55rem; margin-right: .55rem; border-radius: 50%; background: var(--q-good); vertical-align: middle; }
.deal__calc { display: inline-flex; align-items: center; gap: .6rem; min-width: 16rem; justify-content: center; padding: .85rem 2rem; font-size: var(--q-text-md); font-weight: 700; border-radius: 12px; border: 0; background: var(--q-accent); color: var(--q-ink); }
.deal__calc:hover:not(:disabled) { background: var(--q-accent-strong, var(--q-accent)); filter: brightness(1.06); }
.deal__calc:disabled { background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .45); cursor: not-allowed; }
.deal__calc .q-icon { width: 1.1em; height: 1.1em; }
.deal__how { width: calc(min(100%, 76rem) - 3.5rem); margin: 1rem auto 0; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); }
.deal__how summary { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; cursor: pointer; font-weight: 600; color: var(--q-ink); list-style: none; }
.deal__how summary::-webkit-details-marker { display: none; }
.deal__how summary .q-icon { width: 1.1rem; height: 1.1rem; color: var(--q-ink-3); }
.deal__how summary span { flex: 1; }
.deal__how[open] summary .q-icon:last-child { transform: rotate(180deg); }
.deal__how--wide { width: auto; margin: .25rem 0 1.1rem; }
.cst__panel .deal__how--wide { margin: .25rem 1.25rem 1rem; }
.deal__how-body { padding: 0 1.25rem 1.2rem; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.deal__how-body p { margin: .2rem 0 .9rem; }
.deal__how-body dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .9rem 1.5rem; margin: 0 0 .9rem; }
.deal__how-body dt { font-weight: 600; color: var(--q-ink); margin-bottom: .1rem; }
.deal__how-body dd { margin: 0; }
.deal__note { margin: .7rem 0 0; text-align: center; color: var(--q-ink-3); font-size: var(--q-text-sm); }
@media (max-width: 720px) {
  .deal__head, .deal__who, .deal__lines { padding-inline: 1rem; }
  .dline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 1rem; }
  .deal__search--products { width: calc(100% - 2rem); }
  .dline__name { grid-column: 1 / -1; }
  .dline__rev { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .dline__rev b { height: auto; }
  .deal__new { flex: 1 1 100%; justify-content: center; }
  .deal__go { width: calc(100% - 2rem); }
  .deal__calc { width: 100%; min-width: 0; }
}
.deal__obj { padding: 1rem 1.75rem 0; margin: 0; text-align: center; }
.deal__assume { padding: .5rem 1.75rem 1.5rem; max-width: 56rem; margin: 0 auto; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.deal__assume h3 { font-size: var(--q-text-md); margin: .75rem 0 .3rem; }
.deal__assume ul { margin: 0; padding-left: 1.1rem; }
.deal__admin { border-style: dashed; }
.deal__h3 { font-size: var(--q-text-md); padding: .5rem 1.75rem 0; }
.deal__raw { font-size: var(--q-text-sm); }
.deal__log { margin: .5rem 1.75rem 1rem; padding: .75rem; background: var(--q-surface-sunk); border-radius: var(--q-r-ctrl); overflow: auto; max-height: 24rem; font-size: .75rem; }
.deal__table th, .deal__table td { vertical-align: middle; }

/* ---- S4P result: what the deal is worth ---- */
.res4 { padding-bottom: 1.75rem; }
.res4__cards, .res4__stock, .res4__modes { width: calc(min(100%, 76rem) - 3.5rem); margin-inline: auto; }
.res4__cards { display: block; }
.res4__cards--last { margin-top: 1.25rem; }
.res4__cards--top { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.res4__cards--top .res4__card dl { gap: .75rem 1rem; }
.res4__cards--top .res4__k dd { font-size: 1.5rem; }
.res4__card dl { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.res4__k { flex-direction: column; align-items: flex-start; gap: .15rem; }
.res4__chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.res4__chips .res4__delta { margin-top: 0; }
.res4__delta.is-ok { background: var(--q-good-soft); color: var(--q-good-ink); }
.res4__delta.is-warn { background: var(--q-warning-soft); color: var(--q-warning-ink); }
.res4__delta.is-bad { background: var(--q-critical-soft); color: var(--q-critical-ink); }

.res4__card { position: relative; padding: 1.15rem 1.4rem 1.25rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.res4__card h3 { margin: 0; font-size: var(--q-text-md); font-weight: 700; }
.res4__card > p { margin: .1rem 0 .9rem; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.res4__card dl { margin: 0; display: grid; gap: .6rem; }
.res4__k { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.res4__k dt { margin: 0; font-weight: 500; color: var(--q-ink-2); }
.res4__k dd { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--q-ink); }
.res4__k dd small, .res4__k dd { white-space: nowrap; }
.res4__k--rev dd { color: var(--q-ink); }
.res4__k.is-pos dd { color: var(--q-good-ink); }
.res4__k.is-neg dd { color: var(--q-critical-ink); }
.res4__card--with { background: var(--q-basalt); border-color: var(--q-basalt); color: #fff; }
.res4__card--with h3 { color: #fff; }
.res4__card--with > p, .res4__card--with .res4__k dt { color: rgba(255, 255, 255, .72); }
.res4__card--with .res4__k dd { color: #fff; }
.res4__card--with .res4__k.is-pos dd { color: #8fe08f; }
.res4__card--with .res4__k.is-neg dd { color: #ff9f9f; }
.res4__delta { display: inline-block; margin-top: 0; padding: .2rem .75rem; border-radius: var(--q-r-pill); background: rgba(255, 255, 255, .14); font-size: var(--q-text-sm); font-weight: 600; }
.res4__delta.is-none { opacity: .7; font-weight: 500; }
.res4__sec { margin-top: 1.5rem; }
.res4__sec h3 { margin: 0; font-size: var(--q-text-lg); }
.res4__stock { display: flex; flex-direction: column; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.stk4 { display: grid; grid-template-columns: minmax(13rem, 1fr) minmax(15rem, 1.7fr) 8.5rem 2rem; gap: .5rem 1.1rem; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px dashed var(--q-line); }
.stk4:last-child { border-bottom: 0; }
.stk4 { border-left: 4px solid transparent; }
.stk4.is-fine { border-left-color: var(--q-good); }
.stk4__n b { font-weight: 600; margin-right: .45rem; }
.stk4__x { display: inline-block; margin-left: .45rem; padding: .05rem .5rem; border-radius: var(--q-r-pill); font-size: var(--q-text-xs); font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; white-space: nowrap; vertical-align: middle; }
.stk4__x[hidden] { display: none; }
.stk4__x.is-ok { background: var(--q-good-soft, #dcefd9); color: var(--q-good-ink); }
.stk4__x.is-warn { background: var(--q-warning-soft, #fbf0d0); color: var(--q-warning-ink); }
.stk4__x.is-bad { background: var(--q-critical-soft, #f6dcdc); color: var(--q-critical-ink); }
.stk4__n small:not(.q-code) { display: block; margin-top: .15rem; color: var(--q-ink-3); font-size: var(--q-text-xs); }
.stk4__n small.is-warn { color: var(--q-warning-ink); font-weight: 600; }
.stk4__n small.is-bad { color: var(--q-critical-ink); font-weight: 600; }
.stk4__n small.is-ok { color: var(--q-good-ink); }
.stk4__t { text-align: right; font-variant-numeric: tabular-nums; }
.stk4__t b { display: block; font-size: var(--q-text-md); }
.stk4__t small { color: var(--q-ink-3); font-size: var(--q-text-xs); }
.stk4__p { display: flex; flex-direction: column; gap: .15rem; margin: 0; }
.stk4__r { text-align: right; display: flex; flex-direction: column; gap: .15rem; font-variant-numeric: tabular-nums; }
.stk4__r b { font-size: var(--q-text-md); }
.stk4.is-used { background: var(--q-surface-sunk); }
.stk4.is-used .stk4__t { grid-column: 2 / 4; text-align: left; }
.stk4.is-below .dline__box { border-color: var(--q-critical); }
/* Stock tab: what to watch, and what could move it */
.stk4__h { margin: 1.1rem 1.25rem .1rem; font-size: var(--q-text-md); }
.stk4__h small { display: block; margin-top: .1rem; font-weight: 400; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.stk4.is-watch { border-left: 4px solid var(--q-warning); }
.stk4.is-watch.is-bad { border-left-color: var(--q-critical); }
.stk4__why { grid-column: 1 / -1; display: grid; gap: .7rem; padding: .85rem 1rem; border-radius: 10px; background: var(--q-surface-sunk); font-size: var(--q-text-sm); color: var(--q-ink-2); }
.stk4__clock { display: grid; gap: .45rem; }
.stk4__made { display: grid; gap: .3rem; }
.stk4__made > small { color: var(--q-ink-2); font-size: var(--q-text-xs); font-weight: 600; }
.stk4__n .stk4__cap { margin-top: .1rem; }
.stk4__n .stk4__cap b { margin: 0; color: var(--q-ink-2); font-weight: 600; }
.stk4__track { position: relative; height: .8rem; touch-action: none; cursor: ew-resize; }
.stk4__split { display: flex; height: 100%; border-radius: 999px; overflow: hidden; gap: 2px; }
.stk4__split span { display: block; min-width: 2px; }
.stk4__split span[hidden], .stk4__seg span[hidden] { display: none; }
.stk4__split .is-assumed { background: repeating-linear-gradient(135deg, var(--q-good) 0 4px, color-mix(in srgb, var(--q-good) 45%, #fff) 4px 8px); }
.stk4__grip { position: absolute; top: 50%; width: 1.15rem; height: 1.6rem; padding: 0; margin: 0; transform: translate(-50%, -50%); border: 2px solid var(--q-ink-2); border-radius: .5rem; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: ew-resize; }
.stk4__grip::before { content: ""; position: absolute; inset: .35rem .3rem; border-left: 2px solid var(--q-ink-3); border-right: 2px solid var(--q-ink-3); }
.stk4__grip:hover, .stk4__grip:focus-visible { border-color: var(--q-ink); outline: 2px solid var(--q-gold, #d9a73e); outline-offset: 2px; }
.stk4__orig { position: absolute; top: -.25rem; bottom: -.25rem; width: 0; border-left: 2px dotted var(--q-ink); transform: translateX(-1px); pointer-events: none; }
.stk4__orig[hidden], .stk4__reset[hidden] { display: none; }
.stk4__reset { margin-left: auto; border: 1px solid var(--q-line); border-radius: 999px; background: var(--q-surface); color: var(--q-ink-2); font: inherit; font-size: var(--q-text-xs); font-weight: 600; padding: .15rem .65rem; cursor: pointer; white-space: nowrap; }
.stk4__reset:hover { background: var(--q-surface-sunk); color: var(--q-ink); }
.stk4__key i.is-assumed { background: repeating-linear-gradient(135deg, var(--q-good) 0 3px, color-mix(in srgb, var(--q-good) 45%, #fff) 3px 6px); }
.stk4__key i[hidden], .stk4__assumed[hidden] { display: none; }
.stk4__dyn { display: grid; gap: .7rem; }
.stk4__dyn p { margin: 0; }
.stk4__seg { display: flex; gap: 2px; font-size: var(--q-text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.stk4__seg span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 .2rem; }
/* a small sold figure keeps its full width instead of being clipped; the handle sits on the boundary, so leave it room */
.stk4__seg .is-sold { min-width: max-content; padding-right: .75rem; }
.stk4__seg .is-kept { padding-left: .75rem; }
.stk4__seg.is-edge .is-sold { padding-left: .75rem; }
.stk4__made .stk4__lab { color: var(--q-ink-3); font-size: var(--q-text-xs); font-weight: 600; }
.stk4__rev { font-size: var(--q-text-sm); color: var(--q-ink); }
.stk4__vol .is-sold { color: var(--q-good-ink); }
.stk4__vol .is-kept { color: var(--q-critical-ink); }
.stk4__key { display: flex; align-items: center; gap: .35rem; color: var(--q-ink-3); font-size: var(--q-text-xs); }
.stk4__key i { width: .6rem; height: .6rem; border-radius: 3px; }
.stk4__key i + i, .stk4__key i:not(:first-child) { margin-left: .5rem; }
.stk4__key i.is-sold { background: var(--q-good-ink); }
.stk4__key i.is-kept { background: var(--q-critical-ink); }
.stk4__tog { display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 1px solid var(--q-line); border-radius: 50%; background: var(--q-surface); color: var(--q-ink-2); cursor: pointer; }
.stk4__tog:hover { background: var(--q-surface-sunk); }
.stk4__tog .q-icon { width: 1rem; height: 1rem; transition: transform .15s; }
.stk4__tog[aria-expanded="true"] .q-icon { transform: rotate(180deg); }
.stk4__why[hidden] { display: none; }
.stk4__why p { margin: 0; }
.stk4__split .is-sold { background: var(--q-good); }
.stk4__split .is-kept { background: var(--q-critical); }
.stk4__none { display: flex; align-items: center; gap: .4rem; margin: 0; color: var(--q-critical-ink); font-weight: 600; }
.stk4__none .q-icon { width: 1rem; height: 1rem; }
.stk4__facts { margin: 0; padding-left: 1.1rem; }
.stk4__facts li + li { margin-top: .2rem; }
.stk4__why p.is-bad { color: var(--q-critical-ink); font-weight: 600; }
.stk4__buyers { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .9rem; }
.stk4__buyers b { color: var(--q-ink); }
.stk4__buyers span small { color: var(--q-ink-3); }

.res4__panel { width: calc(min(100%, 76rem) - 3.5rem); margin: 0 auto; padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.res4 .res4__panel > .deal__head { width: auto; padding: 0; max-width: none; margin: 0; }
.res4__panel > .res4__legend, .res4__panel > .res4__modes { width: auto; margin: 0; }
.res4 .res4__stock > .deal__head { width: auto; padding: 1.1rem 1.25rem 1.4rem; max-width: none; margin: 0; }
.res4__modes { list-style: none; margin-block: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.res4__modes li { display: grid; grid-template-columns: minmax(10rem, 14rem) 1fr minmax(12rem, 16rem); gap: .3rem 1rem; align-items: center; }
.res4__modes b { font-weight: 600; }
.res4__modes small { color: var(--q-ink-3); font-variant-numeric: tabular-nums; }
.res4__bar { height: 10px; border-radius: 5px; background: var(--q-surface-sunk); overflow: hidden; }
.res4__bar i { display: block; height: 100%; border-radius: 5px; background: var(--q-accent); }
@media (max-width: 720px) {
  .res4__cards--top { grid-template-columns: 1fr; }
  .res4__card dl { grid-template-columns: 1fr; }
  .res4__k { flex-direction: row; justify-content: space-between; align-items: baseline; }
  .res4__cards, .res4__stock, .res4__modes, .res4__panel { width: calc(100% - 2rem); }
  .res4__k dd { font-size: 1.05rem; }
  .stk4 { grid-template-columns: 1fr 1fr auto; }
  .stk4__n, .stk4__made { grid-column: 1 / -1; }
  .stk4__t { text-align: left; }
  .stk4.is-used .stk4__t { grid-column: 1 / -1; }
  .stk4__r { align-items: flex-start; }
  .res4__modes li { grid-template-columns: 1fr; }
}

/* the deal duration, asked before the calculation */
.deal__period { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .9rem 2rem; width: calc(min(100%, 76rem) - 3.5rem); margin: 1.1rem auto 0; padding: 1rem 1.25rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.deal__period h3 { margin: 0; font-size: var(--q-text-md); font-weight: 700; }
.deal__period p { margin: .15rem 0 0; max-width: 34rem; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.deal__months { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.deal__months button { min-width: 2.6rem; padding: .45rem .8rem; border: 1px solid var(--q-line); border-radius: var(--q-r-pill); background: var(--q-surface); color: var(--q-ink-2); font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.deal__months button:hover { background: var(--q-surface-sunk); }
.deal__months button.is-on { background: var(--q-basalt); border-color: var(--q-basalt); color: #fff; }
.deal__monthsbox { display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 0 .6rem; padding: .3rem .8rem; border: 1px solid var(--q-line); border-radius: 12px; background: var(--q-surface); color: var(--q-ink-3); font-size: var(--q-text-sm); }
.deal__monthsbox:focus-within { border-color: var(--q-basalt); box-shadow: 0 0 0 3px rgba(27, 36, 39, .12); }
.deal__monthsbox input { width: 2.4rem; padding: 0; border: 0; outline: 0; background: transparent; text-align: right; font-size: var(--q-text-md); font-weight: 700; color: var(--q-ink); font-variant-numeric: tabular-nums; }
.res4__card--all { background: #2a373b; border-color: #2a373b; }
@media (max-width: 720px) { .deal__period { width: calc(100% - 2rem); } .deal__monthsbox { margin-left: 0; } }

.res4__balance { display: flex; align-items: flex-start; gap: .65rem; width: calc(min(100%, 76rem) - 3.5rem); margin: 0 auto 1rem; padding: .8rem 1.1rem; border-radius: 12px; font-weight: 600; font-size: var(--q-text-sm); }
.res4__balance .q-icon { flex: none; width: 1.1rem; height: 1.1rem; margin-top: .1rem; }
.res4__balance.is-ok { background: var(--q-good-soft); color: var(--q-good-ink); }
.res4__balance.is-warn { background: var(--q-warning-soft); color: var(--q-warning-ink); }
.res4__balance.is-bad { background: var(--q-critical-soft); color: var(--q-critical-ink); }
@media (max-width: 720px) { .res4__balance { width: calc(100% - 2rem); } }


/* results: headings on the same left edge as the content, the fixed-costs line, the plant bars, the waterfall */
.res4 .deal__head { width: calc(min(100%, 76rem) - 3.5rem); max-width: none; margin-inline: auto; padding-inline: 0; }
@media (max-width: 720px) { .res4 .deal__head { width: calc(100% - 2rem); } }
.res4__k dd small.res4__fix { display: block; white-space: normal; max-width: 12rem; margin-top: .2rem; font-size: var(--q-text-sm); font-weight: 500; opacity: .7; }
.res4__track { display: block; }
.res4__track .res4__bar { display: block; }
.res4__modes li { grid-template-columns: minmax(10rem, 14rem) 1fr minmax(12rem, 16rem); }
.wf4 { list-style: none; width: calc(min(100%, 76rem) - 3.5rem); margin: 0 auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .45rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.wf4__row { display: grid; grid-template-columns: minmax(11rem, 15rem) 1fr 8.5rem; gap: 1rem; align-items: center; font-variant-numeric: tabular-nums; }
.wf4__l { color: var(--q-ink-2); }
.wf4__head { margin-top: .9rem; padding-top: .7rem; border-top: 1px solid var(--q-line); }
.wf4__head:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.wf4__head.is-later { margin-top: 1.4rem; padding-top: 1rem; border-top: 2px dashed var(--q-line); }
.wf4__head.is-final { margin: .5rem 0 0; padding: 0; border: 0; }
.wf4__hb { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; column-gap: .6rem; width: 100%; padding: .1rem 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.wf4__hb b { font-size: var(--q-text-md); }
.wf4__hb b { grid-column: 2; }
.wf4__hb small { grid-column: 2; color: var(--q-ink-3); }
.wf4__hb small:empty { display: none; }
.wf4__chev { grid-column: 1; grid-row: 1; align-self: center; flex: none; width: .55rem; height: .55rem; margin-right: .1rem; border-right: 2px solid var(--q-ink-3); border-bottom: 2px solid var(--q-ink-3); transform: rotate(45deg); transition: transform .15s; }
.wf4__head.is-closed .wf4__chev { transform: rotate(-45deg); }
.wf4__sum { display: none; grid-column: 3; grid-row: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.wf4__head.is-closed .wf4__sum { display: block; }
.wf4__sum.is-pos { color: var(--q-good-ink); }
.wf4__sum.is-neg { color: var(--q-critical-ink); }
.wf4__hb:focus-visible { outline: 2px solid var(--q-basalt); outline-offset: 2px; border-radius: 6px; }
.res4__wfhead > div { flex: 1; }
.res4__wftoggle { align-self: center; flex: none; padding: .4rem .9rem; border: 1px solid var(--q-line); border-radius: var(--q-r-pill); background: var(--q-surface); color: var(--q-ink-2); font-weight: 600; font-size: var(--q-text-sm); cursor: pointer; }
.res4__wftoggle:hover { background: var(--q-surface-sunk); }
.wf4__l small { display: block; color: var(--q-ink-3); font-weight: 500; }
.wf4__row.is-closing { margin-block: .15rem; padding: .6rem .8rem; border-radius: 12px; }
.wf4__row.is-closing.is-pos { background: var(--q-good-soft); }
.wf4__row.is-closing.is-neg { background: var(--q-critical-soft); }
.wf4__row.is-closing .wf4__t { height: 1.5rem; }
.wf4__row.is-closing .wf4__v { font-size: 1.2rem; }
.wf4__row.is-sum .wf4__l { color: var(--q-ink); font-weight: 700; }
.wf4__t { position: relative; height: 1.15rem; }
.wf4__zero { position: absolute; top: -.2rem; bottom: -.2rem; width: 1px; background: var(--q-line-strong, var(--q-line)); }
.wf4__bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.wf4__row.is-rev .wf4__bar { background: #5d7a8c; }
.wf4__row.is-var .wf4__bar { background: #e0a526; }
.wf4__row.is-fix .wf4__bar { background: #a8692a; }
.wf4__row.is-sum.is-pos .wf4__bar { background: var(--q-good); }
.wf4__row.is-sum.is-neg .wf4__bar { background: var(--q-critical); }
.wf4__row.is-later .wf4__bar { opacity: .6; background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .45) 0 3px, transparent 3px 7px); }
.wf4__v { text-align: right; font-weight: 700; color: var(--q-ink); }
.wf4__v.is-pos { color: var(--q-good-ink); }
.wf4__v.is-neg { color: var(--q-critical-ink); }
@media (max-width: 720px) {
  .wf4 { width: calc(100% - 2rem); padding: .9rem 1rem; }
  .wf4__row { grid-template-columns: 1fr auto; gap: .25rem .75rem; }
  .wf4__t { grid-column: 1 / -1; grid-row: 2; }
  .res4__modes li { grid-template-columns: 1fr; }
  .res4__k dd { text-align: right; }
}

.wf4__ht { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .75rem; }
.wf4__ht b { font-size: var(--q-text-md); }
.wf4__ht small { color: var(--q-ink-3); }
.wf4__row.is-closing.is-later { background: transparent; border: 2px dashed color-mix(in srgb, var(--q-ink-3) 55%, transparent); }
.wf4__row.is-later .wf4__bar, .wf4__row.is-later.is-sum .wf4__bar { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .7) 0 3px, transparent 3px 7px); }

/* results: the four result cards come first, as a grid; on a phone the live totals stay in view while the prices are edited */
.res4__cards--top .res4__card--with { grid-column: auto; }
.res4__live { display: none; }
@media (max-width: 720px) {
  .res4__live { display: flex; gap: .6rem; position: sticky; top: 3.5rem; z-index: 4; padding: .55rem .8rem; border-radius: 12px 12px 0 0; background: var(--q-basalt); color: #fff; }
  .res4__live span { flex: 1; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
  .res4__live small { color: rgba(255, 255, 255, .72); }
  .res4__live b { font-size: 1.15rem; }
  .res4__live b.is-pos { color: #8fe08f; }
  .res4__live b.is-neg { color: #ff9f9f; }
}

/* the plant-balance verdict: centred, a verdict first and the two durations it compares */
.res4__balance { flex-direction: column; align-items: center; gap: .6rem; padding: 1.1rem 1.25rem 1.2rem; border: 1px solid transparent; border-radius: 16px; text-align: center; font-weight: 500; }
.res4__balance.is-ok { border-color: color-mix(in srgb, var(--q-good) 30%, transparent); }
.res4__balance.is-warn { border-color: color-mix(in srgb, var(--q-warning) 35%, transparent); }
.res4__balance.is-bad { border-color: color-mix(in srgb, var(--q-critical) 30%, transparent); }
.res4__bicon { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: currentColor; }
.res4__bicon .q-icon { width: 1.3rem; height: 1.3rem; margin: 0; color: #fff; }
.res4__balance > b { font-size: var(--q-text-lg); font-weight: 700; }
.res4__bfacts { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.res4__bfacts span { display: flex; flex-direction: column; align-items: center; min-width: 11rem; padding: .45rem 1rem; border-radius: 12px; background: rgba(255, 255, 255, .72); }
.res4__bfacts small { color: var(--q-ink-2); font-weight: 500; }
.res4__bfacts em { font-style: normal; font-size: 1.25rem; font-weight: 700; }
.res4__balance > p { margin: 0; font-weight: 500; }
@media (max-width: 720px) { .res4__bfacts span { min-width: 0; flex: 1 1 8rem; } }

/* the four result cards share one look; chips are light */
.res4__delta { background: var(--q-surface-sunk); color: var(--q-ink-2); }
.res4__cards--top .res4__card dl { align-items: end; }
.wf4__hb.is-flat { cursor: default; }
.wf4__chev.is-blank { visibility: hidden; }
.res4__track { position: relative; height: 10px; border-radius: 5px; background: var(--q-surface-sunk); }
.res4__track .res4__bar { position: absolute; top: 0; height: 10px; background: var(--q-line, #dcdad3); }
.res4__modes-sum { padding-top: .5rem; border-top: 1px solid var(--q-line, #e4e2db); }
.res4__modes-sum b { font-weight: 700; }
.res4__legend { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.2rem; width: calc(min(100%, 76rem) - 3.5rem); margin: 0 auto .9rem; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.res4__legend span { display: inline-flex; align-items: center; gap: .4rem; }
.res4__legend i { width: 1.4rem; height: 10px; border-radius: 5px; }
.res4__legend i.is-run { background: var(--q-accent); }
.res4__legend i.is-idle { background: var(--q-line, #dcdad3); }
.res4__legend small { flex-basis: 100%; color: var(--q-ink-3); }
@media (max-width: 720px) { .res4__legend { width: calc(100% - 2rem); } }
@media (min-width: 721px) {  /* plant hours: the bars take all the width the labels and figures leave */
  .res4__modes { display: grid; grid-template-columns: max-content 1fr max-content; column-gap: 1.2rem; row-gap: .7rem; }
  .res4__modes li { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; }
  .res4__modes small { text-align: right; white-space: nowrap; }
}
.res4__modes .res4__track { background: none; }
.res4__balance > .res4__scale { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem 1rem; font-size: var(--q-text-sm); opacity: .85; }
.res4__bfacts i { font-style: normal; font-size: var(--q-text-xs, .75rem); font-weight: 500; color: var(--q-ink-2); min-height: 1em; }
.wf4__row.is-closing.is-rev { background: color-mix(in srgb, #5d7a8c 14%, transparent); }
.wf4__row.is-closing.is-rev.is-later { background: transparent; }
.wf4__row.is-closing.is-rev .wf4__l { color: var(--q-ink); font-weight: 700; }
.res4__scale:empty { display: none; }
.wf4__hb.is-flat { display: block; padding: 0; }
.wf4__hb.is-flat small { display: block; }

/* ---- Compact result: a slim verdict, the four scenarios as one table, then the details in tabs ---- */
.res4__tabs { width: calc(min(100%, 76rem) - 3.5rem); margin: 1.1rem auto 1rem; }
.res4__tabs button { background: none; border: 0; border-bottom: 3px solid transparent; font: inherit; font-weight: 600; font-size: var(--q-text-base); cursor: pointer; }
.res4__tabs button[aria-selected="true"] { color: var(--q-ink); border-bottom-color: var(--q-accent); }
.res4__tabs button:focus-visible { outline: 2px solid var(--q-basalt); outline-offset: -2px; border-radius: 6px; }
.res4__pane[hidden] { display: none; }
.res4__pane > .res4__sec { margin-top: 0; }
.res4__bnote { display: contents; }
@media (max-width: 720px) {
  .res4__tabs { width: calc(100% - 2rem); gap: 1rem; overflow-x: visible; }
  .res4__tabs > button { flex: 1 1 0; min-width: 0; white-space: normal; text-align: center; line-height: 1.25; padding-inline: .2rem; }
}
.res4__card h3 { margin-bottom: .9rem; }
.res4__modes-head b { font-weight: 500; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.res4__modes-head { margin-bottom: -.3rem; }
.res4__card h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res4__balance { gap: .3rem; padding: .8rem 1.25rem .9rem; }
.res4__balance > .res4__scale { font-size: var(--q-text-base); }
.glpk__files { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem 1.5rem; width: calc(min(100%, 76rem) - 3.5rem); margin: 0 auto; }
.glpk__file { display: flex; flex-direction: column; gap: .4rem; font-weight: 600; }
.glpk__file small { font-weight: 400; color: var(--q-ink-2); }
.glpk__kpis { display: flex; flex-wrap: wrap; gap: .75rem 2.5rem; width: calc(min(100%, 76rem) - 3.5rem); margin: 0 auto 1rem; }
.glpk__kpis div { display: flex; flex-direction: column; }
.glpk__kpis dt { font-size: var(--q-text-sm); color: var(--q-ink-2); font-weight: 400; }
.glpk__kpis dd { margin: 0; font-size: var(--q-text-lg); font-weight: 700; }
.glpk__tablewrap { width: calc(min(100%, 76rem) - 3.5rem); margin: 0 auto; overflow-x: auto; }
.glpk__table { width: 100%; border-collapse: collapse; font-size: var(--q-text-sm); }
.glpk__table th, .glpk__table td { padding: .4rem .6rem; border-bottom: 1px solid var(--q-line, rgba(0, 0, 0, .1)); text-align: left; font-weight: 400; }
.glpk__table thead th { font-weight: 600; color: var(--q-ink-2); }
.glpk__table tbody th { font-weight: 600; }
.glpk__num { text-align: right !important; font-variant-numeric: tabular-nums; }
.glpk__log { width: calc(min(100%, 76rem) - 3.5rem); margin: 1rem auto 0; font-size: var(--q-text-sm); }
.glpk__log pre { max-height: 20rem; overflow: auto; padding: .75rem; background: rgba(0, 0, 0, .05); border-radius: 8px; white-space: pre-wrap; }

/* ---- S4P result: the details (tabs) are a band of their own under the cards ---- */
/* the tabs are the P4P ones (.res__tabs), lined up on the cards */
.res4__details { margin: 1.75rem -1.25rem 0; }
.res4 .res4__tabs {
  /* the same tabs as P4P (underline, no band), lined up on the cards above */
  width: calc(min(100%, 76rem) - 3.5rem); margin: 0 auto; padding: 0; box-sizing: border-box;
  background: none; border-top: 0;
}
.res4__details > .res4__pane { padding-top: 1.5rem; }

/* ---- S4P customer review ---- */
/* The calculation strip above the table: when it was worked out on the left, the Recalculate button on the right */
.rv__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; margin: 0 0 1rem; padding: .4rem .5rem .4rem 1rem; border: 1px solid var(--q-line); border-radius: var(--q-r-ctrl); background: color-mix(in srgb, var(--q-surface-sunk) 50%, var(--q-surface)); }
.rv__state { display: flex; align-items: center; gap: .6rem; margin: 0; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.rv__state .q-icon { flex: none; width: 1rem; height: 1rem; color: var(--q-ink-3); }
.rv__bar .btn { flex: none; margin-left: auto; }
/* A review that has to be calculated (or is being) is a message with its button, not a quiet strip */
.rv__bar.is-todo, .rv__bar.is-run { padding: .75rem .75rem .75rem 1.1rem; }
.rv__bar.is-todo { background: var(--q-warning-soft); border-color: color-mix(in srgb, var(--q-warning) 35%, transparent); color: var(--q-warning-ink); }
.rv__bar.is-run { background: var(--q-surface-sunk); }
.rv__msg { display: grid; gap: .1rem; min-width: 0; }
.rv__msg b { font-weight: 600; }
.rv__msg span { font-size: var(--q-text-sm); opacity: .85; }
.rv__progress { margin: 0 0 1rem; color: var(--q-ink-2); font-weight: 500; }
.q-table thead th.rv__group { text-align: center; border-bottom: 1px solid var(--q-line-strong); font-weight: 600; white-space: normal; }
.res__margins thead th[rowspan], .res__costs thead th[rowspan] { vertical-align: middle; }
.rv__table .res__tip { margin-left: .25rem; }
.rv__table .res__unit { display: block; font-weight: 400; }
.rv__thin { color: var(--q-warning-ink); display: inline-flex; align-items: center; gap: .25rem; font-weight: 600; }
.rv__ok { color: var(--q-good-ink); display: inline-flex; align-items: center; gap: .25rem; font-weight: 600; }
.rv__ok .q-icon, .rv__thin .q-icon { width: .85rem; height: .85rem; }
.rv__error { color: var(--q-ink-2); white-space: normal; }
.rv__prod { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; max-width: 11rem; margin: .25rem 0 0 auto; overflow: hidden; overflow-wrap: anywhere; text-align: center; font-size: var(--q-text-xs); font-weight: 400; color: var(--q-ink-3); line-height: 1.3; }
.rv__fit + .rv__fit { margin-left: .25rem; }
.rv__fit { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; padding: .15rem .65rem .15rem .5rem; border-radius: var(--q-r-pill); font-size: var(--q-text-sm); font-weight: 500; line-height: 1.5; }
.rv__fit .q-icon { width: .95rem; height: .95rem; }
.rv__fit.is-gold  { background: #f8e7a6; color: #5c4300; }
.rv__fit.is-green { background: var(--q-good-soft); color: var(--q-good-ink); }
.rv__fit.is-red   { background: var(--q-critical-soft); color: var(--q-critical-ink); }
.rv__fit.is-amber { background: var(--q-warning-soft); color: var(--q-warning-ink); }
.rv__fit.is-grey  { background: #4a0d12; color: #fff; }
.rv__table .rv__fit { font-size: .75rem; padding: .05rem .4rem .05rem .3rem; gap: .25rem; line-height: 1.4; }
.rv__table .rv__fit .q-icon { width: .7rem; height: .7rem; }
.rv__error .q-icon { width: 1rem; height: 1rem; vertical-align: -.15rem; }
@media (max-width: 720px) { .rv__bar { align-items: flex-start; } }

/* Saving a result: name it, keep it for the quarry */
.res4__save { scroll-margin-top: 4.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; width: calc(min(100%, 76rem) - 3.5rem); margin: 1.1rem auto 1rem; padding: .85rem 1.25rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.res4__save-ico { display: grid; place-items: center; flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--q-basalt); color: #fff; }
.res4__save-ico .q-icon { width: 1.1rem; height: 1.1rem; }
.res4__save input { flex: 1 1 16rem; min-width: 0; padding: .7rem 1rem; border: 1px solid transparent; border-radius: 12px; background: var(--q-surface-sunk); font: inherit; font-size: var(--q-text-md); color: var(--q-ink); }
.res4__save input::placeholder { color: var(--q-ink-3); }
.res4__save input:focus-visible { outline: 0; border-color: var(--q-basalt); background: var(--q-surface); box-shadow: 0 0 0 3px rgba(27, 36, 39, .12); }
.res4__save-btn { flex: none; padding: .7rem 1.5rem; border: 0; border-radius: 12px; background: var(--q-accent); color: var(--q-ink); font: inherit; font-weight: 700; cursor: pointer; }
.res4__save-btn:hover:not(:disabled) { filter: brightness(1.06); }
.res4__save-btn:disabled { opacity: .6; cursor: wait; }
.res4__save small { flex: 1 1 100%; padding-left: 3.4rem; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.res4__save small:empty { display: none; }
.res4__save small a { color: var(--q-ink-2); font-weight: 600; }
@media (max-width: 720px) { .res4__save { width: calc(100% - 2rem); } .res4__save small { padding-left: 0; } }

/* Saved evaluations: the pencil beside a name, and the field that replaces the name while editing */
.ev__name { white-space: nowrap; }
.ev__edit { border: 0; background: transparent; color: var(--q-ink-3); padding: .25rem; margin-left: .35rem; border-radius: .4rem; cursor: pointer; line-height: 0; vertical-align: middle; }
.ev__edit .q-icon { width: 1rem; height: 1rem; }
.ev__edit:hover:not(:disabled), .ev__edit:focus-visible { color: var(--q-ink); background: var(--q-surface-2, rgba(0, 0, 0, .06)); }
.ev__edit:disabled { opacity: .35; cursor: not-allowed; }
.ev__input { font: inherit; font-weight: 600; width: min(22rem, 90%); padding: .3rem .55rem; border: 1px solid var(--q-line-strong, #c9cfcb); border-radius: .5rem; background: #fff; color: var(--q-ink); }
.ev__input:focus { outline: 2px solid var(--q-gold, #d9a73e); outline-offset: 1px; }
.ev__err { color: var(--q-critical-ink); margin-left: .5rem; font-weight: 400; }
.ev__actions { white-space: nowrap; text-align: right; }
.ev__actions form { display: inline; }
.ev__actions .ev__edit { margin-left: 0; }
/* Saved evaluations: the name gets the room, the four margin columns stay compact */
#ev-table tbody th.ev__name, #ev-table thead th.res__name { width: 18rem; min-width: 14rem; white-space: nowrap; }
#ev-table .ev__title a { overflow: hidden; text-overflow: ellipsis; max-width: 15rem; }
#ev-table thead tr + tr th { width: 6.25rem; min-width: 0; padding-left: .25rem; padding-right: .25rem; }
#ev-table tbody td.num { padding-left: .25rem; padding-right: .25rem; }
#ev-table tbody td.num:nth-child(n+4):nth-child(-n+7) { width: 6.25rem; }
.stk4__dyn:empty { display: none; }
.stk4__key { display: grid; gap: .3rem; font-weight: 600; }
.stk4__legend, .stk4__line2 { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.stk4__legend > span, .stk4__assumed > span { white-space: nowrap; }
.stk4__assumed { display: inline-flex; align-items: center; gap: .35rem; }
.stk4__assumed[hidden] { display: none; }
.stk4__line2:not(:has(*:not([hidden]))) { display: none; }
/* room on the right of the bar for the last tonnage and revenue when the green runs far right */
.stk4__track, .stk4__seg { margin-right: 5.5rem; }
.stk4__seg span.is-last { overflow: visible; text-overflow: clip; }
.stk4__reset { display: inline-flex; align-items: center; gap: .3rem; margin-left: auto; padding: .1rem .5rem .1rem .4rem; font-weight: 600; }
.stk4__reset .q-icon { width: .8rem; height: .8rem; }
/* the first and the last line follow the rounded corners of the card, so the coloured edge curves with them */
.stk4:not(.stk4 ~ .stk4) { border-top-left-radius: 13px; }
.stk4:not(:has(~ .stk4)) { border-bottom-left-radius: 13px; }
/* the stock tab: the explanation and the products are two cards of their own */
.res4__stock { gap: 1rem; border: 0; border-radius: 0; background: none; box-shadow: none; }
.res4 .res4__stock > .deal__head, .res4__list { border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.res4 .res4__stock > .deal__head { padding: 1.1rem 1.25rem; }
.res4__list { display: flex; flex-direction: column; }

/* saved evaluations: picking two to compare, and the comparison page */
.ev__title { display: inline-flex; align-items: center; }
.ev__pick { appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; flex: none; width: 1.4rem; height: 1.4rem; margin: 0 .7rem 0 0; border: 2px solid var(--q-line-strong); border-radius: 7px; background: var(--q-surface); cursor: pointer; transition: background .12s, border-color .12s, transform .12s; }
.ev__pick:hover { border-color: var(--q-ink-2); }
.ev__pick:active { transform: scale(.92); }
.ev__pick:focus-visible { outline: 2px solid var(--q-accent); outline-offset: 2px; }
.ev__pick:checked { border-color: var(--q-basalt); background: var(--q-basalt); }
.ev__pick:checked::after { content: "✓"; color: #fff; font-size: .8rem; font-weight: 700; line-height: 1; }
.ev__pick:checked[data-letter]::after { content: attr(data-letter); font-size: .75rem; }
.rv__table tbody tr:has(.ev__pick:checked) > th, .rv__table tbody tr:has(.ev__pick:checked) > td { background: color-mix(in srgb, var(--q-accent) 12%, var(--q-surface)); }
@media (prefers-reduced-motion: reduce) { .ev__pick { transition: none; } }
.ev__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; padding: .5rem .9rem; border: 1px solid var(--q-line); border-radius: 12px; background: var(--q-surface-sunk); color: var(--q-ink-2); font-size: var(--q-text-sm); }
.ev__bar .btn.disabled { pointer-events: none; opacity: .5; }
.cmp__back { margin: 0 0 .75rem; font-size: var(--q-text-sm); }
.cmp__heads { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.cmp__head { padding: 1rem 1.25rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); }
.cmp__head small { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--q-basalt); color: #fff; font-weight: 600; }
.cmp__head h2 { margin: .5rem 0 .25rem; font-size: var(--q-text-lg); }
.cmp__head p { margin: 0; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.cmp__title { margin: 1.5rem 0 .6rem; font-size: var(--q-text-md); }
.cmp__up { color: var(--q-good-ink); font-weight: 600; }
.cmp__down { color: var(--q-critical-ink); font-weight: 600; }
.cmp__same { color: var(--q-ink-3); }
.cmp__diff { background: var(--q-warning-soft); }
.cmp__table .stk4__x { margin-left: 0; }
.cmp__board .wf4 { width: auto; margin: 0 0 1rem; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.cmp__board .wf4__row { grid-template-columns: minmax(7rem, 11rem) 1fr 6.5rem; gap: .6rem; }
.cmp__boards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.cmp__board { min-width: 0; padding: 1rem 1.25rem 1.1rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); }
.cmp__board h4 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .75rem; font-size: var(--q-text-md); font-weight: 600; }
.cmp__badge { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--q-basalt); color: #fff; font-size: var(--q-text-xs); font-weight: 600; }
.cmp__cards { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.cmp__card { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; min-width: 0; padding: .7rem .85rem; border: 1px solid var(--q-line); border-radius: 12px; background: var(--q-surface-sunk, transparent); }
.cmp__card small { color: var(--q-ink-3); font-size: var(--q-text-xs); }
.cmp__card strong { font-size: var(--q-text-lg); font-variant-numeric: tabular-nums; }
.cmp__card .cmp__up, .cmp__card .cmp__down, .cmp__card .cmp__same { font-size: var(--q-text-xs); }
@media (max-width: 900px) { .cmp__boards { grid-template-columns: 1fr; } }
.cmp__table th.res__name { width: 30%; min-width: 11rem; }
.cmp__table th.cmp__sub { padding-left: 1.5rem; font-weight: 400; }
.cmp__table tr.cmp__group th { padding-top: .9rem; background: transparent; color: var(--q-ink-2); font-size: var(--q-text-sm); font-weight: 600; text-align: left; white-space: normal; }
.cmp__table tr.cmp__verdict th, .cmp__table tr.cmp__verdict td { border-top: 2px solid var(--q-line-strong); }
.cmp__table thead th.cmp__grouphead { text-align: center; border-bottom: 1px solid var(--q-line-strong); }
.cmp__sum { margin-top: .9rem; padding-top: .6rem; border-top: 1px solid var(--q-line); font-size: var(--q-text-sm); }
.cmp__sumhead, .cmp__sumrow { display: grid; grid-template-columns: minmax(0, 1fr) 4.8rem 5.4rem 5.6rem; gap: .25rem .6rem; align-items: center; }
.cmp__sumhead { padding-bottom: .25rem; white-space: nowrap; color: var(--q-ink-3); font-size: var(--q-text-xs); }
.cmp__sumhead span:nth-child(n+2), .cmp__sumrow > span, .cmp__sumrow > b { text-align: right; font-variant-numeric: tabular-nums; }
.cmp__sumrow { padding: .4rem 0; border-top: 1px dashed var(--q-line); }
.cmp__sumn { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.cmp__sumname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cmp__sumn i { display: block; height: 4px; width: max(var(--w), 3px); border-radius: 2px; background: var(--q-accent); }
.cmp__sumrow--total { padding-top: .5rem; border-top: 1px solid var(--q-line); font-size: var(--q-text-sm); }
.cmp__sumrow--total .cmp__sumn { flex-direction: row; }
.cmp__prod { display: block; margin-top: .25rem; font-size: var(--q-text-xs); color: var(--q-ink-3); }
@media (max-width: 700px) { .cmp__heads { grid-template-columns: 1fr; } }

/* comparison: the sections of Deal impact, A and B side by side */
.cmp__pairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: .5rem; }
.cmp .res4__balance { position: relative; width: auto; margin: 0; }
.cmp .res4__card { min-width: 0; }
.cmp__rc h3 { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; font-size: var(--q-text-md); }
.cmp__rc .res4__k dd { font-size: 1.35rem; }
.cmp__rc .res4__k dt { font-size: var(--q-text-sm); }
.cmp__rc dl { gap: .75rem 1rem; }
.cmp__rc .res4__chips { margin-top: .9rem; }
.cmp__badge--corner { position: absolute; top: .7rem; left: .8rem; }
.cmp__fitrow { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1.25rem; }
.cmp__fitrow > div { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; min-width: 0; }
.cmp__fitrow small { color: var(--q-ink-3); font-size: var(--q-text-xs); }
.cmp__fit .cmp__up, .cmp__fit .cmp__down, .cmp__fit .cmp__same { font-size: var(--q-text-xs); }
.cmp__stock { display: flex; flex-direction: column; padding: .4rem 1.25rem; border: 1px solid var(--q-line); border-radius: 14px; background: var(--q-surface); box-shadow: var(--q-shadow-card); }
.cmp__legend { padding: .6rem 0 .2rem; }
.cmp__prodrow { padding: .9rem 0; border-top: 1px dashed var(--q-line); }
.cmp__prodname b { font-weight: 600; margin-right: .45rem; }
.cmp__prodcells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 2rem; margin-top: .55rem; }
.cmp__prodcells > div { position: relative; min-width: 0; padding-left: 1.9rem; }
.cmp__prodcells > div > .cmp__badge { position: absolute; left: 0; top: 0; }
.cmp__made { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.cmp__made .stk4__x { margin-left: 0; }
.cmp .stk4__track { cursor: default; touch-action: auto; }
.cmp__facts { display: flex; flex-direction: column; gap: .1rem; margin: .45rem 0 0; color: var(--q-ink-3); font-size: var(--q-text-xs); }
.cmp__none { margin: 0; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.cmp .cmp__modeslegend { width: auto; margin: 0 0 .75rem; }
.cmp__board .res4__modes { width: auto; margin: 0; }
@media (max-width: 900px) {
  .cmp__pairs { grid-template-columns: 1fr; }
  .cmp__prodcells { grid-template-columns: 1fr; }
}

/* ---- Home page: key figures, what needs a look, the quarries -------------------------------- */
.q-home__currency { font-size: var(--q-text-lg); margin: 0 0 .25rem; }
.q-home__window { margin: 0 0 .75rem; font-size: var(--q-text-sm); }
.q-home__h2 { font-size: var(--q-text-lg); margin: 0 0 .75rem; }
.q-home__wait { display: flex; align-items: center; gap: .75rem; }
.q-home__wait form { margin-left: auto; }
.q-home__cols { display: grid; gap: 1rem; margin-bottom: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .q-home__cols { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } }
.q-home__cols .q-panel { margin: 0; }
.q-home__cols h2 { font-size: var(--q-text-lg); margin: 0; }
.q-home__all { display: inline-block; margin-top: .75rem; font-size: var(--q-text-sm); }
.q-home__refresh { margin-top: 1.5rem; }
.q-home__table .q-home__name { text-align: left; }
.q-home__table th.q-home__name { font-weight: 600; }
.q-home__region th { text-align: left; background: var(--q-surface-sunk); font-weight: 600; padding: .5rem .9rem; border-bottom: 1px solid var(--q-line); }
.q-home__region small { color: var(--q-ink-3); font-weight: 400; margin-left: .35rem; }

.q-alertgroup { border-bottom: 1px solid var(--q-line); }
.q-alertgroup:last-child { border-bottom: 0; }
.q-alertgroup > summary { display: flex; align-items: center; gap: .75rem; padding: .75rem 0; cursor: pointer; list-style: none; }
.q-alertgroup > summary::-webkit-details-marker { display: none; }
.q-alertgroup > summary:focus-visible { outline: 2px solid var(--q-focus, currentColor); outline-offset: 2px; }
.q-alertgroup__icon { flex: none; display: inline-flex; color: var(--q-serious-ink); }
.q-alertgroup.is-good .q-alertgroup__icon { color: var(--q-good-ink); }
.q-alertgroup.is-data .q-alertgroup__icon { color: var(--q-warning-ink); }
.q-alertgroup__icon .q-icon { width: 1.2rem; height: 1.2rem; }
.q-alertgroup__title { flex: 1; min-width: 0; font-weight: 600; }
.q-alertgroup__title small, .q-alertgroup__sum small { display: block; font-weight: 400; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.q-alertgroup__sum { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-alertlist { list-style: none; margin: 0 0 .75rem; padding: 0; }
.q-alertlist li { display: flex; align-items: center; gap: .75rem; padding: .45rem 0 .45rem 2rem; border-top: 1px solid var(--q-line); }
.q-alertlist__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.q-alertlist__sum { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.q-alertlist__sum.is-loss { color: var(--q-critical-ink); }
.q-alertlist__more { padding-top: .5rem; }
.q-home__dealist { margin-top: 1rem; }
.q-home__dealist li { padding-left: 0; }
.q-open { margin: 0; }
.q-open__btn { background: none; border: 0; padding: .15rem .25rem; color: var(--q-link, var(--bs-link-color)); font: inherit; font-size: var(--q-text-sm); text-decoration: underline; cursor: pointer; white-space: nowrap; }
.q-open__btn:hover { text-decoration: none; }
.q-home .q-kpi__figure { flex-wrap: nowrap; align-items: baseline; }
.q-home .q-kpi__value { font-size: clamp(1.6rem, 6vw, 2.1rem); white-space: nowrap; }
.q-home .q-kpi__unit { white-space: nowrap; }

/* Plant set-up: keep the top of the page short so the modes table has room on a laptop. */
.s4p__fig .s4p__figbox input { font-size: 1.05rem; padding: .25rem .4rem; width: 4rem; }
.s4p__fig .s4p__figbox input[data-fig="hours"] { width: 5rem; }
.s4p--plant .cst__head { padding: .6rem 1.25rem .1rem; }
.s4p--plant .cst__panel .deal__how--wide { margin: .35rem 1.25rem .5rem; }
.s4p--plant .deal__how summary { padding: .5rem 1rem; }
.s4p--plant .cst__bar { padding: .35rem 1.25rem; }
.s4p--plant .s4p__recipes { margin-top: .75rem; }
.s4p--plant .s4p__addmode .form-control { padding-top: .3rem; padding-bottom: .3rem; }
.s4p--plant .cst__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.s4p--plant .cst__head h2 { margin: 0; }
.s4p__headtools { display: flex; align-items: center; gap: .75rem; }
.s4p--plant .s4p__headtools .s4p__add { margin: 0; }
/* Product recipes: title and tools on one line, smaller raw-product pills. */
.s4p__rawpanel > header, .s4p__recipes > .cst__head { display: flex; align-items: center; justify-content: space-between; gap: .25rem 1rem; flex-wrap: wrap; }
.s4p__rawpanel > header h2, .s4p__recipes > .cst__head h2 { margin: 0; }
.s4p__rawpanel > header p, .s4p__recipes > .cst__head p { flex-basis: 100%; margin: 0; }
.s4p__headtools .s4p__add input { max-width: 12rem; }
.s4p__raws { justify-content: flex-start; gap: .35rem; margin: .5rem 0 .25rem; }
.s4p__raw { padding: 0 .25rem 0 .6rem; font-size: var(--q-text-sm); }
.s4p__rename input { width: 5.5rem; padding: .15rem 0; }
.s4p__rawpanel { padding-bottom: .75rem; }
.s4p__headtools .s4p__add { margin: 0; }

/* Quarry home: the last month and the last 12 months of production and sales */
.mf { margin-bottom: 1.25rem; }
.mf .q-kpis { margin-bottom: 1.25rem; }
.mf__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
.mf__title { margin: 0; font-size: var(--q-text-md); }
.mf__legend { display: inline-flex; gap: 1rem; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.mf__legend > span { display: inline-flex; align-items: center; gap: .35rem; }
.mf__key { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; }
.mf__key.is-produced, .mf__bar.is-produced { background: var(--q-s1); }
.mf__key.is-sold, .mf__bar.is-sold { background: var(--q-s2); }
.mf__hint { margin: .15rem 0 .9rem; font-size: var(--q-text-sm); }
.mf__chart { display: flex; gap: .6rem; }
.mf__axis { flex: 0 0 3.2rem; display: flex; flex-direction: column; justify-content: space-between; height: 11rem; font-size: var(--q-text-xs); color: var(--q-ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.mf__plot { flex: 1 1 0; min-width: 0; }
.mf__bars { display: flex; align-items: flex-end; gap: .6rem; height: 11rem; border-bottom: 1px solid var(--q-line-strong); background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), var(--q-line) calc(25% - 1px), var(--q-line) 25%); }
.mf__col { flex: 1 1 0; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.mf__bar { display: block; width: 42%; max-width: 1.6rem; border-radius: 3px 3px 0 0; min-height: 1px; }
.mf__labels { display: flex; gap: .6rem; }
.mf__labels span { flex: 1 1 0; text-align: center; font-size: var(--q-text-xs); color: var(--q-ink-3); padding-top: .35rem; }
.mf__table { margin-top: 1rem; }
.mf__table summary { cursor: pointer; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.mf__table .q-table-wrap { margin-top: .5rem; }

/* Quarry home: cost per tonne of each P&L line */
.cl { margin-bottom: 1.25rem; }
.cl__hint { margin: 0 0 .75rem; font-size: var(--q-text-sm); }
.cl__table thead th:first-child, .cl__table th.cl__name { text-align: left; }
.cl__table th.cl__name { font-weight: 600; white-space: normal; }
.cl__table .cl__trend { width: 8rem; text-align: center; }
.cl__spark { display: block; margin: 0 auto; }
.cl__spark polyline { fill: none; stroke: var(--q-s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cl__spark circle { fill: var(--q-s1); stroke: var(--q-surface); stroke-width: 2; }
.cl__table td.num small { font-weight: 400; color: var(--q-ink-3); }
.cl__more[hidden] { display: none; }
.cl__toggle { margin-top: .75rem; }
.cl__now { white-space: nowrap; }
.cl__unit { font-size: var(--q-text-xs); color: var(--q-ink-3); }
/* Main customers: the chevron that unfolds the products of a customer */
.cu__chev { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin: 0 .35rem 0 -.25rem; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--q-ink-3); cursor: pointer; vertical-align: middle; }
.cu__chev:hover, .cu__chev:focus-visible { background: var(--q-surface-sunk); color: var(--q-ink); }
.cu__chev .q-icon { width: 1rem; height: 1rem; transition: transform .15s; transform: rotate(-90deg); }
.cu__chev[aria-expanded="true"] .q-icon { transform: none; }
.cu__sub[hidden] { display: none; }
.cu__sub > th, .cu__sub > td { background: var(--q-surface-sunk); font-size: var(--q-text-xs); color: var(--q-ink-2); }
.cu__sub th.cu__prod { padding-left: 2.6rem; font-weight: 400; }
.cu__sub td.num strong { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .cu__chev .q-icon { transition: none; } }

/* Quarry home: revenue and margin of the last 12 months, side by side */
.tr { display: block; margin: 0 0 1.25rem; min-width: 0; }
.tr--volumes { margin-top: 1.25rem; }
.tr__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; margin-bottom: .9rem; }
.tr__title { margin: 0; font-size: var(--q-text-md); }
.tr__stats { display: flex; flex-wrap: wrap; gap: .5rem 2.25rem; margin: 0; }
.tr__stats > div { display: flex; flex-direction: column; gap: .1rem; }
.tr__stats dt { display: flex; align-items: center; gap: .45rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }
.tr__stats dd { display: flex; align-items: baseline; gap: .6rem; margin: 0; font-size: 1.25rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr__key .tr__avg { margin-left: -1.05rem; gap: .45rem; color: var(--q-ink-3); }
.tr__avg::before { content: "·"; order: -2; }
.tr__zeroline { position: absolute; left: 0; right: 0; height: 0; pointer-events: none; }
.tr__zeroline { border-top: 1px solid var(--q-line-strong); }
.tr__avg strong { margin-left: -.2rem; font-weight: 600; color: var(--q-ink); }
.tr__nomargin { margin: 0 0 .75rem; }
.tr__chart { margin-top: .25rem; }
.tr__chart .mf__axis, .tr__chart .tr__bars { height: 14rem; }
.tr__axis { flex-basis: 6.6rem; }
.tr__axis span { white-space: nowrap; }
.tr__bars { position: relative; display: flex; gap: 0; border-bottom: 1px solid var(--q-line-strong); background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), var(--q-line) calc(25% - 1px), var(--q-line) 25%); }
.tr__zero { position: absolute; left: 0; right: 0; height: 1px; background: var(--q-line-strong); z-index: 1; }
.tr__col { position: relative; flex: 1 1 0; height: 100%; }
.tr__bar { position: absolute; width: 33%; min-height: 1px; border-radius: 3px; }
.tr__bar.is-revenue { left: 14%; background: var(--q-s2); opacity: .8; }
.tr__bar.is-margin { left: 53%; background: var(--q-s1); opacity: .9; }
.tr__bar.is-produced { left: 14%; background: var(--q-s1); opacity: .85; }
.tr__bar.is-sold { left: 53%; background: var(--q-s2); opacity: .8; }
.tr__bar.is-neg { background: var(--q-critical-ink); }
.tr__chart .mf__labels .is-last { font-weight: 600; color: var(--q-ink); }
/* margin % of the months: dots on a line, own scale, aligned under the month columns */
.tr__strip { position: relative; height: 6.5rem; margin-top: 1.25rem; color: var(--q-ink-3); border-top: 1px solid var(--q-line); }
.tr__strip svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; opacity: .6; }
.tr__dot { position: absolute; width: 0; height: 0; }
.tr__dot i { position: absolute; width: .55rem; height: .55rem; margin: -.275rem 0 0 -.275rem; border-radius: 50%; background: var(--q-ink-2); box-shadow: 0 0 0 2px var(--q-surface, #fff); }
.tr__dot b { position: absolute; bottom: .5rem; left: 0; transform: translateX(-50%); font-size: var(--q-text-sm); font-weight: 600; color: var(--q-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr__key { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; align-items: center; margin: .9rem 0 0; font-size: var(--q-text-sm); color: var(--q-ink-3); }
.tr__key > span { display: inline-flex; align-items: center; gap: .45rem; }
.tr__keynote { margin-left: auto; }
.tr__swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; }
.tr__swatch.is-revenue { background: var(--q-s2); }
.tr__swatch.is-margin, .tr__swatch.is-produced { background: var(--q-s1); }
.tr__swatch.is-sold { background: var(--q-s2); }
.tr__swatch.is-line { width: .55rem; height: .55rem; border-radius: 50%; background: var(--q-ink-2); }
.tr__chart .mf__labels { gap: 0; }
/* the column under the pointer is tinted, like the month under the pointer in P4P */
.mf__col, .tr__col { border-radius: 4px; outline: none; }
.mf__col:hover, .tr__col:hover, .mf__col:focus-visible, .tr__col:focus-visible { background: color-mix(in srgb, var(--q-ink) 6%, transparent); }
.mf__col:focus-visible, .tr__col:focus-visible { box-shadow: inset 0 0 0 2px var(--q-accent); }
/* Quarry home: the month first, then a heading for the 12 months that follow */
.q-home__period { margin: 1.75rem 0 .75rem; }
.br { margin: 1.25rem 0 0; }
.br .q-table-wrap { border: 0; border-radius: 0; box-shadow: none; background: none; }
.br__table { --bs-table-bg: transparent; }
.br__table { table-layout: fixed; width: 100%; }
.br__table th:first-child { width: 11rem; }
.br__table th.num, .br__table td.num { width: 8.5rem; }
.br__table th, .br__table td { background: none; border: 0; padding: .5rem .75rem; vertical-align: middle; }
.br__table thead th { font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); text-transform: none; letter-spacing: 0; padding-bottom: .25rem; }
.br__table th[scope="row"] { text-align: left; font-weight: 400; white-space: nowrap; color: var(--q-ink-2); }
.br__row.is-total th[scope="row"], .br__row.is-total td.num { font-weight: 700; color: var(--q-ink); }
.br__row.is-total th, .br__row.is-total td { border-top: 1px solid var(--q-line); }
.br__row.is-total .br__pos { color: var(--q-good-ink); }
.br__share { width: 42%; min-width: 12rem; }
.br__bar { position: relative; display: inline-block; vertical-align: middle; width: calc(100% - 5.4rem); height: 1.05rem; margin-right: .6rem; }
.br__zero { position: absolute; top: -.2rem; bottom: -.2rem; width: 1px; background: var(--q-line-strong, var(--q-line)); }
.br__fill { position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 4px; }
.br__fill.is-revenue { background: #5d7a8c; }
.br__fill.is-variable { background: #e0a526; }
.br__fill.is-fixed { background: #a8692a; }
.br__fill.is-pos { background: var(--q-good); }
.br__fill.is-neg { background: var(--q-critical); }
.br__pos { color: var(--q-good-ink); }
.br__pct { display: inline-block; width: 4.6rem; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; color: var(--q-ink-2); }
.pf__scope { margin-left: .9rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }
.mf .q-kpis:last-child { margin-bottom: 0; }


/* Home, several quarries */
.pf__tools { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 1.25rem 0 .75rem; }
.pf__search { max-width: 18rem; }
.pf__note { margin: -.25rem 0 .75rem; font-size: var(--q-text-sm); }
.pf .tr { margin-top: 1.5rem; }
.q-home__alerts { margin-bottom: 1.5rem; }
.q-home__scope { margin-bottom: 1.25rem; }

.pf__hint { margin: .5rem 0 1.5rem; font-size: var(--q-text-xs); }
.pf__note { margin: -.25rem 0 .75rem; }
.pf__tools { margin-bottom: .75rem; gap: .5rem; }
/* a little more air in the quarries table */

/* ---- Month slider (Home, several quarries): one tick per month, frame = month shown ----------- */
.pf__time { margin: 1rem 0 1rem; }
.pf__time .q-panel__body { padding: .85rem 1.25rem .8rem; }
.pf__timehead { margin-bottom: .75rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.pf__timetext { display: grid; gap: .15rem; }
.pf__timetext strong { color: var(--q-ink); font-size: var(--q-text-md, 1rem); }
.pf__slider { margin: 0 0 .5rem; padding-bottom: 1.9rem; border-radius: 6px; }
/* no extra focus ring: the frame on the selected month already shows where the focus is */
.pf__slider:focus-visible { outline: none; }
.pf__slider .dp__tick.is-partial { background: color-mix(in srgb, var(--q-warning) 55%, var(--q-surface)); }
.pf__tip { position: absolute; bottom: calc(100% - .2rem); transform: translateX(-50%); white-space: nowrap; padding: .25rem .5rem; border-radius: 6px; background: var(--q-ink); color: var(--q-surface); font-size: var(--q-text-xs); pointer-events: none; z-index: 3; }
.pf__tip[hidden] { display: none; }
.pf__timekey { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; margin: 0; font-size: var(--q-text-xs); color: var(--q-ink-3); }
.pf__key { display: inline-block; width: .8rem; height: .8rem; margin-right: .3rem; border-radius: 2px; vertical-align: -1px; }
.pf__key.is-full { background: var(--q-good); }
.pf__key.is-partial { background: color-mix(in srgb, var(--q-warning) 55%, var(--q-surface)); }
.pf__key.is-window { width: 1.1rem; height: 4px; border-radius: 2px; background: var(--q-primary); vertical-align: middle; }
.pf__slider .dp__tick.is-off { background: repeating-linear-gradient(135deg, var(--q-surface-sunk) 0 3px, var(--q-surface) 3px 6px); cursor: not-allowed; }
/* month and year inside each tick */
.pf__slider { padding-bottom: 1rem; margin-bottom: .25rem; }
.pf__slider .dp__ticks { height: 2.35rem; }
.pf__slider .dp__tick { font-style: normal; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; color: var(--q-ink-2); overflow: hidden; }
.pf__slider .dp__tick b { font-size: var(--q-text-sm); font-weight: 600; }
.pf__slider .dp__tick small { font-size: var(--q-text-xs); opacity: .75; }
.pf__slider .dp__tick.is-off { color: var(--q-ink-3); }
.pf__slider .dp__tick.is-l3 { color: #fff; }
@media (max-width: 767px) { .pf__slider .dp__tick b, .pf__slider .dp__tick small { display: none; } }

.pf__slider .dp__tick { position: relative; overflow: visible; }
.pf__slider .dp__tick.is-in::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -11px; height: 4px; border-radius: 2px; background: var(--q-primary); }
.pf__slider .dp__tick.is-sel { border-color: var(--q-primary); box-shadow: inset 0 0 0 1px var(--q-primary); }
.pf__key.is-off { background: repeating-linear-gradient(135deg, var(--q-surface-sunk) 0 3px, var(--q-surface) 3px 6px); border: 1px solid var(--q-line); }
.pf__edge { flex: 1 1 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; border: 1px solid var(--q-line); border-radius: 2px; color: var(--q-ink-3); background: repeating-linear-gradient(135deg, var(--q-surface-sunk) 0 3px, var(--q-surface) 3px 6px); }
.pf__edge b { font-size: var(--q-text-sm); font-weight: 600; }
.pf__edge small { font-size: var(--q-text-xs); opacity: .75; }
.pf__gap { flex: 0 0 1.4rem; position: relative; display: grid; place-items: center; color: var(--q-ink-3); font-size: var(--q-text-md); letter-spacing: .05em; }
.pf__edge.is-in::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -11px; height: 4px; border-radius: 2px; background: var(--q-primary); }
/* no border on the gap, so its bar sits 1px lower and 1px wider than the cells' unless corrected */
.pf__gap.is-in::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 4px; border-radius: 2px; background: var(--q-primary); }
@media (max-width: 767px) { .pf__edge b, .pf__edge small { display: none; } .pf__gap { flex-basis: .8rem; } }
.pf__edge.is-idle { opacity: .55; }
.pf__gap.is-void { visibility: hidden; }
/* the arrows sit at the two ends of the strip, at the height of the cells */
.pf__strip { display: flex; align-items: flex-start; gap: .4rem; }
.pf__strip .pf__slider { flex: 1 1 auto; min-width: 0; }
.pf__arrow { flex: none; height: 2.35rem; width: 2rem; color: var(--q-ink-2); border: 1px solid var(--q-line); border-radius: 4px; background: var(--q-surface); }
.pf__arrow:hover:not(:disabled) { background: var(--q-surface-sunk); color: var(--q-ink); border-color: var(--q-line-strong); }
.pf__arrow:disabled { opacity: .35; cursor: default; }
.pf__arrow:focus-visible { outline: 2px solid var(--q-primary); outline-offset: 2px; }

/* Main customers / main products of the month, under the tiles and charts. */
.pf__top { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin: 1.5rem 0 2rem; }
.pf__toplist .q-table th.pf__topname,
.pf__toplist .q-table td.pf__topname { text-align: left; }
.pf__topmore { margin-top: .5rem; }
/* One line per row, so a row of one table sits level with the same row of the other. */
.pf__toptable { table-layout: fixed; }
.pf__toptable td { height: 3.25rem; }
.pf__topcol-quarry { width: 14%; }
.pf__topcol-num { width: 13%; }
.pf__topcol-money { width: 18%; }
.pf__topcol-share { width: 11%; }
.pf__toptable th, .pf__toptable td { padding-left: .6rem; padding-right: .6rem; }
.pf__toptable th:last-child, .pf__toptable td:last-child { padding-right: 1.1rem; }
.pf__topcell { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.pf__toptext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; display: block; }
.pf__topcell .q-code { flex: none; }
.pf__toplink { color: inherit; text-decoration: none; }
.pf__toplink:hover, .pf__toplink:focus-visible { text-decoration: underline; }
@media (max-width: 1100px) { .pf__top { grid-template-columns: minmax(0, 1fr); } }
.pf__rowtip { position: fixed; z-index: 1000; min-width: 13rem; max-width: 22rem; padding: .65rem .8rem; border-radius: var(--q-r-ctrl); background: var(--q-ink); color: #fff; font-size: var(--q-text-sm); line-height: 1.4; text-align: left; box-shadow: var(--q-shadow-pop); pointer-events: none; opacity: 0; transition: opacity .12s; }
.pf__rowtip.is-on { opacity: 1; }
.pf__rowtip-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.pf__rowtip-head strong { font-weight: 600; overflow-wrap: anywhere; }
.pf__rowtip .q-code { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; }
.pf__rowtip-quarry { color: rgba(255,255,255,.7); margin-bottom: .4rem; }
.pf__rowtip-line { display: flex; justify-content: space-between; gap: 1.5rem; font-variant-numeric: tabular-nums; }
.pf__rowtip-line span { color: rgba(255,255,255,.7); }
.pf__toplist td[data-pf-rowtip]:focus-visible { outline: 2px solid var(--q-primary); outline-offset: -2px; }

/* The quarries table: pick, name and state, 12-month margin, and the doors to P4P and S4P. */
.pf__go { display: flex; gap: .5rem; }
.pf__goform { display: block; margin: 0; }
.pf__gobtn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; box-sizing: border-box; min-width: 4.9rem; height: 2.25rem; padding: 0 .6rem; border: 1px solid var(--q-line-strong, var(--q-line)); border-radius: var(--q-r-pill); background: var(--q-surface); color: var(--q-ink); font-size: var(--q-text-sm); font-weight: 600; }
.pf__gobtn:hover { background: var(--q-primary-soft); }
.pf__gobtn:disabled { opacity: .45; cursor: not-allowed; background: var(--q-surface-sunk); }
.pf__gobtn:disabled:hover { background: var(--q-surface-sunk); }
.pf__gobtn.is-attention { border-color: var(--q-warning); background: var(--q-warning-soft); color: var(--q-warning-ink); }
.pf__gobtn .q-icon { width: .95rem; height: .95rem; }
.pf__qname { font-weight: 600; font-size: var(--q-text-base); }

/* The quarries of Home as cards: tick to add up, P4P and S4P to open. */
.pf__all { padding: 0 .95rem; min-height: 2rem; border-radius: 999px; font-size: var(--q-text-sm); font-weight: 500; color: var(--q-ink-2); background: transparent; border-color: var(--q-line-strong, var(--q-line)); }
.pf__all:hover { background: var(--q-surface); color: var(--q-ink); }
.pf__region { margin: 1rem 0 .5rem; font-size: var(--q-text-sm); font-weight: 600; color: var(--q-ink-3); }
.pf__cards { display: grid; grid-template-columns: repeat(auto-fill, 13.5rem); gap: .75rem; }
.pf__card { display: flex; flex-direction: column; gap: .15rem; min-height: 9.25rem; padding: .8rem .9rem; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-card); cursor: pointer; }
.pf__card[hidden] { display: none; }
.pf__card:not(.is-off) { border-color: var(--q-primary); box-shadow: inset 0 0 0 1px var(--q-primary), var(--q-shadow-card); }
.pf__card.is-off > :not(.pf__go) { opacity: .6; }
.pf__card:has(input:disabled) { cursor: default; background: var(--q-surface-sunk); }
.pf__cardpick { display: flex; align-items: center; gap: .6rem; margin: 0; cursor: pointer; }
.pf__cardpick, .pf__cardregion, .pf__cardstate { margin-left: 0; }
.pf__check { display: none; margin-left: auto; color: var(--q-primary); }
.pf__cardpick input:checked ~ .pf__check { display: inline-flex; }
.pf__card:has(input:focus-visible) { outline: 2px solid var(--q-primary); outline-offset: 2px; }
.pf__cardregion { margin-left: 0; }
.pf__cardstate { display: flex; align-items: center; gap: .4rem; margin: .1rem 0 0; font-weight: 500; }
.pf__cardstate.is-behind, .pf__cardstate.is-waiting { color: var(--q-warning-ink); }
.pf__cardstate.is-late { color: var(--q-critical-ink); }
.pf__card .pf__go { margin: auto 0 0; padding-top: .7rem; }
.pf__card .pf__goform:first-child { margin-left: 0; }

.pf__qname { overflow-wrap: anywhere; }

/* Unfinished work: a checklist, one row per step to finish */
.q-todo { background: var(--q-surface); border: 1px solid var(--q-line); border-left: 3px solid var(--q-warning); border-radius: var(--q-radius, .5rem); margin-bottom: 1rem; overflow: hidden; }
.q-todo__head { display: flex; gap: .75rem; align-items: flex-start; padding: 1rem 1.1rem .8rem; }
.q-todo__icon { flex: none; display: inline-flex; color: var(--q-warning-ink); margin-top: .15rem; }
.q-todo__title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.q-todo__lead { margin: .15rem 0 0; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.q-todo__list { list-style: none; margin: 0; padding: 0; }
.q-todo__list li { border-top: 1px solid var(--q-line); }
.q-todo__row { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.1rem .7rem 2.9rem; color: inherit; text-decoration: none; }
a.q-todo__row:hover { background: var(--q-warning-soft); }
a.q-todo__row:focus-visible { outline: 2px solid var(--q-focus, currentColor); outline-offset: -2px; }
.q-todo__main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .75rem; }
.q-todo__name { font-weight: 600; }
.q-todo__go { flex: none; display: inline-flex; align-items: center; gap: .3rem; pointer-events: none; }
a.q-todo__row:hover .q-todo__go { border-color: var(--q-ink-3); }
.q-todo__list li.q-todo__group { padding: .45rem 1.1rem .45rem 2.9rem; background: var(--q-surface-2, var(--q-bg)); color: var(--q-ink-3); font-size: var(--q-text-sm); font-weight: 600; }

/* Cost Allocation: the explanation is a link in the bar, opening over the table */
.cst__barlead { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1.5rem; min-width: 0; }
.cst__how { position: relative; }
.cst__how summary { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; list-style: none; color: var(--q-ink-2); font-size: var(--q-text-sm); text-decoration: underline; text-underline-offset: 2px; }
.cst__how summary::-webkit-details-marker { display: none; }
.cst__how summary:hover, .cst__how[open] summary { color: var(--q-ink); }
.cst__how summary:focus-visible { outline: 2px solid var(--q-focus, currentColor); outline-offset: 3px; border-radius: 4px; }
.cst__howbody { position: absolute; left: 0; top: calc(100% + .45rem); z-index: 6; width: min(34rem, 80vw); padding: .9rem 1.1rem .4rem; background: var(--q-surface); border: 1px solid var(--q-line); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-pop); color: var(--q-ink-2); font-size: var(--q-text-sm); }
.cst__howbody p { margin: 0 0 .7rem; }
/* On the plant set-up the explanation opens in the page, over the full width of the bar: the frame of the table never cuts it, and it pushes the table down instead. */
.s4p--plant .s4p__bar { flex-wrap: wrap; }
.s4p--plant .cst__how[open] { flex: 1 1 100%; }
.s4p--plant .cst__how[open] .cst__howbody { position: static; width: auto; max-width: none; margin-top: .6rem; box-shadow: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr)); gap: 0 2.5rem; align-items: start; padding-bottom: .9rem; }
.s4p__howcol p:last-child { margin-bottom: 0; }
/* The message line takes no room until there is a message: the same gap under the steps in every step */
.alloc__msg:empty, .c2b__msg:empty { min-height: 0; margin: 0; }

/* Cost Allocation: compact rows. One line per P&L line (the full name is the tooltip), the cost type
   written beside its slider instead of under it, and lower share cells: about a quarter more lines
   on screen. Only this table: the S4P tables share the base classes. */
#cst-table { --w-name: 12.5rem; --w-kind: 10.6rem; }
#cst-table .cst__share { min-height: 2.1rem; }
#cst-table th.cst__name span { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
#cst-table .cst__row.is-new th.cst__name span { max-width: calc(100% - 3rem); }
#cst-table td.cst__kind { text-align: left; padding-left: .5rem; }
#cst-table td.cst__kind input { display: inline-block; width: 3.2rem; margin: 0; vertical-align: middle; }
#cst-table td.cst__kind .cst__vartext { display: inline-block; width: 6.2rem; overflow: hidden; margin: 0 0 0 .4rem; text-align: left; vertical-align: middle; }

/* Product recipes: one bar above the table (the how-to is a link), and two lines per product: the name
   (cut with "…", full name in the tooltip), then its code and tonnes sold. Only this table. */
.s4p__bar { flex-wrap: wrap; }
.s4p__bar .s4p__headtools { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin-left: auto; }
.s4p:not(.s4p--plant) .s4p__recipes .s4p__table { --w-name: 14rem; }
.s4p:not(.s4p--plant) .s4p__recipes .s4p__table th.cst__name { overflow: hidden; }
.s4p__pname { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s4p__psub { display: flex; align-items: center; gap: .4rem; margin-top: .15rem; white-space: nowrap; }
.s4p__psub .s4p__sold { display: inline; }
.s4p__psub .q-code { flex: none; }
/* Plant set-up: a slimmer "Copy to" button, to keep the header of the table low */
.s4p__copy { margin-top: .2rem; }
.s4p__copybtn.btn { min-height: 0; padding: .1rem .6rem; font-size: var(--q-text-xs); line-height: 1.3; }

/* Product and margins: the chart takes the whole width; the Volume / Total margin switch sits under the tiles */
.cd__bar--below { justify-content: flex-end; margin-top: 1rem; }
.cd--pick .cd__chart { max-height: none; }

/* Scatter legends are filters: a click shows only that kind of dot */
.sc__lg { padding: .2rem .55rem; border: 1px solid transparent; border-radius: 999px; background: none; font: inherit; color: inherit; cursor: pointer; }
.sc__lg:hover { background: var(--q-surface-sunk); }
.sc__lg:focus-visible { outline: 2px solid var(--q-focus, currentColor); outline-offset: 2px; }
.sc__lg[aria-pressed="false"] { opacity: .45; }
.sc__lg[aria-pressed="true"]:not(:only-child) { border-color: transparent; }
.sc.is-filtered .sc__lg[aria-pressed="true"] { border-color: var(--q-line-strong); background: var(--q-surface); }
.sc__pt.is-off { display: none; }

/* Stock tab: the production / sales bars and the stock strip, without the Home panel around them */
.tr--bare { margin-top: .5rem; }
.tr--bare + .tr--bare { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--q-line); }
.sh__bars[hidden] { display: none; }
.tr__linebox > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; color: var(--q-ink-3); opacity: .6; pointer-events: none; }
.tr__linebox .tr__col { z-index: 1; }
.tr__linebox .tr__dot { z-index: 2; pointer-events: none; }
.q-over__switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; margin-top: 1rem; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.pf__card.is-ended { opacity: .7; }
.pf__cardstate.is-ended { color: var(--q-warning-ink, var(--q-ink-2)); }
.pf__renew { font-size: var(--q-text-sm); font-weight: 500; color: var(--q-warning-ink, var(--q-ink)); text-decoration: underline; text-underline-offset: 2px; }

/* ---- C4P: quarries and product equivalence -------------------------------------------------- */
.c4p__companies { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.c4p__count { color: var(--q-ink-2); font-size: var(--q-text-sm); margin: 0 0 .75rem; text-align: left; }
.c4p__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.c4p__bar form { margin: 0 0 .75rem; }
.c4p__warn { color: var(--q-warning-ink); }
.c4p__tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1rem; border-bottom: 1px solid var(--q-line); }
.c4p__tab { padding: .45rem .9rem; border-radius: var(--q-r-ctrl) var(--q-r-ctrl) 0 0; color: var(--q-ink-2); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.c4p__tab:hover { color: var(--q-ink); background: var(--q-surface-sunk); }
.c4p__tab.is-active { color: var(--q-primary); border-bottom-color: var(--q-accent); }
.c4p__table th small { display: block; font-weight: 400; color: var(--q-ink-3); }
.c4p__table th a { color: inherit; font-weight: 600; text-decoration: none; }
.c4p__table th a:hover { text-decoration: underline; }
.c4p__table th, .c4p__table td { vertical-align: top; min-width: 11rem; }
.c4p__table .c4p__group { min-width: 14rem; text-align: left; }
.c4p__table tbody .c4p__group { display: flex; align-items: center; gap: .25rem; border-bottom: 1px solid var(--q-line); position: static; background: var(--q-surface); }
.c4p__table td.is-gap { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--q-surface-sunk) 6px 12px); }
.c4p__gapmark { color: var(--q-ink-3); }
.c4p__rename { flex: 1; margin: 0; }
.c4p__rename input { width: 100%; border: 1px solid transparent; background: transparent; font-weight: 600; padding: .2rem .4rem; border-radius: var(--q-r-ctrl); }
.c4p__rename input:hover, .c4p__rename input:focus { border-color: var(--q-line-strong); background: var(--q-surface); }
.c4p__chip { display: flex; align-items: center; justify-content: space-between; gap: .5rem; border: 1px solid var(--q-line); border-radius: var(--q-r-pill); background: var(--q-surface-sunk); padding: .1rem .65rem; margin-bottom: .3rem; text-align: left; font-size: var(--q-text-sm); }
.c4p__chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c4p__chip em { font-style: normal; color: var(--q-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.c4p__empty { text-align: center; }
.c4p__lacks { margin: .6rem 0 0; text-align: left; font-size: var(--q-text-sm); color: var(--q-ink-2); }

/* The mapping of one quarry: its products on the left, the network products on the right, lines between */
.c4p__map { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 7rem; padding: 0 .25rem 1rem; }
.c4p__lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.c4p__line { fill: none; stroke: var(--q-primary); stroke-width: 1.6; opacity: .45; }
.c4p__line.is-suggested { stroke-dasharray: 5 4; opacity: .55; stroke: var(--q-ink-3); }
.c4p__line.is-on { opacity: 1; stroke-width: 2.4; }
.c4p__col h3 { font-size: var(--q-text-sm); font-weight: 600; color: var(--q-ink-2); margin: 0 0 .6rem; text-align: left; }
.c4p__col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.c4p__row { display: flex; align-items: center; gap: .35rem; min-height: 2.6rem; }
.c4p__row form { margin: 0; }
.c4p__prod, .c4p__net { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: .75rem; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); background: var(--q-surface); padding: .45rem .75rem; text-align: left; font: inherit; color: inherit; }
.c4p__prod em { font-style: normal; color: var(--q-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.c4p__pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c4p__prod.is-linked { border-color: var(--q-primary); background: var(--q-primary-soft); }
.c4p__prod.is-suggested { border-style: dashed; }
.c4p__prod.is-armed { outline: 2px solid var(--q-accent); outline-offset: 1px; }
.c4p__net { flex-direction: column; align-items: flex-start; gap: 0; }
.c4p__net small { color: var(--q-ink-3); }
.c4p__netname { font-weight: 600; }
.c4p__map[data-editable="1"] .c4p__prod, .c4p__map.is-linking .c4p__net { cursor: pointer; }
.c4p__map.is-linking .c4p__net:hover { border-color: var(--q-accent); box-shadow: 0 0 0 2px var(--q-accent); }
.c4p__new { display: inline-flex; align-items: center; gap: .2rem; border: 1px dashed var(--q-line-strong); border-radius: var(--q-r-pill); background: transparent; color: var(--q-ink-2); font-size: var(--q-text-sm); padding: .15rem .6rem; cursor: pointer; white-space: nowrap; }
.c4p__new:hover { border-color: var(--q-primary); color: var(--q-primary); }
.c4p__none { color: var(--q-ink-3); font-size: var(--q-text-sm); }

/* Quarries that take part */
.c4p__members { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .75rem; }
.c4p__member { display: flex; align-items: center; gap: .75rem; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-card); background: var(--q-surface); padding: .75rem 1rem; cursor: pointer; margin: 0; }
.c4p__member.is-in { border-color: var(--q-primary); background: var(--q-primary-soft); }
.c4p__membername { flex: 1; text-align: left; }
.c4p__membername small { display: block; color: var(--q-ink-3); }
.c4p__memberstate { font-size: var(--q-text-sm); color: var(--q-ink-2); }

/* History */
.c4p__history { margin-top: 1rem; }
.c4p__log { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; text-align: left; font-size: var(--q-text-sm); }
.c4p__log li { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 1rem; }
.c4p__log time, .c4p__log small { color: var(--q-ink-3); font-variant-numeric: tabular-nums; }

/* Home for someone with no quarry yet */
.q-home__none { max-width: 38rem; margin: 2rem auto; text-align: center; }
.q-home__none-actions { margin: 0 0 1.5rem; }

/* The page that asks for a quarry: the same cards as Home, each one a button */
.pf__cards--pick { margin: 0; }
.pf__card--link { width: 100%; min-height: 6.5rem; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.pf__card.pf__card--link:not(.is-off) { border-color: var(--q-line); box-shadow: var(--q-shadow-card); }
.pf__card.pf__card--link:hover, .pf__card.pf__card--link:focus-visible { border-color: var(--q-basalt); box-shadow: inset 0 0 0 2px var(--q-basalt); outline: none; }

/* The margins block of the P4P results is a res__block that also carries res__panel (the tabs show or hide it):
   it must not take the padding of a panel, or it is narrower than the charts above and below it. */
.res__block.res__panel { padding: 0; }

/* S4P tables (customer profitability, saved evaluations): the header stays in view while the page scrolls,
   as in the P4P results (the wrapper must not scroll: on a narrow screen it still does). */
@media (min-width: 1100px) { .s4p__panel .q-table-wrap:has(> .rv__table) { overflow: visible; } }
.rv__table thead th { position: sticky; top: var(--res-sticky, 0px); z-index: 3; }
.rv__table thead tr + tr th { top: calc(var(--res-sticky, 0px) + var(--res-head1, 0px)); }
.rv__table tbody th { position: static; background: var(--q-surface); color: var(--q-ink); font-size: inherit; border-bottom: 1px solid var(--q-line); }
.rv__table tbody tr:last-child th { border-bottom: 0; }
.rv__table tbody tr:hover th { background: var(--q-surface-sunk); }

/* Names that are links in the results tables: a thin light underline, darker on hover, not a heavy one */
.res__margins tbody th a, .rv__table tbody th a { text-decoration: underline; text-decoration-color: var(--q-line-strong); text-decoration-thickness: 1px; text-underline-offset: .28em; }
.res__margins tbody th a:hover, .rv__table tbody th a:hover { text-decoration-color: currentColor; }

/* ---- Deal impact result: a compact banner and compact cards, so the tabs come into view sooner ---- */
#res4 .res4__balance { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: .1rem .8rem; margin-bottom: .75rem; padding: .55rem 1rem; border-radius: 12px; text-align: center; }
#res4 .res4__bicon { width: 1.75rem; height: 1.75rem; }
#res4 .res4__bicon .q-icon { width: .95rem; height: .95rem; }
#res4 .res4__balance > b { font-size: var(--q-text-md); }
#res4 .res4__balance > .res4__scale { justify-content: center; gap: .1rem 1rem; font-size: var(--q-text-sm); }
#res4 .res4__balance > p:not(.res4__scale) { flex-basis: 100%; font-size: var(--q-text-sm); }
#res4 .res4__cards--top { gap: .75rem; }
#res4 .res4__card { padding: .7rem 1.1rem .8rem; border-radius: 12px; }
#res4 .res4__card h3 { margin-bottom: .4rem; font-size: var(--q-text-base); }
#res4 .res4__cards--top .res4__card dl { gap: .3rem 1rem; }
#res4 .res4__k dt { font-size: var(--q-text-sm); }
#res4 .res4__chips { margin-top: .5rem; gap: .35rem; }
#res4 .res4__delta { padding: .1rem .65rem; font-size: var(--q-text-xs); }
@media (min-width: 721px) { #res4 .res4__cards--top .res4__k dd { font-size: 1.3rem; } }

/* ---- P4P look-up (phone): pick a product or a customer, see its few key figures ---- */
.lk { padding: 1rem; }
.lk__when { margin: 0 0 .75rem; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.lk__modes { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 .85rem; border: 1px solid var(--q-line-strong); border-radius: var(--q-r-ctrl); overflow: hidden; }
.lk__modes button { min-height: 2.75rem; border: 0; background: var(--q-surface); color: var(--q-ink-2); font: inherit; font-weight: 500; }
.lk__modes button + button { border-left: 1px solid var(--q-line-strong); }
.lk__modes button[aria-pressed="true"] { background: var(--q-primary-soft); color: var(--q-primary); font-weight: 600; }
.lk__search { position: relative; margin: 0 0 1rem; }
.lk__list { list-style: none; margin: .25rem 0 0; padding: .25rem; max-height: 20rem; overflow-y: auto; background: var(--q-surface); border: 1px solid var(--q-line-strong); border-radius: var(--q-r-card); box-shadow: var(--q-shadow-pop); position: absolute; left: 0; right: 0; z-index: 20; }
.lk__list[hidden] { display: none; }
.lk__list button { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-height: 2.75rem; padding: .4rem .65rem; border: 0; border-radius: var(--q-r-ctrl); background: none; font: inherit; text-align: left; }
.lk__list button:hover, .lk__list button:focus-visible { background: var(--q-seq-100); }
.lk__none { padding: .75rem; color: var(--q-ink-3); }
.lk__note { margin: 0; color: var(--q-ink-3); }
.lk__name { margin: 0 0 .15rem; font-size: var(--q-text-lg); }
.lk__name .q-code { margin-left: .5rem; vertical-align: middle; }
.lk__group { margin: 0 0 1rem; color: var(--q-ink-3); font-size: var(--q-text-sm); }

.lk__scale { margin: 0 0 1.1rem; padding: 1rem; border: 1px solid var(--q-line); border-radius: var(--q-r-card); background: var(--q-surface-sunk); }
.lk__plot { position: relative; height: 5.4rem; margin: .5rem 2.4rem 0; }
.lk__rail { position: absolute; left: 0; right: 0; bottom: .9rem; height: .5rem; margin-bottom: -.25rem; border-radius: 999px; background: var(--q-line-strong); }
.lk__dot { position: absolute; bottom: .9rem; width: 1.05rem; height: 1.05rem; margin: 0 0 -.525rem -.525rem; border-radius: 50%; border: 2px solid var(--q-surface); box-shadow: 0 0 0 1px var(--q-line-strong); }
.lk__pt { position: absolute; transform: translateX(-50%); font-size: var(--q-text-sm); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lk__pt small { margin-left: .15rem; font-size: var(--q-text-xs); font-weight: 400; color: var(--q-ink-3); }
.lk__pt.row-0 { bottom: 1.7rem; }
.lk__pt.row-1 { bottom: 3.4rem; }
.lk__pt.row-1::after, .lk__pt.row-2::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 1.9rem; background: var(--q-line-strong); }
.lk__pt.row-2 { bottom: 5.1rem; }
.lk__pt.row-2::after { height: 3.6rem; }
.lk__plot.rows-3 { height: 7.1rem; }
.lk__dot.is-average { width: 1.3rem; height: 1.3rem; margin: 0 0 -.65rem -.65rem; }
/* The five prices: the ends of the range are neutral blues (low to high), the cost lines carry the
   status colours (floor: red, break-even: amber), the average is basalt. Dot and legend share them. */
.lk__dot.is-low, .lk__legend .is-low i { background: var(--q-seq-300); }
.lk__dot.is-high, .lk__legend .is-high i { background: var(--q-seq-600); }
.lk__dot.is-floor, .lk__legend .is-floor i { background: var(--q-critical); }
.lk__dot.is-break_even, .lk__legend .is-break_even i { background: var(--q-accent); }
.lk__dot.is-average, .lk__legend .is-average i { background: var(--q-basalt); }
.lk__plot.has-suggest { margin-bottom: 1.7rem; }
.lk__scale { --q-tone: var(--q-primary); }
.lk__scale.t-good { --q-tone: var(--q-good); }
.lk__scale.t-tight { --q-tone: var(--q-accent); }
.lk__scale.t-loss { --q-tone: var(--q-critical); }
.lk__dot.is-suggest { width: 1.15rem; height: 1.15rem; margin: 0 0 -.575rem -.575rem; background: var(--q-surface); border: 3px solid var(--q-tone); box-shadow: none; z-index: 2; }
.lk__pt.is-suggest { bottom: -1.55rem; }
.lk__legend .is-suggest i { background: var(--q-surface); border: 2px solid var(--q-tone); width: .6rem; height: .6rem; box-sizing: border-box; }
.lk__vol-label { margin: .9rem 0 0; }
.lk__vol-label + .lk__vol { margin-top: .1rem; }
.lk__legend { list-style: none; margin: 1.1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1rem; }
.lk__legend li { display: flex; align-items: center; gap: .35rem; color: var(--q-ink-2); font-size: var(--q-text-xs); }
.lk__legend i { flex: none; width: .6rem; height: .6rem; border-radius: 50%; }
.lk__says { margin: .6rem 0 0; font-size: var(--q-text-sm); color: var(--q-ink-2); }
.lk__hint { margin: .4rem 0 0; color: var(--q-ink-3); font-size: var(--q-text-sm); }

.lk__price { margin: 1.5rem 0 0; padding-top: 1.1rem; border-top: 1px dashed var(--q-line); }
.lk__vol { display: flex; align-items: baseline; margin: .9rem 0 .2rem; font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.lk__vol small { margin-left: .3rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }
.lk__range { width: 100%; min-height: 2.75rem; accent-color: var(--q-primary); }
.lk__ends { display: flex; margin-top: -.6rem; padding: 0 .35rem; justify-content: space-between; color: var(--q-ink-3); font-size: var(--q-text-xs); }
.lk__out { margin-top: 2.25rem; }
.lk__legend.is-verdict { margin-top: .7rem; }
.lk__legend .is-good i { background: var(--q-good); }
.lk__legend .is-tight i { background: var(--q-accent); }
.lk__legend .is-loss i { background: var(--q-critical); }
.lk__sugg { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1rem; border: 1px solid var(--q-line); border-radius: var(--q-r-card); background: var(--q-surface-sunk); border-left: .35rem solid var(--q-primary); }
.lk__sugg.is-good { border-left-color: var(--q-good); }
.lk__sugg.is-tight { border-left-color: var(--q-accent); }
.lk__sugg.is-loss { border-left-color: var(--q-critical); }
.lk__sugg > div { display: grid; gap: .2rem; min-width: 0; }
.lk__sugg > div small { font-size: var(--q-text-sm); color: var(--q-ink-2); margin-left: 0; }
.lk__sugg strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.lk__sugg small { margin-left: .25rem; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }

.lk__tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 0 0 1.25rem; }
.lk__tile { display: grid; gap: .1rem; padding: .75rem; border: 1px solid var(--q-line); border-radius: var(--q-r-card); background: var(--q-surface-sunk); }
.lk__tile small { color: var(--q-ink-3); font-size: var(--q-text-sm); }
.lk__tile strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.lk__tile strong em { margin-left: .2rem; font-style: normal; font-size: var(--q-text-sm); font-weight: 400; color: var(--q-ink-3); }
.lk__tile span { color: var(--q-ink-3); font-size: var(--q-text-sm); }
.lk__tile.is-loss strong { color: var(--q-critical-ink, #b3261e); }
.lk__sub { margin: 0 0 .6rem; font-size: var(--q-text-md); }
.lk__prod { margin: 0 0 1.1rem; padding: 0 0 1rem; border-bottom: 1px dashed var(--q-line); }
.lk__prod:last-child { border-bottom: 0; }
.lk__prod h4 { margin: 0 0 .25rem; font-size: var(--q-text-base); }
.lk__prod h4 .q-code { margin-left: .5rem; }
.lk__line { display: flex; flex-wrap: wrap; gap: .1rem 1rem; margin: 0 0 .15rem; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.lk__line strong { color: var(--q-ink); font-variant-numeric: tabular-nums; }
.lk__line b { font-weight: 600; }
.lk__line strong.is-loss { color: var(--q-critical-ink); }
.lk__line strong.is-good { color: var(--q-good-ink); }
.lk__tip { margin-top: .35rem; }
.lk__line b.is-loss { color: var(--q-critical-ink); }
.lk__line b.is-good { color: var(--q-good-ink); }
.lk__spark { display: block; width: 100%; height: auto; }
.lk__path { fill: none; stroke: var(--q-primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lk__dot { fill: var(--q-primary); }
.lk__tip { margin: 0 0 .15rem; min-height: 1.4rem; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.lk__tip.is-set { color: var(--q-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.lk__spark { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.lk__dot { transition: r .1s; }
.lk__dot.is-on { r: 4.6px; }
.lk__flat { margin: 0 0 .1rem; color: var(--q-ink-2); font-size: var(--q-text-sm); }
.lk__axis { display: flex; justify-content: space-between; margin: .15rem 0 0; color: var(--q-ink-3); font-size: var(--q-text-xs); }

/* ---- Home on a phone: one quarry, its figures of the month, its subscription alerts ---- */
.ph { display: grid; gap: .9rem; }
.ph__pick { margin: 0; }
.ph__name { margin: .25rem 0 0; font-size: var(--q-text-lg); }
.ph__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem .75rem; margin-top: .25rem; }
.ph__fresh { margin: 0; color: var(--q-ink-3); font-size: var(--q-text-sm); }
.ph__dot { display: inline-block; width: .55rem; height: .55rem; margin-left: .45rem; border-radius: 50%; background: var(--q-critical); vertical-align: middle; box-shadow: 0 0 0 2px var(--q-surface); }
.ph__fresh.is-behind, .ph__fresh.is-late { color: var(--q-warning-ink); }
.ph__period { margin: 0; font-size: var(--q-text-md); }
.ph__alert { margin: 0; }
.ph .q-kpis { gap: .55rem; }
.ph .q-kpi { padding: .65rem .8rem; gap: .15rem; }
.ph .q-kpi__foot { margin-top: .1rem; min-height: 0; }
.q-topbar__logout { margin: 0; }

/* look-up: the cross that erases the choice, the unit that never splits, the wait for a price */
.lk__search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.lk__search .form-control { padding-right: 3rem; }
.lk__clear { position: absolute; top: 0; right: 0; width: 3rem; height: 100%; min-height: 2.75rem; display: grid; place-items: center; border: 0; background: none; color: var(--q-basalt); }
.lk__clear[hidden] { display: none; }
.lk__clear .q-icon { width: 1.25rem; height: 1.25rem; }
.lk__sugg strong, .lk__pt, .lk__tile strong, .lk__vol { white-space: nowrap; }
.lk__out { position: relative; min-height: 3rem; }
.lk__out.is-loading > * { opacity: .35; transition: opacity .15s; }
.lk__out.is-loading::after { content: ""; position: absolute; top: 1rem; left: 50%; width: 1.6rem; height: 1.6rem; margin-left: -.8rem; border: 3px solid var(--q-line-strong); border-top-color: var(--q-basalt); border-radius: 50%; animation: lk-spin .7s linear infinite; }
@keyframes lk-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lk__out.is-loading::after { animation: none; } }

/* look-up, customer card: breathing room under the name, a small comparison table per product */
.lk__card[data-lk-customer] .lk__name { margin-bottom: 1.1rem; }
.lk__cmp { width: 100%; margin: .2rem 0 .7rem; border-collapse: collapse; font-size: var(--q-text-xs); font-variant-numeric: tabular-nums; }
.lk__cmp th, .lk__cmp td { padding: .35rem 0 .35rem .6rem; text-align: right; vertical-align: baseline; }
.lk__cmp thead th { color: var(--q-ink-3); font-weight: 500; white-space: nowrap; border-bottom: 1px solid var(--q-line); padding-bottom: .3rem; }
.lk__cmp tbody th { text-align: left; color: var(--q-ink-2); font-weight: 400; padding-left: 0; }
.lk__cmp tbody td { color: var(--q-ink); font-weight: 600; white-space: nowrap; }
.lk__cmp tbody tr + tr > * { border-top: 1px dashed var(--q-line); }
.lk__cmp td.is-loss { color: var(--q-critical-ink); }
.lk__cmp td.is-good { color: var(--q-good-ink); }
.lk__cmp b { font-weight: 600; }
.lk__cmp b.is-loss { color: var(--q-critical-ink); }
.lk__cmp b.is-good { color: var(--q-good-ink); }
.lk__axis + .lk__tip { margin: .5rem 0 0; }
.q-todo__phone { margin: 0; padding: .75rem 1rem; color: var(--q-ink-3); font-size: var(--q-text-sm); border-top: 1px solid var(--q-line); }
.lk__tip .is-good { color: var(--q-good-ink); }
.lk__tip .is-loss { color: var(--q-critical-ink); }

/* look-up on a phone: every pixel of the width goes to the figures and the line */
@media (max-width: 639.98px), (max-width: 991.98px) and (pointer: coarse) {
  .lk { padding: .75rem .65rem; }
  .lk__scale { padding: .8rem .6rem; }
  .lk__axis, .lk__tip { font-size: var(--q-text-xs); }
}
#deal-place-list { min-width: 16rem; right: auto; }
#deal-place-list small { color: var(--q-ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Deal impact on a phone is only to look at: the stock shows the name, the code and the split of the
   revenue and of the volume. The prices and the details are for the computer. */
@media (max-width: 639.98px), (max-width: 991.98px) and (pointer: coarse) {
  #res4 .stk4__n > small, #res4 .stk4__n .stk4__x, #res4 .stk4__p, #res4 .stk4__tog, #res4 .stk4__why { display: none; }
}
@media (max-width: 720px), (pointer: coarse) and (max-width: 991.98px) {
  #res4 .res4__k dd, #res4 .res4__cards--top .res4__k dd { font-size: 1.05rem; }
  #res4 .res4__k dt { font-size: var(--q-text-sm); }
}

/* Deal impact on a phone: every figure and every bar inside the screen */
@media (max-width: 720px), (pointer: coarse) and (max-width: 991.98px) {
  #res4 .res4__cards--top { grid-template-columns: minmax(0, 1fr); }
  #res4 .res4__card { min-width: 0; }
  #res4 .res4__card h3 { white-space: normal; overflow-wrap: anywhere; }
  #res4 .res4__k { min-width: 0; }
  #res4 .stk4__track, #res4 .stk4__seg { margin-right: 0; }
  #res4 .stk4__legend { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .3rem .45rem; align-items: center; }
  #res4 .stk4__legend > span { white-space: normal; }
  .deal__calc { font-size: var(--q-text-base); white-space: nowrap; padding: .8rem .75rem; gap: .45rem; }
  .sum__row--total span, .sum__row--total b { white-space: nowrap; font-size: var(--q-text-base); }
}
