:root {
  --bg: #0f1214;
  --bg-elevated: #181b1f;
  --bg-card: #1c2125;
  --bg-card-hover: #232830;
  --border: #2d353a;
  --border-strong: #3d4a52;
  --text: #e8ecf0;
  --text-muted: #9aa3ab;
  --text-dim: #6d757d;
  --accent: #7ab8d4;
  --accent-strong: #9fd4ea;
  --accent-soft: rgba(122, 184, 212, 0.14);
  --accent-glow: rgba(122, 184, 212, 0.28);
  --warn: #d4a574;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(122, 184, 212, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(90, 140, 180, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(60, 80, 110, 0.15), transparent 60%);
  z-index: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.invisible {
  visibility: hidden;
}

.site-header,
.main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 18, 20, 0.72);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: var(--accent-strong);
  background: linear-gradient(145deg, var(--accent-soft), rgba(122, 184, 212, 0.05));
  border: 1px solid rgba(122, 184, 212, 0.28);
  box-shadow: 0 0 24px var(--accent-glow);
}

.brand h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-pill {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(122, 184, 212, 0.25);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.35rem 0.2rem 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.25);
  max-width: min(100%, 17.5rem);
}

.lang-globe {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  color: var(--text-dim);
  margin-inline-start: 0.15rem;
}

.lang-select {
  appearance: none;
  border: none;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%239aab9e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 0.35rem center / 0.75rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 550;
  padding: 0.35rem 1.35rem 0.35rem 0.35rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
  max-width: 14.5rem;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  outline: none;
  transition: color 0.15s, background-color 0.15s;
}

.lang-select:hover {
  color: var(--accent-strong);
}

.lang-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lang-select option {
  background: var(--bg-elevated);
  color: var(--text);
}

html[dir="rtl"] .lang-select {
  background-position: left 0.35rem center;
  padding: 0.35rem 0.35rem 0.35rem 1.35rem;
}

html[dir="rtl"] .search-icon {
  left: auto;
  right: 1rem;
}

html[dir="rtl"] #searchInput {
  padding: 0.95rem 2.85rem 0.95rem 2.6rem;
}

html[dir="rtl"] .clear-btn {
  right: auto;
  left: 0.7rem;
}

.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.filters {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.search-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 0.95rem 2.6rem 0.95rem 2.85rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#searchInput::placeholder {
  color: var(--text-dim);
}

#searchInput::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.clear-btn {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: var(--border);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.clear-btn:hover {
  background: var(--border-strong);
}

.combo {
  position: relative;
}

.combo input[type="text"],
.combo input[type="number"],
.combo input[type="search"] {
  padding-right: 2.35rem;
}

html[dir="rtl"] .combo input[type="text"],
html[dir="rtl"] .combo input[type="number"],
html[dir="rtl"] .combo input[type="search"] {
  padding-right: 0.85rem;
  padding-left: 2.35rem;
}

/* Hide native number spinners so clear × stays usable */
.combo input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.combo input[type="number"]::-webkit-outer-spin-button,
.combo input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

html[dir="rtl"] .combo .clear-btn {
  right: auto;
  left: 0.45rem;
}

.combo .clear-btn {
  right: 0.45rem;
  width: 24px;
  height: 24px;
  font-size: 1.05rem;
  border-radius: 6px;
}


.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.field select,
.field input[type="text"],
.field input[type="number"],
.field input[type="search"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
  appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field select:focus,
.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-reset {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-reset:hover {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--accent);
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.35rem 0 0.9rem;
}

.results-bar p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.results-bar strong {
  color: var(--text);
  font-weight: 650;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-wrap label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.sort-wrap select {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.card:hover {
  border-color: rgba(122, 184, 212, 0.45);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.maker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(122, 184, 212, 0.22);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

.pattern {
  margin: 0.45rem 0 0;
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.size {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.spec-wide {
  grid-column: 1 / -1;
}

.spec {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}

.spec-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}

.spec-value {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

/* RC source chip on tire cards – subtle trust badge */
.spec .rc-source {
  display: inline-block;
  margin-top: 0.28rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.25;
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.spec .rc-source--manufacturer {
  color: #9fd4e8;
  background: rgba(120, 190, 220, 0.16);
  border: 1px solid rgba(120, 190, 220, 0.4);
}
.spec .rc-source--catalog {
  color: #a8c4d4;
  background: rgba(120, 170, 200, 0.1);
  border: 1px solid rgba(120, 170, 200, 0.28);
}
.spec .rc-source--stro {
  color: #b8c8d4;
  background: rgba(140, 160, 180, 0.1);
  border: 1px solid rgba(140, 160, 180, 0.28);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(24, 31, 25, 0.5);
}

.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.site-footer p {
  margin: 0 0 0.4rem;
  max-width: 70ch;
}

.footer-meta {
  color: var(--text-dim);
  opacity: 0.8;
}

@media (max-width: 900px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .header-inner {
    padding: 1rem;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .lang-switcher {
    margin-inline-start: auto;
    max-width: 100%;
  }

  .lang-select {
    max-width: min(14.5rem, calc(100vw - 5.5rem));
  }

  .brand h1 {
    font-size: 1.25rem;
  }

  .main {
    padding: 1rem 1rem 2.5rem;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .field-actions .invisible {
    display: none;
  }

  .results {
    grid-template-columns: 1fr;
  }

  .results-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-wrap {
    justify-content: space-between;
  }

  .sort-wrap select {
    flex: 1;
  }
}

/* —— Tabs —— */
.tab-nav {
  position: relative;
  z-index: 15;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem 0;
  /* v3.5.1: two explicit rows (left to right); scrolls horizontally together if it overflows */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.tab-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  width: max-content;
}

@media (max-width: 560px) {
  .tab-nav {
    gap: 0.3rem;
    padding-left: 0.6rem !important;
    padding-right: 0.6rem !important;
  }
  .tab-row {
    gap: 0.3rem;
  }
  .tab-nav .tab-btn {
    font-size: 0.82rem;
    padding: 0.45rem 0.55rem;
  }
}

/* Soft right-edge fade hint only when the bar really overflows (class set by app.js) */
@media (max-width: 900px) {
  .tab-nav.is-overflowing {
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 1.1rem), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 1.1rem), transparent 100%);
  }
}

.tab-btn {
  appearance: none;
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: center;
  touch-action: manipulation;
  border: 1px solid var(--border);
  background: rgba(24, 31, 25, 0.7);
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.tab-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.tab-btn.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: rgba(122, 184, 212, 0.45);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.tab-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tab-panel[hidden] {
  display: none !important;
}

/* —— Fördrift —— */
.fordrift-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.fordrift-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.fordrift-intro {
  margin: 0;
  color: var(--text-muted);
  max-width: 65ch;
}

.fordrift-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.fordrift-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.fordrift-inputs .field:nth-child(n + 3),
.fordrift-inputs .field-actions {
  grid-column: 1 / -1;
}

.fordrift-inputs input[type="number"],
.fordrift-picker input[type="text"],
.fordrift-picker select:not(.tire-pick-list) {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.fordrift-inputs input[type="number"]:focus,
.fordrift-picker input[type="text"]:focus,
.fordrift-picker select:not(.tire-pick-list):focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.picker-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
}

.picker-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.picker-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.picker-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.picker-list-head label {
  margin: 0;
}

.picker-match-count {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.tire-pick-list {
  width: 100%;
  min-height: 6.75rem;
  max-height: 7.5rem;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  outline: none;
}

.tire-pick-list:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tire-pick-list option {
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  min-height: 2rem;
}

.picker-status {
  margin: 0.45rem 0 0;
  min-height: 1.15rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.picker-target {
  margin-top: 0.55rem;
}

.picker-target-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.picker-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.btn-fill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.1rem;
  min-height: 3.1rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(122, 184, 212, 0.4);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: start;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-fill-axle {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.15;
}

.btn-fill-sub {
  font-size: 0.72rem;
  font-weight: 500;
  font-family: var(--mono);
  color: var(--text-muted);
  opacity: 0.95;
}

.btn-fill-front {
  border-color: rgba(110, 168, 220, 0.45);
  background: rgba(110, 168, 220, 0.12);
  color: #9ec8ea;
}

.btn-fill-rear {
  border-color: rgba(122, 184, 212, 0.45);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.btn-fill:hover:not(:disabled) {
  box-shadow: 0 0 0 2px rgba(122, 184, 212, 0.18);
}

.btn-fill-front:hover:not(:disabled) {
  background: rgba(110, 168, 220, 0.2);
  border-color: rgba(110, 168, 220, 0.7);
  box-shadow: 0 0 0 2px rgba(110, 168, 220, 0.18);
}

.btn-fill-rear:hover:not(:disabled) {
  background: rgba(122, 184, 212, 0.22);
  border-color: var(--accent);
}

.btn-fill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-fill.is-filled .btn-fill-sub {
  color: inherit;
  opacity: 0.9;
}

@media (max-width: 560px) {
  .picker-filters {
    grid-template-columns: 1fr;
  }
}

.fordrift-btn-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: stretch;
}

.btn-primary {
  flex: 1;
  min-width: 8rem;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: linear-gradient(180deg, #8fc8e8 0%, var(--accent) 100%);
  color: #0b1014;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s, transform 0.05s;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 16px rgba(122, 184, 212, 0.22);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: translateY(1px);
}

.fordrift-actions .btn-reset {
  flex: 0 0 auto;
  min-width: 7rem;
}

.metric-value.is-ok {
  color: var(--accent-strong);
}

.metric-value.is-warn {
  color: #e6b35a;
}

.metric-value.is-bad {
  color: #e07a7a;
}

.fordrift-results {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.fordrift-results h3 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}

.fordrift-placeholder {
  margin: 0;
  color: var(--text-muted);
}

.fordrift-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.metric {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
}

.metric-wide {
  grid-column: 1 / -1;
}

.metric-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}

.metric-value {
  font-size: 1.05rem;
  font-weight: 550;
  color: var(--text);
}

.metric-value.mono,
.mono {
  font-family: var(--mono);
}

.fordrift-assumption {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 75ch;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .fordrift-grid {
    grid-template-columns: 1fr;
  }

  .fordrift-inputs {
    grid-template-columns: 1fr;
  }

  .fordrift-inputs .field:nth-child(n + 3),
  .fordrift-inputs .field-actions {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .tab-nav {
    padding: 0.65rem 1rem 0;
  }

  .fordrift-metrics {
    grid-template-columns: 1fr;
  }

  .metric-wide {
    grid-column: auto;
  }
}


/* —— Katalog product thumbnails + lightbox —— */
.card {
  flex-direction: row;
  align-items: stretch;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem 0.95rem;
}

.card-thumb {
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #121518;
  overflow: hidden;
  cursor: zoom-in;
  align-self: center;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.card-thumb:hover,
.card-thumb:focus-visible {
  border-color: rgba(122, 184, 212, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
  transform: scale(1.02);
}

.card-thumb-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #121518;
}

.card--no-thumb {
  /* Text-only card when no tire-only catalog image is available */
}

.card-thumb[hidden] {
  display: none !important;
}

.card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(6, 10, 8, 0.88);
  backdrop-filter: blur(8px);
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-figure {
  margin: 0;
  max-width: min(920px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 3rem);
  width: auto;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: #101316;
  box-shadow: var(--shadow);
  object-fit: contain;
}

.lightbox-caption {
  color: var(--text-muted);
  font-size: 0.92rem;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  outline: none;
}

@media (max-width: 520px) {
  .card {
    flex-direction: column;
  }
  .card-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: 180px;
    align-self: center;
  }
}


/* —— Teoretisk fördrift —— */
.teor-inputs {
  max-width: 40rem;
}

.teor-inputs input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.teor-inputs input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.teor-catalog {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.teor-match-block {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.teor-match-heading {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-weight: 650;
}

.teor-match-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.teor-match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.teor-match-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  font-size: 0.86rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.teor-match-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.teor-match-main {
  color: var(--text);
}

.teor-match-rc {
  color: var(--text-muted);
  white-space: nowrap;
}

.teor-match-delta {
  color: var(--text-dim);
  font-size: 0.8em;
}

/* Traktorer tab */
.tractor-card .card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.tractor-hk-pill {
  flex: 0 0 auto;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(126, 200, 120, 0.14);
  border: 1px solid rgba(126, 200, 120, 0.35);
  color: #b0e0ef;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.tractor-specs .tractor-note {
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0.85;
  white-space: normal;
}
.tractor-disclaimer {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.8rem;
  line-height: 1.4;
  opacity: 0.7;
  max-width: 70rem;
}
.tractor-specs .spec {
  position: relative;
}
.spec-status {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  width: fit-content;
}
.spec-status.is-catalog {
  color: #9fd4e8;
  background: rgba(120, 190, 220, 0.14);
  border: 1px solid rgba(120, 190, 220, 0.35);
}
.spec-status.is-missing {
  color: #c9b8a0;
  background: rgba(180, 150, 110, 0.12);
  border: 1px solid rgba(180, 150, 110, 0.3);
}
.spec-value.is-missing-value {
  color: var(--text-dim);
  font-style: italic;
  opacity: 0.85;
}
/* align hk pill with blue theme */
.tractor-hk-pill {
  background: rgba(120, 190, 220, 0.14);
  border: 1px solid rgba(120, 190, 220, 0.35);
  color: #b0e0ef;
}

@media (max-width: 640px) {
  .tractor-hk-pill {
    font-size: 0.75rem;
  }
}

.spec-status.is-user {
  color: #f0d7a8;
  background: rgba(210, 160, 70, 0.16);
  border: 1px solid rgba(210, 160, 70, 0.5);
}
.gear-lines {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.gear-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}
.gear-line .spec-value {
  margin-right: 0.15rem;
}
.gear-line .spec-status {
  margin-top: 0;
}
.gear-vario,
.gear-calc-note,
.gear-user-msg,
.gear-source-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #e7c9a0;
}
.gear-user-form {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
  align-items: center;
}
.gear-user-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-family: var(--mono);
}
.gear-user-form input.is-warn {
  border-color: rgba(210, 160, 70, 0.8);
}
.gear-user-form button,
.gear-use {
  flex: 0 0 auto;
  margin-top: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.gear-user-form button {
  margin-top: 0;
  background: rgba(120, 190, 220, 0.16);
  border-color: rgba(120, 190, 220, 0.4);
}
.gear-user-msg.is-error { color: #e7b0a8; }
.gear-user-msg.is-ok { color: #b7d7c4; }


/* —— Show more (paged results) —— */
.show-more-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.25rem;
}
.btn-show-more {
  appearance: none;
  min-width: min(100%, 18rem);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-show-more:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--bg-card);
}
.btn-show-more:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Native selects: reliable first-tap open on touch + no iOS zoom jank */
.field select,
.sort-wrap select,
.fordrift-picker select:not(.tire-pick-list),
.lang-select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.field select,
.fordrift-picker select:not(.tire-pick-list) {
  font-size: 16px; /* iOS: avoid focus-zoom that steals the first tap */
}
@media (max-width: 560px) {
  .sort-wrap select,
  .lang-select {
    font-size: 16px;
  }
}

/* —— Tryckguide —— */
.tryck-only-wrap {
  margin: 0.25rem 0 0.5rem;
}
.check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.35;
}
.check-label input {
  margin-top: 0.2rem;
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}
.tryck-warn,
.tryck-missing {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.4;
}
.tryck-warn {
  background: rgba(210, 160, 70, 0.12);
  border: 1px solid rgba(210, 160, 70, 0.45);
  color: #e7c9a0;
}
.tryck-missing {
  background: rgba(180, 100, 100, 0.12);
  border: 1px solid rgba(200, 120, 120, 0.4);
  color: #e7b0a8;
}
.tryck-table-wrap {
  margin-top: 1rem;
}
.tryck-table-wrap h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.tryck-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.tryck-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  white-space: nowrap;
}
.tryck-table th,
.tryck-table td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.tryck-table th:first-child,
.tryck-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-elevated);
  z-index: 1;
}
.tryck-table thead th {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text-muted);
}
.tryck-table tbody tr:last-child td {
  border-bottom: none;
}
.tryck-disclaimer {
  margin-top: 1rem !important;
}
.tryck-panel .tire-pick-list {
  min-height: 9rem;
}

/* —— Kostnad / h (user calculator) —— */
.kostnad-badge {
  display: inline-block;
  margin: 0.35rem 0 0.5rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent, #f0c14b);
  background: color-mix(in srgb, var(--accent, #f0c14b) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #f0c14b) 35%, transparent);
}
.kostnad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.kostnad-card {
  min-width: 0;
}
.kostnad-card .tire-pick-list {
  min-height: 7.5rem;
}
.kostnad-actions {
  margin-bottom: 1rem;
}
.kostnad-results .metric.is-winner .metric-value {
  color: var(--ok, #6bcb77);
}
@media (max-width: 820px) {
  .kostnad-grid {
    grid-template-columns: 1fr;
  }
}


.app-version {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.95;
}

/* —— Däckpar (v3.5) —— */
.dackpar-grid .picker-filters .field input[type="text"] {
  font-size: 16px;
}
.dackpar-panel select,
.dackpar-panel input,
.dackpar-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.dackpar-panel select {
  font-size: 16px;
}
.dackpar-panel select:disabled {
  opacity: 0.55;
}
.dackpar-gear {
  margin-top: 0.35rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
}
.dackpar-gear-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
}
.dackpar-gear-head .metric-label {
  flex: 1 0 100%;
  margin: 0;
}
.dackpar-gear-value {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.dackpar-gear-head .spec-status {
  margin-top: 0;
}
.dackpar-gear-manual {
  margin-top: 0.65rem;
}
.dackpar-std {
  margin-top: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(122, 184, 212, 0.3);
}
.dackpar-std-title {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
}
.dackpar-std-sizes,
.dackpar-std-example {
  margin: 0.2rem 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}
.dackpar-std-example {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.dackpar-std-lead {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.dackpar-axle-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.dackpar-results {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.dackpar-card {
  gap: 0.6rem;
}
.dackpar-card:hover {
  transform: none;
}
.dackpar-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}
.dackpar-card-lead {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  text-align: right;
}
.dackpar-card-lead .spec-label {
  margin: 0;
}
.dackpar-lead {
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1.1;
}
.dackpar-verdict {
  margin-top: 0;
}
.dackpar-axle {
  border-top: 1px solid var(--border);
  padding-top: 0.55rem;
}
.dackpar-axle-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
}
.dackpar-axle-head .spec-status {
  margin-top: 0;
}
.dackpar-axle-maker {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--accent-strong);
}
.dackpar-size {
  margin: 0.2rem 0 0.4rem;
  line-height: 1.3;
}
.dackpar-size .size {
  font-size: 1rem;
}
.dackpar-dot {
  color: var(--text-dim);
}
.dackpar-pattern {
  font-weight: 600;
  color: var(--text);
}
.dackpar-specs {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.dackpar-specs .spec .spec-status {
  margin-top: 0.1rem;
}
.dackpar-specs .spec .rc-source {
  margin-left: 0.35rem;
}
.dackpar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.dackpar-btn {
  flex: 1 1 0;
  min-width: 0;
  line-height: 1.2;
  min-height: 2.4rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(122, 184, 212, 0.4);
  background: rgba(120, 190, 220, 0.1);
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.dackpar-btn:hover {
  background: rgba(120, 190, 220, 0.2);
  border-color: var(--accent);
}
.dackpar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 560px) {
  .dackpar-results {
    grid-template-columns: 1fr;
  }
}

/* Däckpar v3.5.1: locked same-brand option while same pattern is on */
.check-label.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* v3.6.4: Traktorer model search single hit + status toast */
.tractor-card.is-picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}
.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1100;
  width: max-content;
  max-width: min(92vw, 28rem);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  animation: app-toast-in 0.18s ease-out;
  transition: opacity 0.25s ease;
}
.app-toast[hidden] {
  display: none;
}
.app-toast.is-out {
  opacity: 0;
}
@keyframes app-toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 0.5rem);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .app-toast {
    animation: none;
    transition: none;
  }
}
