/* Page-scoped styles for the competition benchmark (adathalmaz/kozbeszerzesi-
   verseny/ and its EN and DE copies). Kept out of editorial.src.css so PurgeCSS
   never sees classes that only appear in markup js/market-benchmark.js builds.

   Charts follow the site palette: cream surface #fef7e6, one cobalt hue
   #0857b0 for every bar (one series, so one colour, no legend box), black
   hairlines for the national reference line. Text never wears the bar colour.
   Bars are at most 22px thick, 4px rounded at the data end, square at the
   baseline, the value printed at the tip. Every chart is a real table, so a
   screen reader reads label, rate and n per row. */

.mb-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mb-section {
  padding: 56px 0;
  background: #ffffff;
}
.mb-section + .mb-section {
  border-top: 1px solid var(--color-rule);
}
.mb-section--headline {
  background: #fef7e6;
  padding-top: 48px;
}
.mb-section--tool {
  background: #fef7e6;
}
.mb-narrow {
  max-width: 860px;
}
.mb-section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.15;
  color: var(--color-ink);
  margin: 0 0 0.75rem;
}
.mb-lead,
.mb-prose p,
.mb-foot,
.mb-related {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text-medium);
  max-width: 68ch;
  margin: 0 0 1rem;
}
.mb-foot,
.mb-related {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-top: 1rem;
}
.mb-lead a,
.mb-method a,
.mb-related a,
.mb-section--headline a {
  color: var(--color-cobalt);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- headline ---------------------------------------------- */

.mb-hero-figure {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.mb-hero-figure__value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(3.5rem, 9vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--color-ink);
  margin: 0;
  min-width: 2ch;
}
.mb-hero-figure__label {
  font-size: 1.1rem;
  line-height: 1.45;
  color: var(--color-text-dark);
  max-width: 34ch;
  margin: 0;
}
/* The quotable one-sentence summary under the figure. */
.mb-summary {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text-dark);
  max-width: 68ch;
  margin: 0 0 1.5rem;
}
.mb-summary[hidden] {
  display: none;
}
.mb-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 1rem;
  border-top: 1px solid #000000;
  border-bottom: 1px solid var(--color-rule);
}
.mb-kpi {
  padding: 0.85rem 1rem 0.85rem 0;
}
.mb-kpi + .mb-kpi {
  padding-left: 1rem;
  border-left: 1px solid var(--color-rule);
}
.mb-kpi dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-medium);
  margin: 0 0 0.35rem;
}
.mb-kpi dd {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-ink);
  margin: 0;
  min-height: 1.5em;
}
.mb-date {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--color-text-medium);
  margin: 0 0 1.75rem;
}
.mb-date > span[hidden] {
  display: none;
}
.mb-prose {
  margin-top: 0.5rem;
}

/* ---------- sub-headings, lists, advice --------------------------- */

.mb-section .mb-h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--color-ink);
  margin: 2rem 0 0.75rem;
}
.mb-advice {
  margin-top: 2rem;
}
.mb-advice .mb-h3 {
  margin-top: 0;
}
.mb-advice p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text-medium);
  max-width: 68ch;
  margin: 0 0 0.6rem;
}
.mb-list {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
  list-style: disc;
  color: var(--color-text-medium);
  line-height: 1.6;
  max-width: 68ch;
}
.mb-list li + li {
  margin-top: 0.3rem;
}
.mb-method .mb-list {
  margin: 0;
  font-size: inherit;
}

/* ---------- bar charts (tables) ----------------------------------- */

.mb-bars {
  --mb-pad: 0.75rem;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fef7e6;
  border-top: 1px solid #000000;
}
.mb-bars thead th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--color-text-medium);
  padding: 0.6rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--color-rule);
}
.mb-bars thead th:last-child,
.mb-n {
  text-align: right;
}
/* The reference line's label sits in the header, at the line's own x, on a
   second line under the column name, with a short tick down to the rows. It
   uses the same --mb-pad and --mb-ref-f as the line (.mb-barcell::after). */
.mb-bars thead th.mb-th-bar {
  position: relative;
}
.mb-bars[style*="--mb-ref-f"] thead th.mb-th-bar {
  padding-bottom: 1.85rem;
}
.mb-ref-label {
  display: none;
  position: absolute;
  bottom: 0;
  left: calc(var(--mb-pad) + (100% - 2 * var(--mb-pad)) * var(--mb-ref-f));
  transform: translateX(-50%);
  padding-bottom: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-ink);
  white-space: nowrap;
  pointer-events: none;
}
.mb-ref-label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1px;
  height: 0.35rem;
  background: #000000;
}
.mb-bars[style*="--mb-ref-f"] .mb-ref-label {
  display: block;
}
.mb-row {
  --mb-row-bg: #fef7e6;
}
.mb-row:hover {
  --mb-row-bg: #f2efe3;
}
.mb-row th,
.mb-row td {
  padding: 0.45rem var(--mb-pad);
  vertical-align: middle;
  background: var(--mb-row-bg);
}
.mb-row + .mb-row th,
.mb-row + .mb-row td {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}
.mb-row--separate th,
.mb-row--separate td,
.mb-row + .mb-row--separate th,
.mb-row + .mb-row--separate td {
  border-top: 1px solid rgba(15, 23, 42, 0.35);
}
.mb-row:not(.mb-row--separate) + .mb-row--separate th,
.mb-row:not(.mb-row--separate) + .mb-row--separate td {
  padding-top: 0.9rem;
}
.mb-label {
  text-align: left;
  font-weight: 400;
  color: var(--color-ink);
  line-height: 1.3;
  width: 50%;
}
/* A wrapped division name starts its second line under the name, not under
   the code: a hanging indent the width of the code. */
.mb-bars .mb-label:has(.mb-code) {
  padding-left: calc(var(--mb-pad) + 1.9rem);
  text-indent: -1.9rem;
}
.mb-code {
  display: inline-block;
  width: 1.9rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-medium);
  margin: 0;
  text-indent: 0;
}
/* A division name opens the division in the CPV tool. */
a.mb-name {
  color: var(--color-ink);
  text-decoration: underline;
  text-decoration-color: rgba(8, 87, 176, 0.45);
  text-underline-offset: 3px;
}
a.mb-name:hover {
  color: #0857b0;
  text-decoration-color: currentColor;
}
a.mb-name:focus-visible {
  outline: 2px solid #0857b0;
  outline-offset: 2px;
}
.mb-barcell {
  width: 40%;
  min-width: 140px;
}
.mb-track {
  position: relative;
  display: block;
  height: 22px;
}
/* The national rate: one black hairline at the same x on every row, drawn
   over the whole cell height so it reads as one line through the chart. The
   table carries the rate as a fraction, --mb-ref-f, and the cell padding as
   --mb-pad, so the line sits where a bar of that rate would end. */
.mb-barcell {
  position: relative;
}
.mb-bars[style*="--mb-ref-f"] .mb-barcell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--mb-pad) + (100% - 2 * var(--mb-pad)) * var(--mb-ref-f));
  width: 1px;
  background: #000000;
  pointer-events: none;
}
.mb-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #0857b0;
  border-radius: 0 4px 4px 0;
  min-width: 2px;
}
/* Rows outside the categories (type not stated, nationwide) are striped, so
   they never read as one more category. */
.mb-row--separate .mb-bar {
  background: repeating-linear-gradient(135deg, #0857b0 0 4px, #fef7e6 4px 7px);
  box-shadow: inset 0 0 0 1px #0857b0;
}
.mb-val {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-ink);
  white-space: nowrap;
  z-index: 1;
  padding: 0 3px;
  background: var(--mb-row-bg, #fef7e6);
}
.mb-val--in {
  /* Anchored at the bar's end (left: calc(w% - 3px)), drawn to its left. */
  transform: translate(-100%, -50%);
  color: #ffffff;
  background: transparent;
}
.mb-few {
  position: relative;
  z-index: 1;
  padding: 0 3px;
  background: var(--mb-row-bg, #fef7e6);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--color-text-light);
}
.mb-n {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-medium);
  white-space: nowrap;
  width: 10%;
}
/* Phones only: the top 10 divisions and a button for the rest. */
.mb-more {
  display: none;
}
.mb-status {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin: 0.75rem 0 0;
}
.mb-status[hidden] {
  display: none;
}

/* Tooltip: one for the page, positioned by js/market-benchmark.js. */
.mb-tip {
  position: fixed;
  z-index: 50;
  max-width: 280px;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #ffffff;
  background: var(--color-ink);
  border-radius: 3px;
  pointer-events: none;
}
.mb-tip[hidden] {
  display: none;
}

/* ---------- CPV tool --------------------------------------------- */

.mb-card {
  background: #ffffff;
  border: 1px solid var(--color-rule);
  border-top: 3px solid #0857b0;
  border-radius: 2px;
  padding: 1.75rem;
}
.mb-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 1rem;
  margin: 0 0 1.5rem;
}
.mb-form[hidden] {
  display: none;
}
.mb-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mb-field__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink);
  margin-bottom: 0.45rem;
}
.mb-field__input {
  width: 100%;
  max-width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 0.8rem;
  color: var(--color-ink);
  background: #ffffff;
  border: 1px solid rgba(8, 87, 176, 0.7);
  border-radius: 2px;
}
.mb-field__input:disabled {
  background: #f6f6f6;
  border-color: rgba(8, 87, 176, 0.35);
}
.mb-field__input:focus-visible {
  outline: 2px solid #0857b0;
  outline-offset: 2px;
}
.mb-field__hint {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--color-text-light);
  margin: 0.4rem 0 0;
  min-height: 1.2em;
}
.mb-result {
  min-height: 8rem;
}
.mb-result__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.3;
  color: var(--color-ink);
  margin: 0 0 0.5rem;
}
.mb-result__note {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--color-text-medium);
  margin: 0 0 1rem;
}
.mb-result__sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  /* A site-wide h4 colour rule wins otherwise (as css/deadline-calculator.css). */
  color: var(--color-ink) !important;
  margin: 1.5rem 0 0.6rem;
}
/* Open tenders of the shown slice on the notice list, and the CPV search. */
.mb-result__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.25rem 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
}
.mb-result__links a {
  color: var(--color-cobalt);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mb-result__foot {
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-rule);
}
.mb-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #000000;
  border-bottom: 1px solid var(--color-rule);
}
.mb-tile {
  padding: 0.8rem 0.9rem 0.8rem 0;
}
.mb-tile + .mb-tile {
  padding-left: 0.9rem;
  border-left: 1px solid var(--color-rule);
}
.mb-tile__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-medium);
  margin: 0 0 0.3rem;
}
.mb-tile__value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--color-ink);
  margin: 0;
}
.mb-tile__note {
  font-size: 0.82rem;
  color: var(--color-text-light);
  margin: 0.2rem 0 0;
}
.mb-bars--dist .mb-label {
  width: 30%;
}
.mb-bars--dist .mb-barcell {
  width: 56%;
}
.mb-winners {
  list-style: none;
  counter-reset: mb-winner;
  margin: 0;
  padding: 0;
}
/* Grid rows: rank, name, count right-aligned. A grid drops the list marker,
   so the rank is a counter. */
.mb-winner {
  counter-increment: mb-winner;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  color: var(--color-ink);
}
.mb-winner::before {
  content: counter(mb-winner) ".";
  font-variant-numeric: tabular-nums;
  color: var(--color-text-medium);
}
.mb-winner__n {
  font-size: 0.85rem;
  color: var(--color-text-light);
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- method ----------------------------------------------- */

.mb-method {
  margin: 0;
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  border-top: 1px solid #000000;
}
.mb-method dt,
.mb-method dd {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--color-rule);
  margin: 0;
}
.mb-method dt {
  font-weight: 600;
  color: var(--color-ink);
  padding-right: 1rem;
}
.mb-method dd {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-medium);
}

/* ---------- narrow screens --------------------------------------- */

@media (max-width: 640px) {
  .mb-section {
    padding: 40px 0;
  }
  .mb-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mb-kpi:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
  .mb-kpi:nth-child(n+3) {
    border-top: 1px solid var(--color-rule);
  }
  /* Label on its own line, bar and n below it. The explicit roles in the
     markup keep the table semantics when the display changes. The header
     stays, on the same two columns as the bar and n, so the n column keeps
     its unit and the reference label its x. */
  .mb-bars,
  .mb-bars thead,
  .mb-bars tbody {
    display: block;
  }
  .mb-bars thead tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 4.5em;
  }
  .mb-bars thead th {
    padding-left: var(--mb-pad);
    padding-right: var(--mb-pad);
  }
  .mb-bars thead th:first-child {
    display: none;
  }
  /* The n column is narrow: its header may run left over the bar column's
     empty right end instead of out of the card. */
  .mb-bars thead th:last-child {
    display: flex;
    justify-content: flex-end;
    white-space: nowrap;
  }
  /* Top 10 divisions, the rest behind the button (js/market-benchmark.js). */
  #mbDivChart[data-collapse="closed"] .mb-row:nth-child(n+11) {
    display: none;
  }
  .mb-more {
    display: block;
    width: 100%;
    margin: 0.75rem 0 0;
    padding: 0.7rem 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: #0857b0;
    background: #ffffff;
    border: 1px solid rgba(8, 87, 176, 0.7);
    border-radius: 2px;
    cursor: pointer;
  }
  .mb-more[hidden] {
    display: none;
  }
  /* A fixed n column keeps every track the same width, so the reference
     line stays one line. */
  .mb-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 4.5em;
    padding: 0.4rem 0;
  }
  .mb-row + .mb-row {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
  }
  .mb-row--separate {
    border-top: 1px solid rgba(15, 23, 42, 0.35) !important;
  }
  .mb-bars {
    --mb-pad: 0.5rem;
  }
  .mb-row th,
  .mb-row td,
  .mb-row + .mb-row th,
  .mb-row + .mb-row td {
    border-top: 0;
    padding: 0.15rem var(--mb-pad);
    width: auto;
  }
  .mb-label {
    grid-column: 1 / -1;
  }
  .mb-barcell {
    min-width: 0;
  }
  .mb-bars--dist .mb-label,
  .mb-bars--dist .mb-barcell {
    width: auto;
  }
  /* The distribution's short labels sit beside their bars. */
  .mb-bars--dist .mb-row {
    grid-template-columns: 6.5em minmax(0, 1fr) 3.5em;
  }
  .mb-bars--dist .mb-label {
    grid-column: auto;
  }
  .mb-bars--dist thead tr {
    grid-template-columns: 6.5em minmax(0, 1fr) 3.5em;
  }
  .mb-bars--dist thead th:first-child {
    display: block;
  }
  .mb-card {
    padding: 1.25rem 1rem;
  }
  .mb-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .mb-tiles {
    grid-template-columns: minmax(0, 1fr);
  }
  .mb-tile + .mb-tile {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--color-rule);
  }
  .mb-method {
    grid-template-columns: minmax(0, 1fr);
  }
  .mb-method dt {
    border-bottom: 0;
    padding-bottom: 0;
  }
  .mb-method dd {
    padding-top: 0.25rem;
  }
}
