/* Troškovi po stavkama (kartica #41): „Firma ukupno” i četiri kućice ispod nje u izračunu auta, polja na vrhu aukcije i
   tablica zadanih troškova. Bez novih boja — samo postojeći tokeni. */

/* --- (1) Redak vozila: „Firma ukupno” je jedno od glavnih polja, četiri kućice su točno ispod nje ------------------
   Matija 16.11.: „firma ukupno neka i dalje bude gore kao jedan od ovih glavnih redova, a ispod firme neka budu
   troškovi samog auta… to se zbraja u taj jedan gore”. Prvi red: Prodajna · Firma ukupno · PPV · Troškovi · Moj max
   bid (kao prije stavki). Kućice su u DOM-u zadnje (Tab ide kao prije), pa ih ovdje stavljamo u 2. stupac od 2. reda.
   Napomene i raščlambe idu desno od kućica (ispod PPV-a, Troškova i Max bida), da redak ne raste više nego mora. */
.ac-calc.has-cost { grid-template-columns: minmax(0, 1fr) minmax(210px, 1.25fr) repeat(3, minmax(0, 1fr)); }
.ac-calc.has-cost > .row-cost { grid-column: 2; grid-row: 2 / span 4; }
.ac-calc.has-cost > .row-calc-note,
.ac-calc.has-cost > .row-calc-warning,
.ac-calc.has-cost > .pc-f-hint { grid-column: 3 / -1; }

/* „Firma ukupno”: izgleda kao polje, ali se ne upisuje (zbroj stavki ispod) — zato mirna podloga i bez ruba fokusa */
.row-cost-sum output {
  display: block;
  height: 32px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 22px;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-cost {
  display: grid;
  gap: 3px;
  align-content: start;
  min-width: 0;
  padding: 7px 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.row-cost-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
}

.row-cost-line > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-cost-line input {
  min-height: 26px;
  height: 26px;
  padding: 2px 7px;
  font-size: 12.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: var(--surface);
}

.row-cost-line input::placeholder { color: var(--ink-4); font-weight: 450; }

/* naknadu računa cjenik aukcije (Autorola, Autobid): iznos se samo pokazuje */
.row-cost-line.is-auto output {
  height: 26px;
  padding: 2px 7px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm, 6px);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  text-align: right;
}

/* stari spremljeni izračun: „Firma” je jedna brojka + poveznica za podjelu */
.row-cost-legacy { font-weight: 450; }

button.row-cost-split {
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--brand-strong);
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

button.row-cost-split:hover:not(:disabled) { background: none; color: var(--brand); }

/* srednje širok popis (660–760 px): pet polja u redu, pa je stupac „Firme ukupno” malo uži */
@container acrows (max-width: 759.98px) {
  .ac-calc.has-cost { grid-template-columns: minmax(0, 1fr) minmax(190px, 1.25fr) repeat(3, minmax(0, 1fr)); }
  .ac-calc.has-cost .row-cost-line { grid-template-columns: minmax(0, 1fr) 72px; }
}

/* uski popis i mobitel (isti prag kao kartica auta, styles.css @container acrows): dva stupca; prvi red Prodajna +
   Firma ukupno, kućice preko cijele širine odmah ispod, pa PPV + Troškovi, pa Moj max bid preko cijele širine */
@container acrows (max-width: 659.98px) {
  .ac-calc.has-cost { grid-template-columns: 1fr 1fr; }
  .ac-calc.has-cost > .row-calc-field:first-child,
  .ac-calc.has-cost > .row-cost-sum { order: -2; }
  .ac-calc.has-cost > .row-cost { grid-column: 1 / -1; grid-row: auto; order: -1; }
  .ac-calc.has-cost > .max-bid-input { grid-column: 1 / -1; }
  .ac-calc.has-cost > .row-calc-note,
  .ac-calc.has-cost > .row-calc-warning,
  .ac-calc.has-cost > .pc-f-hint { grid-column: 1 / -1; }
  .ac-calc.has-cost .row-cost-line { grid-template-columns: minmax(0, 1fr) 110px; }
}

/* Procjena (desni stupac detalja auta): PPV + Troškovi, pa „Firma ukupno” i kućice ispod nje, pa „Moj max bid” */
.pc-calc-box .ac-calc.has-cost { grid-template-columns: 1fr 1fr; }
.pc-calc-box .ac-calc.has-cost > .row-calc-field:first-child { order: -2; }
.pc-calc-box .ac-calc.has-cost > .row-cost-sum { grid-column: 1 / -1; order: 3; }
.pc-calc-box .ac-calc.has-cost > .row-cost { grid-column: 1 / -1; grid-row: auto; order: 4; }
.pc-calc-box .ac-calc.has-cost > .row-calc-note,
.pc-calc-box .ac-calc.has-cost > .row-calc-warning,
.pc-calc-box .ac-calc.has-cost > .pc-f-hint { grid-column: 1 / -1; }
.pc-calc-box .ac-calc.has-cost .row-cost-line { grid-template-columns: minmax(0, 1fr) 110px; }

/* „Puni kalkulator” na detalju auta: „Firma ukupno” kao polje (zbroj), kućice ispod nje */
.field.detail-cost { grid-column: 1 / -1; max-width: 360px; }
.field.detail-cost .detail-cost-sum {
  display: block;
  min-height: var(--control-h);
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
}
.field.detail-cost .row-cost-line { grid-template-columns: minmax(0, 1fr) 130px; font-size: 12.5px; }
.field.detail-cost .row-cost-line input { height: 32px; min-height: 32px; font-size: 13px; }

/* --- (2) Troškovi po autu na ovoj aukciji (vrh liste aukcije) ---------------------------------------------------- */
.auction-costs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 14px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.auction-costs.is-set {
  border-style: solid;
  border-color: var(--brand-line);
  background: var(--brand-soft);
}

.auction-costs-title {
  flex: 1 0 100%;
  color: var(--ink);
  font-size: 13px;
  font-weight: 560;
}

.auction-costs-fields { display: flex; flex-wrap: wrap; gap: 8px 10px; }

.auction-costs-field {
  display: grid;
  gap: 3px;
  width: 128px;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
}

.auction-costs-field input {
  min-height: 32px;
  height: 32px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.auction-costs-field input::placeholder { color: var(--ink-4); font-weight: 450; }
.auction-costs-field.is-auto em { height: 32px; color: var(--ink-3); font-size: 12.5px; font-style: normal; line-height: 32px; }

.auction-costs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.auction-costs-actions button { white-space: nowrap; }
.auction-costs-actions .ghost { display: inline-flex; align-items: center; gap: 5px; }

.auction-costs small {
  flex-basis: 100%;
  color: var(--ink-3);
  font-size: 12px;
}

.auction-costs .error-text { color: var(--danger); }

/* --- (3) Zadani troškovi po autu (tablica) ----------------------------------------------------------------------- */
.cost-settings-card { display: grid; gap: 10px; }
.cost-settings-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cost-settings-head h2 { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.cost-settings-lead,
.cost-settings-note { margin: 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }
.cost-settings-form { display: grid; gap: 10px; }
.cost-settings-scroll { overflow-x: auto; }

.cost-settings-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; }

.cost-settings-table th,
.cost-settings-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }

.cost-settings-table thead th {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.cost-settings-table tbody th { color: var(--ink); font-weight: 560; white-space: nowrap; }
.cost-settings-table tr.is-all th { font-weight: 650; }
.cost-settings-table tr.is-country th { padding-left: 22px; color: var(--ink-2); font-weight: 500; }
.cost-settings-table td.num { font-variant-numeric: tabular-nums; text-align: right; }
.cost-settings-table td.is-inherited,
.cost-settings-table td.is-auto { color: var(--ink-4); }
.cost-settings-table td.is-auto { font-size: 12px; white-space: nowrap; }
.cost-settings-table td.cost-settings-total { color: var(--ink-2); font-weight: 600; white-space: nowrap; }

.cost-settings-table input {
  width: 104px;
  min-height: 30px;
  height: 30px;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.cost-settings-table input::placeholder { color: var(--ink-4); font-weight: 450; }

.cost-settings-add,
.cost-settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cost-settings-add label { color: var(--ink-3); font-size: 12.5px; font-weight: 560; }
.cost-settings-add select { width: auto; min-width: 150px; }
