/* ---------------------------------------------------------------------------
   /lt/kuro-normu-skaiciuokle — the fuel norm calculator.

   A separate stylesheet for the same reasons as sablonai.css: only this page uses
   it, and adding rules to pages.css would mean bumping its shared ?v= cache key.
   Loaded with <link rel="stylesheet" precedence="default"> from the page, so it
   is same-origin and satisfies `style-src 'self'` in middleware.ts. Tokens come
   from pages.css, which the layout always loads first.

   Light only, like every other content page.
   --------------------------------------------------------------------------- */

.tk .kn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 24px 24px;
  margin: 26px 0 8px;
  box-shadow: var(--shadow-sm);
}

.tk .kn h2 {
  margin: 0 0 4px;
  font-size: 21px;
}

.tk .kn .kn-lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14.5px;
}

.tk .kn-grid {
  display: grid;
  gap: 22px;
}
@media (min-width: 860px) {
  .tk .kn-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: start;
  }
  /* The result stays in view while the visitor works down the corrections. */
  .tk .kn-result {
    position: sticky;
    top: 86px;
  }
}

/* fieldset ships with its own margin, padding and border in every browser. */
.tk .kn fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.tk .kn legend {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 8px;
  padding: 0;
}

/* ---------- basis (l/100 km or l/mval.) ---------- */

.tk .kn-basis {
  margin: 0 0 22px;
}
.tk .kn-basis .kn-radio {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 14px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--card);
}
.tk .kn-basis .kn-radio:first-of-type {
  border-radius: 12px 12px 0 0;
}
.tk .kn-basis .kn-radio:last-of-type {
  border-radius: 0 0 12px 12px;
  border-top: 0;
}
.tk .kn-basis .kn-radio:has(input:checked) {
  background: var(--blue-soft);
}
.tk .kn-radio input {
  margin: 4px 0 0;
  flex: none;
}
.tk .kn-radio .t {
  display: block;
  font-weight: 600;
  font-size: 15px;
}
.tk .kn-radio .d {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------- fields ---------- */

.tk .kn-field {
  margin: 0 0 18px;
}
.tk .kn-field > label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 5px;
}

.tk .kn input[type="text"],
.tk .kn select {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  transition: border-color 0.12s ease;
}
.tk .kn-field input[type="text"] {
  width: 100%;
  max-width: 220px;
  padding: 10px 12px;
}
.tk .kn input[type="text"]:focus,
.tk .kn select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.tk .kn input[type="checkbox"],
.tk .kn input[type="radio"] {
  accent-color: var(--blue);
  width: 17px;
  height: 17px;
}
.tk .kn input[type="checkbox"]:focus-visible,
.tk .kn input[type="radio"]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.tk .kn input:disabled,
.tk .kn select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tk .kn input[aria-invalid="true"] {
  border-color: var(--amber);
}

.tk .kn-hint {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}
.tk .kn-err {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--amber);
  margin-top: 4px;
}

/* ---------- corrections ---------- */

.tk .kn-coefs {
  margin: 0 0 18px;
}
.tk .kn-coef {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.tk .kn-coef:last-child {
  border-bottom: 1px solid var(--line);
}
.tk .kn-coef > input[type="checkbox"] {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
}
.tk .kn-coef > label {
  grid-column: 2;
  grid-row: 1;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.tk .kn-coef > .kn-num {
  grid-column: 3;
  grid-row: 1;
}
.tk .kn-coef > .kn-sub,
.tk .kn-coef > .kn-modes,
.tk .kn-coef > .kn-pair,
.tk .kn-coef > .kn-hint,
.tk .kn-coef > .kn-err {
  grid-column: 2 / -1;
}

.tk .kn-num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.tk .kn-num input[type="text"] {
  width: 5.2em;
  text-align: right;
}

.tk .kn-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
}
.tk .kn-sub > label {
  color: var(--muted);
}

.tk .kn fieldset.kn-modes {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  font-size: 14px;
}
.tk .kn-modes label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.tk .kn-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

/* Visually hidden, still announced — for legends the layout does not need. */
.tk .kn-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- result ---------- */

.tk .kn-result {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  font-variant-numeric: tabular-nums;
}
.tk .kn-result h3 {
  margin: 0 0 6px;
  font-size: 17px;
}
.tk .kn-result p {
  font-size: 14.5px;
  margin: 0 0 12px;
}
/* Visible only when a field needs fixing (otherwise it is screen-reader only). */
.tk .kn-result .kn-summary {
  font-weight: 600;
  color: var(--amber);
}
.tk .kn-rows,
.tk .kn-final {
  margin: 0 0 12px;
}
.tk .kn-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14.5px;
}
.tk .kn-row > :last-child {
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
  text-align: right;
}
.tk .kn-final .kn-row {
  font-size: 16px;
  border-bottom: 0;
  padding: 4px 0;
}
.tk .kn-final .kn-row strong {
  font-size: 17px;
}
.tk .kn-final {
  border-top: 2px solid var(--ink);
  padding-top: 6px;
}
.tk .kn-result .kn-formula {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}
.tk .kn-result .kn-example {
  background: var(--card);
  border-left: 3px solid var(--blue);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
}
.tk .kn-result .kn-next {
  margin: 0;
  font-size: 14px;
}

@media (max-width: 520px) {
  .tk .kn {
    padding: 18px 16px 20px;
  }
  /* Breakdown labels may wrap; the two final norms stay on one line each. */
  .tk .kn-rows .kn-row {
    flex-wrap: wrap;
  }
}
