/* Wyrm Gear Parts Analyzer — dark steel + forest theme */

:root {
  --bg:        #16171a;
  --bg-card:   #1f2024;
  --bg-input:  #2a2b30;
  --bg-hover:  #34363c;
  --border:    #34363c;
  --border-soft: #2a2b30;

  --text:      #e8e6e1;
  --text-dim:  #9a9ca3;
  --text-faint:#6b6d74;

  --accent:    #3a9b6a;   /* forest green */
  --accent-hover: #4db380;
  --accent-dim: #2a6b4a;

  --good:      #6fbf73;
  --bad:       #e0625a;

  --radius: 6px;
  --font-ui: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.muted { color: var(--text-dim); }

/* ─── Topbar ─────────────────────────────────────────────────────────── */

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-logo.large {
  width: 112px;
  height: 112px;
  margin: 0 auto;
}

.brand-text .accent,
h1 .accent {
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav a {
  color: var(--text-dim);
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}

.nav a:hover { color: var(--text); }

.nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.nav-user {
  color: var(--text-faint);
  font-size: 13px;
}

.nav a.logout {
  color: var(--text-faint);
  font-size: 13px;
}
.nav a.logout:hover { color: var(--bad); }

/* ─── Page layout ────────────────────────────────────────────────────── */

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* ─── Forms ──────────────────────────────────────────────────────────── */

.selector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

select, input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 10px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}

select:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
}

.generation-label {
  margin-top: 14px;
  font-size: 13px;
  color: var(--good);
  font-family: var(--font-mono);
}

/* ─── Buttons ────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1a;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  border-color: var(--accent-dim);
  color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
}

.btn-block { width: 100%; }

.btn-large {
  font-size: 15px;
  padding: 13px 24px;
}

.btn-small {
  font-size: 12px;
  padding: 6px 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Auth pages ─────────────────────────────────────────────────────── */

.auth-page {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin: 0 auto;
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand h1 {
  font-size: 20px;
  margin: 14px 0 4px;
}

.auth-tagline {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 10px;
}

.auth-form .auth-remember {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  user-select: none;
}

.auth-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent, #3fa34d);
  cursor: pointer;
}

.auth-remember span {
  line-height: 1;
}

.auth-form button {
  margin-top: 18px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin: 2px 0 0;
}

.account-form {
  max-width: 400px;
}

.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.plan-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin: 20px 0 0;
}

/* ─── Flash messages ─────────────────────────────────────────────────── */

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.flash {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  border: 1px solid transparent;
}

.flash-error {
  background: rgba(224, 98, 90, 0.12);
  border-color: rgba(224, 98, 90, 0.35);
  color: var(--bad);
}

.flash-success {
  background: rgba(111, 191, 115, 0.12);
  border-color: rgba(111, 191, 115, 0.35);
  color: var(--good);
}

/* ─── Parts panel ────────────────────────────────────────────────────── */

.parts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.parts-header h2 { margin: 0; }

.parts-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.parts-save-status {
  font-size: 12px;
  color: var(--good);
  opacity: 0;
  transition: opacity 0.3s;
}
.parts-save-status.visible { opacity: 1; }

.parts-categories {
  column-width: 220px;
  column-gap: 18px;
}

.parts-category {
  break-inside: avoid;
  margin-bottom: 18px;
}

.parts-category h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin: 0 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.parts-category .cat-select-all {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.parts-category .cat-select-all:hover { color: var(--accent); }

.parts-category ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.parts-category ul li {
  break-inside: avoid;
}

.parts-category label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  break-inside: avoid;
}

.parts-category input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  margin: 0;
}

/* ─── Run / progress ─────────────────────────────────────────────────── */

.run-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.run-status {
  font-size: 13px;
  color: var(--text-dim);
  min-height: 18px;
}

.progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-input);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.run-log {
  width: 100%;
  height: 160px;
  overflow-y: auto;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.run-log div { white-space: pre-wrap; }

/* ─── Results table ──────────────────────────────────────────────────── */

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.results-header h2 { margin: 0; }

.save-status {
  font-size: 12px;
  color: var(--good);
  opacity: 0;
  transition: opacity 0.3s;
}
.save-status.visible { opacity: 1; }
.save-status.error { color: var(--bad); }

table.results-table, table.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.results-table th, table.history-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card, #1e1e1e);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
}

table.results-table td, table.history-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

table.results-table tbody tr:hover, table.history-table tbody tr:hover {
  background: var(--bg-hover);
}

.num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }

table.results-table th.num, table.history-table th.num {
  text-align: right;
}

table.results-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.results-table th.sortable:hover { color: var(--text); }
table.results-table th.sorted { color: var(--accent-hover); }

table.history-table {
  min-width: 700px;
}

.my-price { color: var(--accent); font-weight: 600; }
.my-total { color: var(--good); font-weight: 600; }

.results-table .part-name { font-weight: 600; }

/* Sticky export checkbox column */
table.results-table th:nth-child(1),
table.results-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg);
}

/* Sticky second column (Part name) */
table.results-table th:nth-child(2),
table.results-table td:nth-child(2) {
  position: sticky;
  left: 68px;
  z-index: 3;
  background: var(--bg);
}
table.results-table thead th:nth-child(1) {
  z-index: 11;
  background: var(--bg-hover);
}
table.results-table thead th:nth-child(2) {
  z-index: 11;
  background: var(--bg-hover);
}

/* Sticky last column (expand toggle) */
table.results-table th:last-child,
table.results-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  background: var(--bg);
  width: 40px;
  min-width: 40px;
  max-width: 40px;
}
table.results-table thead th:last-child {
  z-index: 11;
  background: var(--bg-hover);
}

.expand-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  transition: color 0.12s, transform 0.15s ease, background 0.12s;
}
.expand-toggle:hover { color: var(--accent); background: var(--bg-hover); }
.expand-toggle.open { color: var(--accent); transform: rotate(180deg); }

.listings-detail {
  display: none;
}
.listings-detail.open { display: table-row; }

#results-table-wrap, .table-scroll {
  overflow-x: auto;
}

table.results-table {
  table-layout: fixed;
  min-width: 760px;
  width: 100%;
}

table.results-table th:nth-child(1), table.results-table td:nth-child(1) { width: 68px; min-width: 68px; max-width: 68px; padding-left: 8px; padding-right: 8px; }
table.results-table th:nth-child(2), table.results-table td:nth-child(2) { width: 160px; min-width: 160px; }
table.results-table th:nth-child(3), table.results-table td:nth-child(3) { width: 7%; }
table.results-table th:nth-child(4), table.results-table td:nth-child(4) { width: 8%; }
table.results-table th:nth-child(5), table.results-table td:nth-child(5) { width: 8%; }
table.results-table th:nth-child(6), table.results-table td:nth-child(6) { width: 8%; }
table.results-table th:nth-child(7), table.results-table td:nth-child(7) { width: 9%; }
table.results-table th:nth-child(8), table.results-table td:nth-child(8) { width: 11%; }
table.results-table th:nth-child(9), table.results-table td:nth-child(9) { width: 11%; }
table.results-table th:nth-child(10), table.results-table td:nth-child(10) { width: 7%; }
table.results-table th:nth-child(11), table.results-table td:nth-child(11) { width: 40px; }

.listings-detail td {
  background: var(--bg-input);
  padding: 12px 16px;
  overflow: hidden;
}

.listings-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}

.listings-columns > div {
  min-width: 0;
  overflow: hidden;
}

.listings-columns h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 0 0 6px;
}

.listing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.listing-row:last-child { border-bottom: none; }

.listing-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
}

.listing-thumb-empty {
  background: var(--bg-card);
}

.listing-link {
  flex: 1;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.listing-link:hover { color: var(--accent); }

.listing-price { font-family: var(--font-mono); color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }

/* ─── Results toolbar (min value / undercut / export) ───────────────────── */

.results-toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-field label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

/* Input group wrapper — the styled box */
.filter-field .input-group, .field .input-group {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.filter-field .input-group:focus-within, .field .input-group:focus-within {
  border-color: var(--accent);
}

.filter-field .input-group .symbol, .field .input-group .symbol {
  padding: 0 8px;
  font-size: 12px;
  color: var(--text-faint);
  background: var(--bg);
  align-self: stretch;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  user-select: none;
  pointer-events: none;
}

.filter-field .input-group .symbol.suffix-sym, .field .input-group .symbol.suffix-sym {
  border-right: none;
  border-left: 1px solid var(--border);
}

.filter-field input[type="number"] {
  width: 52px;
  padding: 7px 6px;
  font-size: 13px;
  font-family: var(--font-mono);
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text);
  outline: none;
}

/* Hide spinner arrows */
.filter-field input[type="number"]::-webkit-inner-spin-button,
.filter-field input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.filter-field input[type="number"] {
  -moz-appearance: textfield;
}

.filter-field.undercut-field {
  position: static;
}

.filter-field.undercut-field input[type="number"] {
  width: 52px;
  padding-right: 6px;
  text-align: center;
}

.filter-field.undercut-field .suffix {
  display: none;
}

.toolbar-spacer { flex: 1; }

.toolbar-actions {
  display: flex;
  gap: 8px;
}

/* ─── Results totals footer ─────────────────────────────────────────────── */

.results-totals {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--bg-input);
}

.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
}

.totals-label.market, .totals-value.market { color: var(--accent-hover); }
.totals-label.my, .totals-value.my { color: var(--good); }
.totals-value { font-family: var(--font-mono); }

/* ─── Great Parts section ───────────────────────────────────────────────── */

.great-parts-card .results-header p {
  margin: 4px 0 0;
  font-size: 12px;
}

.great-listing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.great-listing:last-child { border-bottom: none; }

.great-thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.great-thumb-empty {
  background: var(--bg-card);
}

.great-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.great-title {
  font-size: 13px;
  color: var(--text);
}

.great-link {
  font-size: 12px;
}

.great-price {
  font-family: var(--font-mono);
  color: var(--good);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  padding-left: 8px;
}

.progress-fill.indeterminate {
  width: 40% !important;
  animation: indeterminate-slide 1.2s ease-in-out infinite;
}

@keyframes indeterminate-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* ─── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .selector-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-inner { flex-direction: column; gap: 10px; align-items: flex-start; }
  .nav { flex-wrap: wrap; gap: 12px; }
}

@media (max-width: 520px) {
  .selector-grid { grid-template-columns: 1fr; }
  .page { padding: 14px; }
  .card { padding: 16px; }
  .listings-columns { grid-template-columns: 1fr; }
  /* --- Mobile usability enhancements (phones <=520px) --- */
  /* 16px font on form controls prevents iOS auto-zoom; min-height enlarges tap targets */
  .field select, .field input,
  .filter-field input, .filter-field select,
  select, input[type="text"], input[type="number"], input[type="search"] {
    font-size: 16px;
  }
  .field select, .field input { min-height: 44px; }
  /* Run Analysis button: full width, comfortable tap height */
  #run-btn { width: 100%; min-height: 48px; }
  /* Export buttons stack full-width and become easily tappable */
  .toolbar-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar-actions .btn { width: 100%; min-height: 44px; }
  /* Smoother momentum scrolling on the wide results table */
  #results-table-wrap { -webkit-overflow-scrolling: touch; }
  /* Tighten export checkbox column padding so more of the table is visible */
  table.results-table th.col-export-check,
  table.results-table td.col-export-check { padding-left: 6px; padding-right: 6px; }
  /* Scale the brand text down slightly so the header fits small screens */
  .brand-text { font-size: 18px; }

  /* ===== Mobile card layout for results table (<=520px only) ===== */
  #results-table-wrap { overflow-x: visible; }
  table.results-table { display: block; width: 100%; min-width: 0; table-layout: auto; border-collapse: collapse; }
  table.results-table tbody { width: 100%; }
  table.results-table thead { display: none; }
  table.results-table tbody { display: block; }
  table.results-table tbody tr:not(.listings-detail) {
    display: block;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px 6px;
    margin: 0 0 12px;
  }
  /* reset desktop fixed column widths so cells stack full width */
  table.results-table tbody tr:not(.listings-detail) td {
    display: flex;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0 !important;
    border: none;
    text-align: right;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
  }
  table.results-table tbody tr:not(.listings-detail) td:last-child { border-bottom: none; }
  /* label from data-label on the left */
  table.results-table tbody tr:not(.listings-detail) td[data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 600;
    text-align: left;
    margin-right: 12px;
    white-space: nowrap;
  }
  /* part name = card title (full width, no label) */
  table.results-table tbody tr:not(.listings-detail) td.part-name {
    justify-content: flex-start;
    text-align: left;
    font-size: 16px;
    font-weight: 700;
    padding-top: 0 !important;
    padding-bottom: 8px !important;
  }
  /* export checkbox sits inline top-right with a label */
  table.results-table tbody tr:not(.listings-detail) td.col-export-check {
    justify-content: flex-start;
  }
  table.results-table tbody tr:not(.listings-detail) td.col-export-check::before {
    content: "Export";
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 600;
    margin-right: 12px;
  }
  table.results-table tbody tr:not(.listings-detail) td.col-export-check input { transform: scale(1.3); }
  /* expand-toggle row: full width button */
  table.results-table tbody tr:not(.listings-detail) td:last-child:not([data-label]) {
    justify-content: center;
    padding-top: 8px !important;
  }
  table.results-table tbody tr:not(.listings-detail) td:last-child:not([data-label]) .expand-toggle {
    width: 100%;
  }
  /* listings detail row stays full width */
  table.results-table tr.listings-detail.open { display: block; }
  table.results-table tr.listings-detail td { display: block; width: 100% !important; max-width: none !important; min-width: 0 !important; padding: 0; }
  /* --- Cards fill the available width comfortably (phone only) --- */
  table.results-table tbody tr:not(.listings-detail) {
    width: auto;
    max-width: 100%;
  }
  /* label on the left, value pushed to the right edge of the card */
  table.results-table tbody tr:not(.listings-detail) td {
    justify-content: space-between !important;
    gap: 16px;
  }
  /* value text right-aligned at the end of its row */
  table.results-table tbody tr:not(.listings-detail) td { text-align: right; }
  table.results-table tbody tr:not(.listings-detail) td.part-name { text-align: left; }
  /* --- Mobile eBay listing dropdown: readable, wrapping titles --- */
  table.results-table tr.listings-detail td .listings-columns { gap: 14px; }
  table.results-table tr.listings-detail td .listings-columns > div h4 {
    margin: 0 0 6px;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-dim);
  }
  table.results-table tr.listings-detail td .listing-row {
    align-items: flex-start;
    gap: 10px;
    padding: 4px 0;
    flex-wrap: wrap;
  }
  table.results-table tr.listings-detail td .listing-thumb {
    width: 52px;
    height: 52px;
  }
  table.results-table tr.listings-detail td .listing-link {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
    font-size: 14px;
    word-break: break-word;
  }
  table.results-table tr.listings-detail td .listing-price {
    flex: 0 0 100%;
    margin-left: 62px;
    font-size: 14px;
    color: var(--text);
  }
  /* --- Mobile totals: stacked label over value, aligned left --- */
  .results-totals .totals-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 0;
  }
  .results-totals .totals-label { font-size: 13px; }
  .results-totals .totals-value { font-size: 16px; }
  .results-totals .totals-row--yard,
  .results-totals .totals-row--vehicle { padding-top: 10px; margin-top: 6px; }
  .results-totals .totals-value.yard-total,
  .results-totals .totals-value.vehicle-total {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    width: 100%;
  }
}

/* —— New nav buttons: Tutorial (left), Yards, Help & Support (right) —————————— */

.topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-standalone {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.nav-standalone:hover {
  color: var(--text);
}

.nav-standalone.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* keep nav-left-group in case it is still referenced */
.nav-left-group a.active,


/* Tutorial page */
.tutorial-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 20px;
}

.tutorial-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-soft);
}

.tutorial-step:last-child {
  border-bottom: none;
}

.tutorial-step-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.tutorial-step-content h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text);
}

.tutorial-step-content p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}

.tutorial-coming-soon {
  margin-top: 24px;
  padding: 14px 18px;
  background: var(--bg-input);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-faint);
  border: 1px solid var(--border-soft);
}

/* Yards page */
.yards-coming-soon {
  text-align: center;
  padding: 48px 24px;
}

.yards-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.yards-coming-soon h3 {
  font-size: 20px;
  margin: 0 0 10px;
  color: var(--text);
}

.yards-coming-soon > p {
  color: var(--text-dim);
  font-size: 14px;
  max-width: 500px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.yards-features {
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.yards-feature {
  color: var(--text-dim);
  font-size: 14px;
}

.yards-feature .accent {
  margin-right: 8px;
}

/* Help & Support page */
.help-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 10px;
}

.help-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-soft);
}

.help-section:last-child {
  border-bottom: none;
}

.help-section h3 {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--text);
}

.faq-item {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.faq-q {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin: 0 0 6px;
}

.faq-a {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.6;
}

.help-contact {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 1px solid var(--border-soft);
  margin-top: 12px;
}

.help-contact p {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text-dim);
}

.help-contact p:last-child {
  margin-bottom: 0;
}


/* Tutorial nav-mid: matches .nav a styling exactly */
.nav-mid {
  color: var(--text-dim);
  font-weight: 500;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.nav-mid:hover {
  color: var(--text);
}

.nav-mid.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.nav-mid-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-decoration: none;
  line-height: 0;
  transition: color .15s, transform .15s;
}

.nav-discord:hover {
  color: #5865f2;
  transform: translateY(-1px);
}

.nav-discord-img {
  width: 24px;
  height: 24px;
  display: block;
  border-radius: 50%;
}

/* ---- Tutorial page redesign ---- */

.tutorial-page {
  max-width: 860px;
  gap: 0;
  padding-bottom: 40px;
}

.tutorial-hero {
  text-align: center;
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 8px;
}

.tutorial-hero h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}

.tutorial-subtitle {
  font-size: 15px;
  color: var(--text-dim);
  margin: 0;
}

.tut-step {
  padding: 32px 0;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tut-step:last-of-type {
  border-bottom: none;
}

.tut-step-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.tut-num {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: #3a9b6a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
}

.tut-step-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}

.tut-step-header p {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.65;
}

.tut-step-header a {
  color: var(--accent);
  text-decoration: none;
}

.tut-step-header a:hover {
  text-decoration: underline;
}

.tut-img-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #1a1a1a;
}

.tut-img {
  width: 100%;
  display: block;
}

.tut-img-caption {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px solid var(--border-soft);
  background: var(--bg-card);
  line-height: 1.5;
}

.tut-img-caption strong {
  color: var(--text-dim);
}

.tut-tip-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 20px;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

.tut-tip-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tut-tip-box strong {
  color: var(--text);
}

/* ========== HELP & SUPPORT PAGE ========== */
.hs-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

/* Hero */
.hs-hero {
  text-align: center;
  margin-bottom: 48px;
}
.hs-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.hs-hero p {
  color: var(--text-dim);
  font-size: 1rem;
}

/* Contact grid */
.hs-contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.hs-contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  transition: border-color 0.18s;
}
.hs-contact-card:hover {
  border-color: var(--accent);
}

.hs-contact-avatar {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  background: #3a9b6a;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}
.hs-avatar-email {
  background: #2a7a9b;
  font-size: 20px;
}

.hs-contact-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hs-contact-name {
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--text);
}
.hs-contact-role {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.hs-contact-link {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
  padding: 6px 10px;
  transition: background 0.15s, color 0.15s;
}
.hs-phone {
  color: #4db87a;
  background: rgba(74, 180, 122, 0.08);
}
.hs-phone:hover {
  background: rgba(74, 180, 122, 0.18);
  color: #6dd99a;
}
.hs-email {
  color: #5bc0de;
  background: rgba(91, 192, 222, 0.08);
}
.hs-email:hover {
  background: rgba(91, 192, 222, 0.18);
  color: #7dd4ec;
}
.hs-contact-icon {
  font-size: 15px;
}

/* Updates card on Help & Support */
.hs-contact-card--updates {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.hs-contact-card--updates:hover {
  border-color: var(--accent);
}
.hs-avatar-updates {
  background: #b8862b;
  font-size: 22px;
}
.hs-updates-link {
  color: #e0a83e;
  background: rgba(224, 168, 62, 0.08);
}
.hs-contact-card--updates:hover .hs-updates-link {
  background: rgba(224, 168, 62, 0.18);
  color: #f0c062;
}

/* Hours bar */
.hs-hours-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-bottom: 40px;
}
.hs-hours-bar strong {
  color: var(--text);
}
.hs-hours-icon {
  font-size: 18px;
}

/* Divider */
.hs-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 40px;
}

/* FAQ section */
.hs-faq-wrap {
  margin-bottom: 48px;
}
.hs-section-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

.hs-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hs-faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.18s;
}
.hs-faq-item[open] {
  border-color: var(--accent);
}

.hs-faq-q {
  padding: 16px 20px;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.hs-faq-q::-webkit-details-marker { display: none; }
.hs-faq-q::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 400;
  min-width: 20px;
  text-align: center;
  transition: transform 0.2s;
}
.hs-faq-item[open] .hs-faq-q::after {
  content: "−";
}
.hs-faq-q:hover {
  color: var(--accent);
}

.hs-faq-a {
  padding: 0 20px 18px;
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.65;
  border-top: 1px solid var(--border);
  margin: 0;
  padding-top: 14px;
}
.hs-faq-a a {
  color: var(--accent);
  text-decoration: none;
}
.hs-faq-a a:hover {
  text-decoration: underline;
}
.hs-faq-a strong {
  color: var(--text);
}

/* CTA bar */
.hs-cta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 28px;
  font-size: 0.93rem;
  color: var(--text-dim);
}
.hs-cta-btn {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
}
.hs-cta-btn:hover {
  background: #2e8057;
}

/* ========== YARD DIRECTORY ========== */
.yd-page { max-width: 900px; margin: 0 auto; padding: 40px 24px 72px; }

/* Header */
.yd-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.yd-title { font-size: 1.8rem; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.yd-subtitle { color: var(--text-dim); font-size: 0.9rem; margin: 0; }

.yd-add-btn { background: var(--accent); color: #fff; text-decoration: none; padding: 10px 20px; border-radius: 8px; font-size: 0.875rem; font-weight: 600; white-space: nowrap; transition: background 0.15s; border: none; cursor: pointer; display: inline-block; }
.yd-add-btn:hover { background: #2e8057; }

/* Search bar */
.yd-search-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.yd-search-input { flex: 1; min-width: 180px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px; color: var(--text); font-size: 0.9rem; }
.yd-search-input:focus { outline: none; border-color: var(--accent); }
.yd-state-select {
  width: 100%;
  padding: 10px 40px 10px 14px;
  background: #1a1a1a;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233a9b6a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.yd-state-select:focus {
  border-color: #3a9b6a;
  box-shadow: 0 0 0 3px rgba(58,155,106,0.18);
}
.yd-search-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.yd-search-btn:hover { background: #2e8057; }
.yd-clear-btn { color: var(--text-dim); font-size: 0.875rem; text-decoration: none; padding: 9px 4px; align-self: center; }
.yd-clear-btn:hover { color: var(--text); }

.yd-count { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 20px; }
.yd-count strong { color: var(--text); }

/* Yard cards */
.yd-grid { display: flex; flex-direction: column; gap: 12px; }

.yd-card { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; text-decoration: none; transition: border-color 0.18s, background 0.15s; }
.yd-card:hover { border-color: var(--accent); background: rgba(58, 155, 106, 0.04); }

.yd-card-avatar { width: 48px; height: 48px; min-width: 48px; border-radius: 50%; background: #3a9b6a; color: #fff; font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.yd-card-body { flex: 1; min-width: 0; }
.yd-card-name { font-weight: 600; font-size: 1rem; color: var(--text); margin-bottom: 4px; }
.yd-card-loc { font-size: 0.85rem; color: var(--text-dim); }
.yd-card-phone { font-size: 0.83rem; color: var(--text-dim); margin-top: 2px; }
.yd-card-meta { font-size: 0.78rem; color: var(--text-dim); margin-top: 6px; opacity: 0.7; }
.yd-card-arrow { color: var(--text-dim); font-size: 1.1rem; opacity: 0.5; }

/* Empty state */
.yd-empty { text-align: center; padding: 60px 24px; color: var(--text-dim); }
.yd-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.yd-empty p { margin-bottom: 20px; }

/* Back link */
.yd-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 0.875rem; text-decoration: none; margin-bottom: 28px; }
.yd-back:hover { color: var(--accent); }

/* Profile header */
.yd-profile-header { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.yd-profile-avatar { width: 64px; height: 64px; min-width: 64px; border-radius: 50%; background: #3a9b6a; color: #fff; font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.yd-profile-info { flex: 1; }
.yd-profile-name { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.yd-profile-loc { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 4px; }
.yd-profile-meta { font-size: 0.8rem; color: var(--text-dim); opacity: 0.7; }
.yd-profile-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; }

.yd-edit-btn { background: var(--card); border: 1px solid var(--border); color: var(--text-dim); text-decoration: none; padding: 7px 16px; border-radius: 7px; font-size: 0.85rem; transition: border-color 0.15s, color 0.15s; }
.yd-edit-btn:hover { border-color: var(--accent); color: var(--accent); }
.yd-delete-btn { background: rgba(220, 60, 60, 0.1); border: 1px solid rgba(220, 60, 60, 0.25); color: #e05555; padding: 7px 16px; border-radius: 7px; font-size: 0.85rem; cursor: pointer; transition: background 0.15s; }
.yd-delete-btn:hover { background: rgba(220, 60, 60, 0.2); }

/* Info cards */
.yd-info-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 32px; }
.yd-info-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; min-width: 180px; }
.yd-info-card--full { flex: 100%; }
.yd-info-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 6px; }
.yd-info-value { font-size: 0.9rem; color: var(--text); word-break: break-all; }
.yd-link-green { color: #4db87a; text-decoration: none; }
.yd-link-green:hover { text-decoration: underline; }
.yd-link-blue { color: #5bc0de; text-decoration: none; }
.yd-link-blue:hover { text-decoration: underline; }

/* Parts section */
.yd-section { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: visible; }
.yd-section-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.yd-section-title { font-size: 1rem; font-weight: 600; color: var(--text); margin: 0; }
.yd-parts-badge { background: rgba(58, 155, 106, 0.12); color: var(--accent); font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }

.yd-parts-table-wrap { overflow: clip; }
.yd-parts-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.yd-parts-table th { padding: 10px 16px; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); border-bottom: 1px solid var(--border); white-space: nowrap; }
.yd-parts-table td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.yd-parts-table tr:last-child td { border-bottom: none; }
.yd-parts-table tr:hover td { background: rgba(255,255,255,0.02); }
.yd-part-name { font-weight: 500; color: var(--text); }
.yd-part-price { color: #4db87a; font-weight: 600; white-space: nowrap; }
.yd-part-notes { color: var(--text-dim); max-width: 200px; }
.yd-part-user { color: var(--text-dim); font-size: 0.8rem; }
.yd-cond-badge { font-size: 0.75rem; padding: 2px 9px; border-radius: 20px; font-weight: 500; }
.yd-cond-used { background: rgba(255,255,255,0.07); color: var(--text-dim); }
.yd-cond-oem { background: rgba(91, 192, 222, 0.12); color: #5bc0de; }
.yd-cond-rebuilt { background: rgba(255, 193, 7, 0.12); color: #ffc107; }
.yd-part-del { background: none; border: none; color: rgba(220, 60, 60, 0.5); font-size: 13px; cursor: pointer; padding: 4px 6px; border-radius: 4px; transition: color 0.15s, background 0.15s; }
.yd-part-del:hover { color: #e05555; background: rgba(220, 60, 60, 0.1); }
.yd-parts-empty { padding: 28px 22px; color: var(--text-dim); font-size: 0.9rem; margin: 0; }

/* Add part toggle */
.yd-add-part-wrap { border-top: 1px solid var(--border); }
.yd-add-part-toggle { padding: 14px 22px; font-size: 0.875rem; font-weight: 500; color: var(--accent); cursor: pointer; list-style: none; user-select: none; }
.yd-add-part-toggle::-webkit-details-marker { display: none; }
.yd-add-part-toggle:hover { background: rgba(58, 155, 106, 0.05); }

.yd-add-part-form { padding: 0 22px 22px; }

/* Form helpers */
.yd-form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 0; }
.yd-form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; margin-bottom: 16px; }
.yd-form-group--sm { flex: 0 0 120px; }
.yd-form-group--lg { flex: 1 1 100%; }
.yd-form-group label { font-size: 0.8rem; font-weight: 500; color: var(--text-dim); }
.yd-form-group input, .yd-form-group select, .yd-form-group textarea { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 0.9rem; font-family: inherit; resize: vertical; }
.yd-form-group input:focus, .yd-form-group select:focus, .yd-form-group textarea:focus { outline: none; border-color: var(--accent); }
.req { color: var(--accent); }

.yd-submit-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 10px 24px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.yd-submit-btn:hover { background: #2e8057; }

/* Add/Edit form page */
.yd-form-page { max-width: 580px; }
.yd-form-title { font-size: 1.4rem; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.yd-form-sub { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 32px; }
.yd-yard-form { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.yd-form-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.yd-cancel-btn { color: var(--text-dim); font-size: 0.875rem; text-decoration: none; }
.yd-cancel-btn:hover { color: var(--text); }


/* ── Yards: Core Fee & Total Cost columns ─────────────────────────────── */
.yd-part-core  { color: #e0a020; font-size: 0.85rem; text-align: right; }
.yd-part-total { color: #4ade80; font-weight: 700; text-align: right; }
.yd-th-total   { color: #4ade80; }
.yd-core-badge { background: rgba(224,160,32,0.12); color: #e0a020;
                 border: 1px solid rgba(224,160,32,0.35);
                 border-radius: 4px; padding: 1px 6px; font-size: 0.82rem; }
.yd-no-core    { color: #555; }
.yd-opt        { font-size: 0.72rem; color: #888; font-weight: 400;
                 margin-left: 4px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Yards: Fetch Prices button ────────────────────────────────────────── */
.yd-fetch-wrap {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.yd-fetch-btn {
  background: linear-gradient(135deg, #1e5a3a 0%, #2a7a50 100%);
  color: #d4f0e0; border: 1px solid #3a9b6a;
  border-radius: 6px; padding: 8px 18px;
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.yd-fetch-btn:hover  { background: linear-gradient(135deg, #2a7a50 0%, #3a9b6a 100%); }
.yd-fetch-btn:active { transform: scale(0.97); }
.yd-fetch-note { font-size: 0.80rem; color: #888; }
.yd-fetch-note a { color: #3a9b6a; text-decoration: underline; }
.yd-import-note {
  margin: 0 0 0.85rem 0;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #cfd3cf;
  background: rgba(58, 155, 106, 0.08);
  border: 1px solid rgba(58, 155, 106, 0.35);
  border-left: 3px solid #3a9b6a;
  border-radius: 6px;
}
.yd-import-note strong { color: #3a9b6a; }


.yd-field-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: #888;
  line-height: 1.4;
}

.yd-parts-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #1a1a1a;
}

/* ===== Yard Activate Toggle ===== */
.yd-card-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Remove-from-your-yards button */
.yd-remove-form {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  margin: 0;
}
.yd-remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1.5px solid #e0c3c3;
  border-radius: 6px;
  background: #fbf3f3;
  color: #b0413e;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.85;
  transition: all 0.15s;
}
.yd-remove-btn:hover {
  background: #c0392b;
  border-color: #c0392b;
  color: #ffffff;
  opacity: 1;
}

.yd-activate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
  align-self: flex-start;
  transition: all 0.15s;
  z-index: 2;
}

.yd-activate-btn:hover {
  border-color: #4caf50;
  background: #f0fff0;
  color: #2e7d32;
}

.yd-card-active .yd-activate-btn {
  border-color: #1b5e20;
  background: #1b5e20;
  color: #ffffff;
  font-weight: 600;
}

.yd-card-active .yd-activate-btn:hover {
  border-color: #2e7d32;
  background: #2e7d32;
  color: #ffffff;
}

.yd-detail-active {
  border-color: #4caf50;
  background: #e8f5e9;
  color: #2e7d32;
}
.yd-activate-icon {
  font-size: 1rem;
}

/* ===== Yard Columns in Results Table ===== */
.yard-header-row th {
  background: var(--bg-hover, rgba(76,175,80,0.12));
  color: var(--accent, #4caf50);
  font-weight: 700;
  font-size: 0.78rem;
  text-align: center;
  border-bottom: none;
  padding: 4px 8px;
}

.yard-col {
  text-align: right;
  white-space: nowrap;
  width: 80px;
  min-width: 80px;
}

.yard-sub {
  background: var(--bg-hover, rgba(76,175,80,0.08));
  color: var(--accent, #4caf50);
  font-size: 0.75rem;
  font-weight: 600;
}

.yard-price {
  color: var(--accent, #4caf50);
  font-weight: 600;
}

.yard-core.has-core {
  color: #ffa726;
  font-size: 0.8rem;
}

.yard-no-data {
  color: var(--text-faint, #777);
  font-size: 0.8rem;
}

/* ===== Yard Totals Row ===== */
.totals-row--yard {
  border-top: 1px solid var(--border-soft);
  padding-top: 6px;
  margin-top: 2px;
}
.totals-label.yard-total {
  color: #f0c040;
  font-weight: 500;
}
.totals-value.yard-total {
  color: #f0c040;
  font-family: var(--font-mono);
}

/* Whole Vehicle profit line (light green) */
.totals-row--vehicle {
  border-top: 1px solid var(--border-soft);
  padding-top: 6px;
  margin-top: 2px;
}
.totals-label.vehicle-total {
  color: #a8e6a8;
  font-weight: 500;
}
.totals-value.vehicle-total {
  color: #a8e6a8;
  font-family: var(--font-mono);
}

/* ── Overpriced rows: all yard costs exceed lowest listing price ── */
tr.row-overpriced td {
  color: #cc0000 !important;
}
tr.row-overpriced td a,
tr.row-overpriced td button {
  color: #cc0000 !important;
}

/* ── Active Yards Reorder Section ── */
.yd-reorder-section {
  background: var(--color-surface, #1e1e2e);
  border: 1px solid var(--color-border, #333);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.yd-reorder-header { margin-bottom: 12px; }
.yd-reorder-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-accent, #f0c040);
  margin: 0 0 4px;
}
.yd-reorder-hint {
  font-size: 0.8rem;
  color: var(--color-muted, #888);
  margin: 0;
}
.yd-reorder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.yd-reorder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-bg, #141420);
  border: 1px solid var(--color-border, #333);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: grab;
  user-select: none;
  transition: background 0.15s, opacity 0.15s;
}
.yd-reorder-item:active { cursor: grabbing; }
.yd-reorder-item.yd-dragging { opacity: 0.45; }
.yd-reorder-item.yd-drag-over {
  border-color: var(--color-accent, #f0c040);
  background: rgba(240,192,64,0.07);
}
.yd-reorder-handle {
  color: var(--color-muted, #888);
  font-size: 1rem;
  cursor: grab;
}
.yd-reorder-num {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--color-accent, #f0c040);
  min-width: 52px;
  font-weight: 600;
}
.yd-reorder-name {
  font-weight: 500;
  flex: 1;
}
.yd-reorder-loc {
  font-size: 0.8rem;
  color: var(--color-muted, #888);
}
.yd-reorder-btns {
  display: flex;
  gap: 4px;
}
.yd-reorder-up, .yd-reorder-dn {
  background: none;
  border: 1px solid var(--color-border, #444);
  border-radius: 4px;
  color: var(--color-text, #ddd);
  padding: 2px 6px;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}
.yd-reorder-up:hover:not(:disabled), .yd-reorder-dn:hover:not(:disabled) {
  background: var(--color-accent, #f0c040);
  color: #000;
  border-color: var(--color-accent, #f0c040);
}
.yd-reorder-up:disabled, .yd-reorder-dn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.yd-reorder-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.yd-reorder-save {
  background: var(--color-accent, #f0c040);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 6px 18px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}
.yd-reorder-save:hover { filter: brightness(1.1); }
.yd-reorder-save:disabled { opacity: 0.5; cursor: not-allowed; }
.yd-reorder-status {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Yard page main layout - reorder panel on right */
.yd-main-layout {
  display: flex;
  flex-direction: row;
  gap: 24px;
  align-items: flex-start;
}
.yd-grid-wrapper {
  flex: 1;
  min-width: 0;
  order: 1;
}
.yd-reorder-section {
  width: 260px;
  flex-shrink: 0;
  order: 2;
  margin-bottom: 0;
}
@media (max-width: 700px) {
  .yd-main-layout {
    flex-direction: column;
  }
  .yd-reorder-section {
    width: 100%;
    order: -1;
  }
}

/* Expand yards page to full width */
.page-yards .yd-page {
  max-width: none;
  margin: 0;
  padding: 40px 40px 72px;
}

/* Widen the yard order sidebar */
.yd-reorder-section {
  width: 420px;
}
.yd-reorder-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yd-reorder-loc {
  white-space: nowrap;
  min-width: 70px;
}

/* ─── Delete button + history actions ───────────────────────────────── */
.btn-danger {
  border-color: #c0392b;
  color: #e74c3c;
  background: transparent;
}
.btn-danger:hover {
  background: rgba(231, 76, 60, 0.12);
  border-color: #e74c3c;
  color: #ff6b6b;
}
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }
.history-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

/* ─── Export checkbox column ─────────────────────────────────────────── */
.col-export-check {
  width: 1px;
  white-space: nowrap;
  text-align: center;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}
.col-export-check input[type=checkbox] {
  display: block;
  margin: 0 auto;
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}

table.results-table th.col-export-check,
table.history-table th.col-export-check,
th.col-export-check {
  cursor: pointer;
  user-select: none;
  text-align: center;
  transition: color 0.12s, background 0.12s;
}

th.col-export-check:hover {
  color: var(--accent);
  background: var(--bg-hover, rgba(76,175,80,0.12));
}

/* --- Analyze page: use full screen width --- */
.page.dashboard {
  max-width: 1600px;
  width: 100%;
}
@media (min-width: 1700px) {
  .page.dashboard { max-width: 92vw; }
}

/* Negative profit shown in red (includes $ and -) */
.neg-profit { color: #e05555; }

/* === Results search bar === */
.results-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
  padding: 8px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-input);
}
.results-search:focus-within {
  border-color: var(--accent);
}
.results-search-icon {
  font-size: 14px;
  line-height: 1;
  opacity: .65;
  flex-shrink: 0;
}
.results-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.results-search-input::placeholder { color: var(--text-dim); }
.results-search-input::-webkit-search-cancel-button { display: none; }
.results-search-clear {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
.results-search-clear:hover { color: var(--text); }
.results-search-count {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Browse Yards page: back link + add/remove buttons ===== */
.yd-back-link {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--accent, #4caf50);
  text-decoration: none;
}
.yd-back-link:hover { text-decoration: underline; }

.yd-save-form { margin: 0; align-self: flex-start; }
.yd-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
  transition: all 0.15s;
  z-index: 2;
}
.yd-save-btn:hover {
  border-color: #4caf50;
  background: #f0fff0;
  color: #2e7d32;
}
.yd-save-btn--added {
  border-color: #1b5e20;
  background: #1b5e20;
  color: #ffffff;
}
.yd-save-btn--added:hover {
  border-color: #b3261e;
  background: #b3261e;
  color: #ffffff;
}
.yd-save-btn--added:hover .yd-save-label::after { content: " (remove)"; }
.yd-save-icon { font-size: 1rem; line-height: 1; }

/* Parts search bar (added) */
.parts-search {
  flex: 1 1 160px;
  max-width: 280px;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 13px;
}
.parts-toolbar .parts-save-status {
  margin-left: auto;
}

/* ===== Yard Hours of Operation (added) ===== */
.yd-hours-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.yd-hours-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: rgba(255,255,255,0.02);
}
.yd-hours-row.is-closed .yd-hours-time { opacity: 0.4; pointer-events: none; }
.yd-hours-day { flex: 0 0 90px; font-weight: 600; font-size: 13px; }
.yd-hours-time { flex: 0 0 auto; width: 120px; padding: 4px 8px; }
.yd-hours-sep { color: var(--muted); font-size: 12px; }
.yd-hours-closed { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-size: 13px; color: var(--muted); cursor: pointer; }
.yd-hours-closed-cb { accent-color: var(--accent); }

.yd-hours-table { width: 100%; max-width: 360px; border-collapse: collapse; margin-top: 6px; }
.yd-hours-table td { padding: 7px 10px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.yd-hours-table tr:last-child td { border-bottom: none; }
.yd-hours-table-day { font-weight: 600; color: var(--text, #e6e6e6); width: 110px; }
.yd-hours-table-val { color: var(--muted); }
.yd-hours-closed-tag { color: #d9534f; font-weight: 600; }
.yd-hours-na { color: var(--muted); }

/* Results: yard price coloring vs lowest listing */
.results-table td.yard-price.yard-over { color: #e05555; font-weight: 600; }
.results-table td.yard-price.yard-cheapest { color: #4ade80; font-weight: 700; }

/* Results: size yard columns to fit header + largest value, with breathing room */
table.results-table { width: auto; min-width: 100%; }
table.results-table th.yard-col, table.results-table td.yard-col { width: 92px; padding-left: 14px; padding-right: 14px; white-space: nowrap; }
table.results-table th.yard-sub { text-align: right; }

/* ── Yard New Vehicle Arrivals dropdown ─────────────────────────── */
.yd-arrivals {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: -1px;
  padding: 10px 20px 12px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 1px solid #2a3447;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}
.yd-arrivals-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  background: transparent;
  border: none;
  color: #34d399;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  text-align: left;
}
.yd-arrivals-toggle:hover { color: #6ee7b7; }
.yd-arrivals-caret {
  display: inline-block;
  transition: transform 0.15s ease;
  font-size: 11px;
}
.yd-arrivals.is-open .yd-arrivals-caret { transform: rotate(90deg); }
.yd-arrivals-panel { margin-top: 8px; flex: 1 0 100%; }
.yd-arrivals-status {
  font-size: 12px;
  color: #8b9bb4;
  margin-bottom: 6px;
}
.yd-arrivals-body {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #2a3447;
  border-radius: 8px;
}
.yd-arrivals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.yd-arrivals-table th,
.yd-arrivals-table td {
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}
.yd-arrivals-table thead th {
  position: sticky;
  top: 0;
  background: #1b2433;
  color: #cbd5e1;
  font-weight: 600;
  border-bottom: 1px solid #2a3447;
}
.yd-arrivals-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.03); }
.yd-arrivals-table tbody td { color: #e2e8f0; border-bottom: 1px solid #222c3c; }


/* Make New Vehicle Arrivals visually part of the yard card box */
.yd-card-wrap:has(.yd-arrivals) > .yd-card {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}
.yd-card-wrap:has(.yd-arrivals) { border-radius: 12px; }


/* Scan button column (sticky left) */
.yd-arrivals-table th.yd-scan-col,
.yd-arrivals-table td.yd-scan-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #15191f;
  width: 64px;
  min-width: 64px;
  text-align: center;
  padding: 4px 8px;
  box-shadow: 1px 0 0 #222c3c;
}
.yd-arrivals-table thead th.yd-scan-col { z-index: 3; background: #1b2433; }
.yd-arrivals-table tbody tr:nth-child(even) td.yd-scan-col { background: #1b2330; }
.yd-scan-btn {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #3a9b6a;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.yd-scan-btn:hover { background: #34d399; }

/* Sortable column headers in New Vehicle Arrivals table */
.yd-arrivals-table thead th.yd-sortable {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}
.yd-arrivals-table thead th.yd-sortable:hover {
  background: #243450;
  color: #ffffff;
}

/* ========== SUPPORT TICKET ========== */
.hs-ticket { max-width: 760px; margin: 32px auto 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px 28px 32px; }
.hs-ticket-title { margin: 0 0 6px; font-size: 1.4rem; color: var(--text); }
.hs-ticket-sub { margin: 0 0 20px; color: var(--text-dim); font-size: 0.95rem; }
.hs-ticket-form { display: flex; flex-direction: column; gap: 16px; }
.hs-field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.hs-field-row .hs-field { flex: 1; min-width: 180px; }
.hs-field { display: flex; flex-direction: column; gap: 6px; }
.hs-field label { font-size: 0.85rem; color: var(--text-dim); font-weight: 600; }
.hs-req { color: #f0c14b; }
.hs-ticket-form input, .hs-ticket-form textarea { background: var(--bg, #11151c); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; color: var(--text); font-size: 0.95rem; font-family: inherit; width: 100%; box-sizing: border-box; }
.hs-ticket-form input:focus, .hs-ticket-form textarea:focus { outline: none; border-color: var(--accent); }
.hs-ticket-form textarea { resize: vertical; min-height: 110px; }
.hs-ticket-btn { align-self: flex-start; background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 11px 26px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.hs-ticket-btn:hover { background: #2e8057; }
.hs-mytickets { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 24px; }
.hs-mytickets h3 { margin: 0 0 16px; font-size: 1.1rem; color: var(--text); }
.hs-ticket-item { background: var(--bg, #11151c); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.hs-ticket-item-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hs-ticket-subj { font-weight: 600; color: var(--text); }
.hs-ticket-status { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.hs-status-open { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.hs-status-closed { background: rgba(108, 117, 125, 0.2); color: #9aa4ad; }
.hs-ticket-date { font-size: 0.78rem; color: var(--text-dim); margin: 4px 0 8px; }
.hs-ticket-msg { margin: 0; color: var(--text); font-size: 0.92rem; white-space: pre-wrap; }
.hs-ticket-reply { margin-top: 12px; border-left: 3px solid var(--accent); padding: 8px 12px; background: rgba(74, 222, 128, 0.06); border-radius: 0 8px 8px 0; }
.hs-ticket-reply-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); margin-bottom: 4px; }
.hs-ticket-reply p { margin: 0; color: var(--text); font-size: 0.92rem; white-space: pre-wrap; }

/* ---- Auto-deselect note (irrelevant parts hidden for chosen vehicle) ---- */
.auto-deselect-note[hidden] { display: none !important; }
.auto-deselect-note {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.auto-deselect-note strong { color: var(--text); }
.auto-deselect-restore {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}
.auto-deselect-restore:hover { border-color: var(--accent); color: var(--accent); }

.parts-select-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin: 4px 0 2px;
}
.parts-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted, #9aa3b2);
}

.run-status.error {
  color: var(--danger, #ff6b6b);
  font-weight: 600;
}

/* --- Center all results-table columns (override prior left/right aligns) --- */
table.results-table th, table.results-table td { text-align: center; }
table.results-table th.num, table.results-table td.num { text-align: center; }
table.results-table th.yard-sub { text-align: center; }
table.results-table tbody tr:not(.listings-detail) td { text-align: center; }
table.results-table tbody tr:not(.listings-detail) td.part-name { text-align: center; justify-content: center; }

/* Profit on Average toggle active state */
#profit-avg-toggle.toggle-on { background: var(--accent, #2d8cff); color: #fff; border-color: var(--accent, #2d8cff); }

/* --- Site footer (legal/trademark notice) --- */
.site-footer {
  margin-top: 2.5rem;
  padding: 1.25rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
.site-footer p {
  margin: 0 auto;
  max-width: 760px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted, #8a8f98);
}

/* --- Support Us floating button (analyze page) --- */
.support-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: var(--accent, #3a9b6a);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.support-fab:hover {
  background: var(--accent-hover, #4db380);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
.support-fab-heart { font-size: 15px; line-height: 1; }
@media (max-width: 600px) {
  .support-fab { padding: 10px 14px; }
  .support-fab-text { display: none; }
}

.support-fab-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* --- Linktree nav link (left of Discord) --- */
.nav-linktree {
  display: inline-flex;
  align-items: center;
  margin-left: 14px;
  color: #43e660;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color .15s, transform .15s;
}
.nav-linktree:hover {
  color: #6bf085;
  transform: translateY(-1px);
}

/* --- Tutorial closing call-to-action --- */
.tut-cta {
  margin-top: 2.5rem;
  padding: 2rem 1.5rem;
  text-align: center;
  border: 1px solid rgba(67,230,96,0.25);
  border-radius: 14px;
  background: rgba(58,155,106,0.06);
}
.tut-cta h2 {
  margin: 0 0 .5rem;
  font-size: 1.4rem;
}
.tut-cta p {
  margin: 0 auto 1.5rem;
  max-width: 560px;
  color: var(--text-dim);
}
.tut-cta-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ----- Inbox / envelope (header) ----- */
.nav a.nav-inbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px 4px;
  line-height: 0;
}
.nav a.nav-inbox .nav-inbox-icon {
  color: var(--text-dim);
  transition: color .15s ease;
}
.nav a.nav-inbox:hover .nav-inbox-icon,
.nav a.nav-inbox.active .nav-inbox-icon { color: var(--text); }
.nav-inbox-badge {
  position: absolute;
  top: -2px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--bad, #cc3344);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg, #111);
}

/* ----- Inbox page ----- */
.inbox-wrap { max-width: 820px; margin: 0 auto; }
.inbox-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.inbox-list { display: flex; flex-direction: column; gap: 10px; }
.inbox-item {
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--panel, #181818);
}
.inbox-item.unread { border-left: 3px solid var(--accent, #4ade80); }
.inbox-item .inbox-title { font-weight: 700; color: var(--text); margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.inbox-item .inbox-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, #4ade80); flex: 0 0 auto; }
.inbox-item .inbox-meta { color: var(--text-faint); font-size: 12px; margin-bottom: 8px; }
.inbox-item .inbox-body { color: var(--text-dim); white-space: pre-wrap; line-height: 1.5; }
.inbox-item .inbox-body a { color: var(--accent); }
.inbox-empty { color: var(--text-faint); text-align: center; padding: 48px 0; }

/* Inbox new-arrivals per-car scan buttons */
.inbox-cars { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.inbox-car-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.inbox-car-row:last-child { border-bottom: none; }
.inbox-car-name { color: var(--text-dim); font-size: 0.95rem; }
.inbox-car-row .yd-scan-btn { flex: 0 0 auto; }
.inbox-viewyard { margin-top: 10px; }
.inbox-car-row .yd-scan-btn, .inbox-car-row .yd-scan-btn:link, .inbox-car-row .yd-scan-btn:visited { color: #fff !important; }

/* Inbox per-message delete button */
.inbox-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.inbox-title-text { flex: 1 1 auto; }
.inbox-del-btn { flex: 0 0 auto; background: transparent; border: none; color: var(--text-faint); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 4px; }
.inbox-del-btn:hover { color: var(--bad); background: rgba(255,255,255,0.06); }

/* Inbox in-page delete confirm bar + toast (no system dialogs) */
.inbox-confirm { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; }
.inbox-confirm-text { flex: 1 1 auto; color: var(--text-dim); font-size: 0.92rem; }
.inbox-confirm-yes, .inbox-confirm-no { flex: 0 0 auto; padding: 5px 14px; font-size: 13px; font-weight: 600; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.inbox-confirm-yes { background: var(--bad); color: #fff; }
.inbox-confirm-yes:hover { filter: brightness(1.1); }
.inbox-confirm-yes:disabled { opacity: 0.6; cursor: default; }
.inbox-confirm-no { background: transparent; color: var(--text-dim); border-color: rgba(255,255,255,0.18); }
.inbox-confirm-no:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.inbox-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px); background: var(--bad); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 0.95rem; box-shadow: 0 6px 24px rgba(0,0,0,0.4); opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 9999; }
.inbox-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Notify-me button: theme-native, matches dark arrivals bar */
.yd-notify-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-dim);
  transition: all 0.15s ease;
}
.yd-notify-btn:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  color: var(--text);
}
.yd-notify-btn.on {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}
.yd-notify-btn.on:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #ffffff;
}
.yd-notify-btn .yd-notify-icon { font-size: 0.95rem; line-height: 1; }
.yd-notify-btn[disabled] { opacity: 0.6; cursor: default; }
