:root {
  --sidebar: #101820;
  --sidebar-soft: #17232d;
  --sidebar-border: #263744;
  --ink: #18212b;
  --muted: #66727f;
  --line: #d9e0e7;
  --panel: #ffffff;
  --page: #eef2f5;
  --blue: #1f6feb;
  --green: #15803d;
  --green-soft: #e9f7ee;
  --red: #b42318;
  --red-soft: #fff0ee;
  --amber: #a15c07;
  --amber-soft: #fff7e6;
  --shadow: 0 16px 36px rgba(12, 20, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  color: #eaf1f7;
  border-right: 1px solid #081016;
  padding: 18px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.brand-block {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-block h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1;
}

.brand-block p {
  margin: 6px 0 0;
  color: #9fb0bf;
  font-size: 12px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  display: inline-grid;
  place-items: center;
}

.menu-icon span,
.close-icon span {
  position: relative;
  width: 16px;
  height: 16px;
  display: block;
}

.menu-icon span,
.menu-icon span::before,
.menu-icon span::after {
  border-top: 2px solid currentColor;
}

.menu-icon span {
  height: 10px;
}

.menu-icon span::before,
.menu-icon span::after,
.close-icon span::before,
.close-icon span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
}

.menu-icon span::before {
  top: 4px;
}

.menu-icon span::after {
  top: 10px;
}

.close-icon span::before,
.close-icon span::after {
  top: 7px;
  border-top: 2px solid currentColor;
}

.close-icon span::before {
  transform: rotate(45deg);
}

.close-icon span::after {
  transform: rotate(-45deg);
}

.sidebar .icon-button {
  background: var(--sidebar-soft);
  border-color: var(--sidebar-border);
  color: #d9e7f2;
}

.sidebar-close {
  display: none;
}

.filter-toolbar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #9fb0bf;
  font-size: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: #7ab7ff;
  padding: 4px;
}

.filter-list {
  display: grid;
  gap: 14px;
  flex: 1;
}

.sidebar-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-disclaimer {
  margin: 0 0 10px;
  color: #9fb0bf;
  font-size: 12px;
  line-height: 1.45;
}

.sidebar-inline-link {
  color: #d9e7f2;
  text-decoration: none;
}

.sidebar-inline-link:hover {
  text-decoration: underline;
}

.sidebar-footer-link {
  color: #9fb0bf;
  font-size: 12px;
  text-decoration: none;
}

.sidebar-footer-link:hover {
  color: #eaf1f7;
  text-decoration: underline;
}

.filter-group {
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-border);
}

.filter-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.filter-group h2 {
  margin: 0 0 8px;
  color: #c8d4df;
  font-size: 12px;
  text-transform: uppercase;
}

.filter-option {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #eaf1f7;
  padding: 7px 8px;
  text-align: left;
}

.filter-option:hover,
.filter-option.active {
  background: var(--sidebar-soft);
}

.filter-option.active {
  outline: 1px solid #2c7be5;
}

.filter-option .count {
  color: #9fb0bf;
  font-size: 12px;
}

.content {
  min-width: 0;
  padding: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px;
  gap: 12px;
  align-items: end;
}

.refresh-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin: 14px 0 0;
  border: 1px solid #c8d4df;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fbfd, #eef5fb);
  color: var(--ink);
}

.refresh-banner strong {
  font-size: 13px;
}

.refresh-banner span {
  color: var(--muted);
  white-space: nowrap;
}

.filter-toggle {
  display: none;
}

.search-wrap,
.sort-wrap {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(31, 111, 235, 0.4);
  outline-offset: 2px;
}

.status-strip {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.status-strip strong {
  margin-right: 10px;
}

.status-strip span {
  color: var(--muted);
}

.active-chips {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid #bcd0f7;
  border-radius: 999px;
  background: #eaf2ff;
  color: #164a99;
  padding: 5px 9px;
  font-size: 12px;
}

.table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-header,
.listing-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.9fr) minmax(180px, 1fr) 130px 130px;
  gap: 14px;
  align-items: center;
}

.table-header {
  min-height: 40px;
  padding: 0 14px;
  background: #f7f9fb;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.listing-table {
  display: grid;
}

.listing-row {
  min-height: 104px;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.listing-row:last-child {
  border-bottom: 0;
}

.listing-row:hover {
  background: #f6fbff;
}

.drive-cell {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.thumb {
  width: 70px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.5), transparent 38%),
    linear-gradient(135deg, #d8e2ea, #f8fafc);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: #49606f;
  font-weight: 700;
  font-size: 12px;
  padding-bottom: 9px;
  position: relative;
  overflow: hidden;
}

.thumb-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
  background: #fff;
  position: relative;
  z-index: 1;
}

.thumb::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 24px;
  height: 24px;
  border: 6px solid rgba(73, 96, 111, 0.18);
  border-radius: 50%;
  transform: translateX(-50%);
}

.thumb::after {
  content: "";
  position: absolute;
  top: 19px;
  left: 50%;
  width: 6px;
  height: 6px;
  background: rgba(73, 96, 111, 0.25);
  border-radius: 50%;
  transform: translateX(-50%);
}

.title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.meta-line,
.spec-list {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.spec-list {
  display: grid;
  gap: 4px;
}

.condition-alert {
  color: var(--red);
  font-weight: 700;
}

.price {
  display: block;
  font-size: 20px;
  font-weight: 800;
}

.per-tb {
  color: var(--muted);
  font-size: 12px;
}

.seller {
  display: inline-block;
  margin-bottom: 5px;
  font-weight: 700;
}

.shipping-line {
  font-weight: 700;
}

.badge-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.badge {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.excellent {
  background: var(--green-soft);
  color: var(--green);
}

.badge.good {
  background: #eaf7ff;
  color: #0969a8;
}

.badge.fair {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.poor {
  background: var(--red-soft);
  color: var(--red);
}

.badge.neutral {
  background: #eef2f5;
  color: #52616d;
}

.empty-state {
  padding: 42px 18px;
  text-align: center;
  color: var(--muted);
}

.sidebar-backdrop {
  display: none;
}

.legal-back {
  color: var(--blue);
  text-decoration: none;
}

.legal-back:hover {
  text-decoration: underline;
}

.legal-body {
  min-height: 100vh;
  background: var(--page);
}

.legal-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.legal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.legal-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.legal-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
}

.legal-meta {
  margin: 8px 0 0;
  color: var(--muted);
}

.legal-back {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  white-space: nowrap;
}

.legal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.legal-card h2 {
  margin: 24px 0 8px;
  font-size: 18px;
}

.legal-card h2:first-of-type {
  margin-top: 0;
}

.legal-card p,
.legal-card li {
  color: #33414e;
  line-height: 1.6;
}

.legal-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    transform: translateX(-102%);
    transition: transform 160ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close,
  .filter-toggle {
    display: inline-grid;
  }

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    z-index: 10;
    inset: 0;
    background: rgba(8, 16, 22, 0.42);
  }

  .topbar {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .sort-wrap {
    grid-column: 2;
  }

  .table-header {
    display: none;
  }

  .listing-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 620px) {
  .content {
    padding: 12px;
  }

  .refresh-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .refresh-banner span {
    white-space: normal;
  }

  .status-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .active-chips {
    justify-content: flex-start;
  }

  .drive-cell {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .thumb {
    width: 56px;
    height: 56px;
  }

  .legal-shell {
    width: min(100% - 24px, 920px);
    padding-top: 18px;
  }

  .legal-header {
    flex-direction: column;
  }

  .legal-header h1 {
    font-size: 28px;
  }

  .legal-card {
    padding: 18px;
  }
}
