/* RVLVR Circular — Brand Variables & Global Styles */

@font-face {
  font-family: 'Dr Extra Bold';
  src: url('/fonts/DrExtraBold.woff2') format('woff2'),
    url('/fonts/DrExtraBold.woff') format('woff');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --rvlvr-black: rgb(11, 21, 38);
  --rvlvr-slate: rgba(183, 201, 207, 0.65);
  --rvlvr-purple: #2d7eff;
  --rvlvr-gold: #60a5fa;
  --rvlvr-purple-deep: #1a5fd4;

  /* Primary */
  --color-primary: #2d7eff;
  --color-primary-light: rgba(45, 126, 255, 0.15);
  --color-primary-muted: rgba(45, 126, 255, 0.04);
  --color-primary-hover: #60a5fa;

  /* Background */
  --bg-page: rgb(11, 21, 38);
  --bg-card: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-overlay: rgba(255, 255, 255, 0.08);
  --bg-subtle: rgba(255, 255, 255, 0.07);

  /* Text */
  --text-primary: rgba(255, 252, 242, 0.96);
  --text-secondary: rgba(183, 201, 207, 0.65);
  --text-muted: rgba(220, 215, 200, 0.85);
  --text-tertiary: #f3f5f7;

  /* Status */
  --color-error: #f87171;
  --color-error-bg: rgba(248, 113, 113, 0.08);
  --color-success: #2d7eff;

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.08);

  --font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

/* html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-primary);
  background:
    radial-gradient(circle at center, transparent 35%, rgba(0, 0, 0, 0.45) 100%),
    linear-gradient(to top right, #152847, #000000);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--rvlvr-purple);
  text-decoration: none;
}

a:hover {
  color: var(--rvlvr-purple-deep);
}


.nav-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: rgba(11, 21, 38, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.nav-logo a {
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo a:hover {
  color: var(--text-primary);
  opacity: 0.7;
}

.nav-logo span {
  color: var(--rvlvr-purple);
  font-weight: 400;
  margin-left: 0.3em;
}

.nav-logo span a {
  color: var(--rvlvr-purple);
}

.nav-logo span a:hover {
  color: var(--rvlvr-purple);
  opacity: 0.7;
}

.nav-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
} */

/* Buttons */
.btn-primary-rvlvr {
  background: var(--rvlvr-purple);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.6rem 1.4rem;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.15s;
  display: inline-block;
}

.btn-primary-rvlvr:hover {
  opacity: 0.88;
  color: #fff;
}

.btn-ghost-rvlvr {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.55rem 1.2rem;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  display: inline-block;
}

.btn-ghost-rvlvr:hover {
  border-color: var(--rvlvr-black);
  color: var(--rvlvr-black);
}

/* Hero */
.hero {
  padding: 6rem 2rem 5rem;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rvlvr-purple);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-family: 'Dr Extra Bold', sans-serif;
  font-size: clamp(2rem, 8.5vw, 5.2rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 242, 0.96);
  margin: 0 0 1.5rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--rvlvr-purple);
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

/* Lookup box */
.lookup-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2rem;
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
  transition: border-color .15s, background .15s;
}

.lookup-box.drop-active {
  border: 2px dashed var(--rvlvr-purple);
  background: rgba(56, 127, 39, 0.04);
}

.lookup-box label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.lookup-box textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: rgb(11, 21, 38);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
}

.lookup-box textarea:focus {
  outline: none;
  border-color: var(--rvlvr-purple);
}

.lookup-box textarea::placeholder {
  color: var(--text-muted);
}

.lookup-box-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.lookup-box-footer .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* How it works */
.how-it-works {
  padding: 5rem 2rem;
  max-width: 960px;
  margin: 0 auto;
  background: var(--bg-page);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rvlvr-purple);
  margin-bottom: 3rem;
  text-align: center;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.step {
  border-top: 2px solid var(--border-color);
  padding-top: 1.5rem;
}

.step-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rvlvr-gold);
  margin-bottom: 0.75rem;
}

.step h3 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(220, 215, 200, 0.85);
  margin: 0 0 0.6rem;
}

.step p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Profile trigger button */
.profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--rvlvr-purple);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 1px;
}

/* Profile pane */
.profile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 27, 0.35);
  z-index: 200;
}

.profile-overlay.open {
  display: block;
}

.profile-pane {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 320px;
  background: #fff;
  border-left: 1px solid var(--border-color);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.profile-pane.open {
  transform: translateX(0);
}

.profile-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rvlvr-black);
}

.profile-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.profile-close:hover {
  color: var(--rvlvr-black);
}

.profile-pane-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  word-break: break-all;
}

.profile-form {
  margin-bottom: 0;
}

.profile-pane-divider {
  height: 1px;
  background: var(--border-color);
  margin: 1.25rem 0;
}

/* Auth */
.auth-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.auth-card {
  background: #fff;
  border: 1px solid rgba(11, 21, 38, 0.12);
  border-radius: 8px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  color: rgb(11, 21, 38);
}

.auth-card h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: rgb(11, 21, 38);
  margin: 0 0 0.35rem;
}

.auth-card .auth-sub {
  font-size: 0.9rem;
  color: rgba(11, 21, 38, 0.6);
  margin: 0 0 2rem;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(11, 21, 38, 0.6);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  border: 1px solid rgba(11, 21, 38, 0.18);
  border-radius: 4px;
  padding: 0.65rem 0.9rem;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  color: rgb(11, 21, 38);
  background: #fff;
  transition: border-color 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--rvlvr-purple);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn-block {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: rgba(11, 21, 38, 0.4);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(11, 21, 38, 0.12);
}

.auth-links {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(11, 21, 38, 0.6);
}

.auth-links a {
  color: var(--rvlvr-purple);
}

.auth-error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 4px;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  color: #be123c;
  margin-bottom: 1.25rem;
}

.auth-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  color: #15803d;
  margin-bottom: 1.25rem;
}

.auth-code-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ── Cart bar ───────────────────────────────────────────────────────────────── */

.cart-bar {
  position: sticky;
  top: 61px;
  /* below sticky nav */
  z-index: 90;
  background: var(--rvlvr-purple);
  color: #fff;
  padding: 0.7rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  box-shadow: 0 2px 10px rgba(170, 36, 228, 0.3);
}

#cart-bar-summary {
  font-size: 0.9rem;
}

.btn-cart-submit {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 1.1rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-cart-submit:hover {
  background: rgba(255, 255, 255, 0.28);
}

.btn-cart-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Lookup page ─────────────────────────────────────────────────────────── */

.lookup-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 3.5rem 2rem 5rem;
}

.lookup-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: rgba(255, 255, 242, 0.96);
  margin: 0 0 0.5rem;
}

.lookup-sub {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0 0 2rem;
  line-height: 1.6;
}

.lookup-search-section {
  margin-bottom: 3rem;
}

/* ── Results & Cart tables ──────────────────────────────────────────────── */

.results-section,
.cart-section {
  margin-bottom: 3rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-subtle);
}

.item-name {
  font-weight: 600;
  font-size: 0.88rem;
}

.item-identifier {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.item-year {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.est-value {
  font-weight: 700;
  color: var(--rvlvr-purple);
  white-space: nowrap;
}

/* Grade select */
.grade-select {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  color: rgb(11, 21, 38);
  background: #fff;
  cursor: pointer;
  min-width: 170px;
}

.grade-select:focus {
  outline: none;
  border-color: var(--rvlvr-purple);
}

/* Qty input */
.qty-input {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  width: 64px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  color: rgb(11, 21, 38);
  background: #fff;
  text-align: center;
}

.qty-input:focus {
  outline: none;
  border-color: var(--rvlvr-purple);
}

/* Small button variant */
.btn-sm {
  font-size: 0.78rem;
  padding: 0.45rem 1rem;
  white-space: nowrap;
}

/* Remove button */
.btn-remove {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.btn-remove:hover {
  color: #dc2626;
}

/* Grade badges */
.grade-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
}

.grade-excellent {
  background: #dcfce7;
  color: #15803d;
}

.grade-good {
  background: #dbeafe;
  color: #1d4ed8;
}

.grade-fair {
  background: #fef9c3;
  color: #a16207;
}

.grade-poor {
  background: #fee2e2;
  color: #dc2626;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.admin-shell+.footer {
  margin-top: 0;
}

.footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 4rem;
}

.footer-logo {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(26, 26, 27, 0.3);
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Search result row states ─────────────────────────────────────────────── */
.result-processing {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-processing::before {
  content: '';
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.result-error {
  color: #c0392b;
  font-size: 0.875rem;
}

/* ── Mobile: hide "Get Started" signup button ───────────────────────────────── */

@media (max-width: 575px) {
  .nav-signup-btn {
    display: none;
  }
}

/* ── Submissions (past trade-in history) ────────────────────────────────────── */

.section-padded {
  padding: 0 2rem 2rem;
}

.submission-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 0 0 1rem;
  overflow: hidden;
}

.submission-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  background: var(--bg-subtle);
  gap: 1rem;
  user-select: none;
  transition: background .15s;
}

.submission-header:hover {
  background: #ede8f5;
}

.submission-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.submission-date {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.submission-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
}

.submission-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.submission-summary strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.submission-chevron {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-left: 0.25rem;
}

.submission-body {
  padding: 0;
}

.submission-empty {
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.submission-table {
  margin: 0;
}

.submission-table td,
.submission-table th {
  padding: 0.6rem 1.25rem;
}

/* Status badges — shared between submissions page and admin orders */
.submission-status {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.status-submitted {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-received {
  background: #fefce8;
  color: #a16207;
}

.status-graded {
  background: #fff7ed;
  color: #c2410c;
}

.status-settled {
  background: #f0fdf4;
  color: #15803d;
}

.status-cancelled {
  background: #f8f8f8;
  color: #888;
}

/* Profile pane link (plain text, not a button) */
.profile-pane-link {
  display: block;
  font-size: 0.875rem;
  color: var(--rvlvr-purple);
  text-decoration: none;
  padding: 0.4rem 0;
  text-align: center;
}

.profile-pane-link:hover {
  color: var(--rvlvr-purple-deep);
  text-decoration: underline;
}

/* Admin ID code */
.admin-id {
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

/* ── Admin nav link (top bar) ───────────────────────────────────────────────── */

.nav-admin-link {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--rvlvr-purple);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--rvlvr-purple);
  border-radius: 3px;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.nav-admin-link:hover {
  background: var(--rvlvr-purple);
  color: #fff;
}

.nav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  padding: 1px 4px 0;
  border-radius: 8px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* ── Admin shell layout ─────────────────────────────────────────────────────── */

.admin-shell {
  display: flex;
  min-height: calc(100vh - 65px);
  --sidebar-w: 220px;
  /* Paint the sidebar background on the parent so it always fills the full
     container height, even when page content scrolls past the viewport. */
  background: linear-gradient(to right, var(--rvlvr-black) var(--sidebar-w), var(--bg-page) var(--sidebar-w));
  transition: background .2s ease;
}

.admin-shell.sidebar-collapsed {
  --sidebar-w: 48px;
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 1.5rem 0;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  transition: width .2s ease;
}

.admin-sidebar.collapsed {
  width: 48px;
}

/* Toggle button */
.admin-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0 0 0.75rem 0.9rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: rgba(183, 201, 207, 0.45);
  cursor: pointer;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}

.admin-sidebar-toggle:hover {
  background: rgba(56, 127, 39, 0.12);
  color: #fff;
}

.sidebar-toggle-icon {
  transition: transform .2s ease;
}

.admin-sidebar.collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

/* Collapse: hide text labels and subnav */
.admin-sidebar.collapsed .nav-label,
.admin-sidebar.collapsed .admin-subnav {
  display: none;
}

.admin-sidebar.collapsed .admin-nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.admin-sidebar.collapsed .admin-nav-link svg {
  opacity: 0.75;
}

.admin-sidebar-label {
  padding: 0 1.25rem 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(183, 201, 207, 0.35);
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.25rem;
  color: #B7C9CF;
  text-decoration: none;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}

.admin-nav-link:hover {
  background: rgba(56, 127, 39, 0.1);
  color: #fff;
}

.admin-nav-link.active {
  background: rgba(56, 127, 39, 0.14);
  color: var(--rvlvr-purple);
  border-left-color: var(--rvlvr-purple);
}

.admin-nav-link svg {
  opacity: 0.7;
  flex-shrink: 0;
}

.admin-nav-link.active svg {
  opacity: 1;
}

.admin-content {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1400px;
  min-width: 0;
}

/* Lookup widget inside admin shell — strip standalone page constraints */
.admin-content .lookup-main {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* ── Admin typography ───────────────────────────────────────────────────────── */

.admin-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 1.5rem;
}

.admin-count {
  font-weight: 400;
  font-size: 1rem;
  color: var(--text-muted);
}

.admin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.admin-title-row .admin-page-title {
  margin-bottom: 0;
}

.admin-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.admin-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Admin section heading ──────────────────────────────────────────────────── */

.admin-section-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 2rem 0 0;
}

/* ── Admin alerts ───────────────────────────────────────────────────────────── */

.admin-alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.admin-alert-error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
}

/* ── Admin empty states ─────────────────────────────────────────────────────── */

.admin-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.admin-empty-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ── Admin table ────────────────────────────────────────────────────────────── */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-table tbody tr:hover>td {
  background: #f8f5fd;
}

.admin-table tbody tr.is-open>td {
  background: #f3eafa;
}

/* ── Admin badges ───────────────────────────────────────────────────────────── */

.admin-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(56, 127, 39, 0.1);
  color: var(--rvlvr-purple);
  margin-left: 0.4rem;
}

.admin-badge-green {
  background: #f0fdf4;
  color: #15803d;
}

.admin-badge-gray {
  background: #f1f5f9;
  color: #64748b;
}

/* ── Dashboard stat cards ───────────────────────────────────────────────────── */

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.admin-stat-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.admin-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(11, 21, 38, 0.6);
  margin-bottom: 0.4rem;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--rvlvr-black);
  line-height: 1;
}

/* ── Dashboard section cards ────────────────────────────────────────────────── */

.admin-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.admin-section-card {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
}

.admin-section-card:hover {
  border-color: var(--rvlvr-purple);
  box-shadow: 0 2px 12px rgba(56, 127, 39, 0.1);
  color: var(--text-primary);
}

.admin-section-card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.admin-section-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Admin sidebar sub-nav ──────────────────────────────────────────────────── */

.admin-subnav {
  margin: 0.1rem 0 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  margin-left: 1.6rem;
  padding-left: 0;
}

.admin-subnav-link {
  display: block;
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  color: rgba(183, 201, 207, 0.6);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}

.admin-subnav-link:hover {
  color: #fff;
  background: rgba(56, 127, 39, 0.08);
}

.admin-subnav-link.active {
  color: var(--rvlvr-purple);
  border-left-color: var(--rvlvr-purple);
  background: rgba(56, 127, 39, 0.12);
}

/* ── Admin filter bar ───────────────────────────────────────────────────────── */

.admin-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.admin-filter-select {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  color: var(--text-primary);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s;
  min-width: 160px;
}

.admin-filter-select:focus {
  outline: none;
  border-color: var(--rvlvr-purple);
}

.admin-filter-clear {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: color .15s, border-color .15s;
}

.admin-filter-clear:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.admin-filter-input {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  color: var(--text-primary);
  background: #fff;
  width: 240px;
  transition: border-color .15s;
}

.admin-filter-input:focus {
  outline: none;
  border-color: var(--rvlvr-purple);
}

/* ── Pivot table ────────────────────────────────────────────────────────────── */

.pivot-value-cell {
  font-weight: 600;
  max-width: 340px;
}

.pivot-catalog-link {
  color: var(--text-primary);
  text-decoration: none;
}

.pivot-catalog-link:hover {
  color: var(--rvlvr-purple);
  text-decoration: underline;
}

.pivot-count-col {
  text-align: right;
  width: 5rem;
}

.pivot-year-table .pivot-cat-cell {
  font-size: 0.8rem;
  white-space: nowrap;
}

.pivot-fmv {
  color: var(--text-primary);
}

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

.pivot-count-badge {
  display: inline-block;
  background: rgba(56, 127, 39, 0.1);
  color: var(--rvlvr-purple);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

/* ── Pivot link (in catalog spec detail) ────────────────────────────────────── */

.pivot-link {
  color: var(--rvlvr-purple);
  text-decoration: none;
}

.pivot-link:hover {
  text-decoration: underline;
  color: var(--rvlvr-purple-deep);
}

/* ── Pivot year charts ──────────────────────────────────────────────────────── */

.pivot-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.pivot-chart-card {
  position: relative;
  min-width: 0;
  /* allow grid item to shrink below canvas pixel width */
  overflow: hidden;
  /* prevent canvas from forcing card wider */
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem 1.25rem 1rem;
}

/* ── Responsive admin layout ────────────────────────────────────────────────── */

/* 1600px: auto-collapse sidebar */
@media (max-width: 1600px) {
  .admin-shell {
    --sidebar-w: 48px;
  }

  .admin-sidebar {
    width: 48px;
  }

  .admin-sidebar .nav-label,
  .admin-sidebar .admin-subnav {
    display: none;
  }

  .admin-sidebar .admin-nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .admin-sidebar .admin-sidebar-toggle {
    margin-left: 11px;
  }

  .admin-sidebar .sidebar-toggle-icon {
    transform: rotate(180deg);
  }

  /* If the user manually expanded via JS, honour it */
  .admin-sidebar.force-expanded {
    width: 220px;
  }

  .admin-shell.force-expanded {
    --sidebar-w: 220px;
  }

  .admin-sidebar.force-expanded .nav-label,
  .admin-sidebar.force-expanded .admin-subnav {
    display: revert;
  }

  .admin-sidebar.force-expanded .admin-nav-link {
    justify-content: flex-start;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .admin-sidebar.force-expanded .sidebar-toggle-icon {
    transform: rotate(0deg);
  }

  .admin-sidebar.force-expanded .admin-sidebar-toggle {
    margin-left: 0.9rem;
  }
}

/* 1460px: start compressing chart cards */
@media (max-width: 1460px) {
  .admin-content {
    padding: 2rem 1.5rem;
  }

  .pivot-chart-card {
    padding: 1rem;
  }
}

/* 907px: single-column charts; stat cards wrap naturally via auto-fit */
@media (max-width: 907px) {
  .pivot-charts-grid {
    grid-template-columns: 1fr;
  }

  .admin-content {
    padding: 1.5rem 1rem;
  }
}

.pivot-chart-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.pivot-chart-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
  font-style: italic;
}

.pivot-charts-footnote {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.pivot-charts-footnote code {
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* ── Admin back link ────────────────────────────────────────────────────────── */

.admin-back-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}

.admin-back-link:hover {
  color: var(--text-primary);
}

/* ── Sortable column headers ─────────────────────────────────────────────────── */

.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.sort-link:hover {
  color: var(--rvlvr-purple);
}

.sort-indicator {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.sort-indicator.active {
  color: var(--rvlvr-purple);
  opacity: 1;
}

/* ── Catalog expandable rows ────────────────────────────────────────────────── */

.catalog-row {
  cursor: pointer;
  user-select: none;
}

.catalog-expand-cell {
  color: var(--text-muted);
  font-size: 0.6rem;
}

.catalog-expand-icon {
  display: inline-block;
  transition: transform .15s;
}

.catalog-row.is-open .catalog-expand-icon {
  transform: rotate(90deg);
}

.catalog-detail-row td {
  background: #f3f8f1 !important;
  border-bottom: 2px solid rgba(56, 127, 39, 0.15);
}

.catalog-detail-row:hover td {
  background: #f3f8f1 !important;
}

.catalog-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 0.75rem 0;
}

.catalog-detail-section {
  min-width: 180px;
}

.catalog-detail-heading {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.catalog-grade-table {
  border-collapse: collapse;
  font-size: 0.8rem;
}

.catalog-grade-table th {
  text-align: left;
  padding: 0.2rem 0.75rem 0.2rem 0;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.catalog-grade-table td {
  padding: 0.2rem 0.75rem 0.2rem 0;
  border: none;
  vertical-align: middle;
}

/* ── Order line items table (inside expandable detail row) ──────────────────── */

.order-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0.5rem 0 0.75rem;
}

.order-items-table th {
  text-align: left;
  padding: 0.3rem 0.75rem 0.3rem 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.order-items-table td {
  padding: 0.45rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  vertical-align: middle;
}

.order-items-table tbody tr:last-child td {
  border-bottom: none;
}

.order-items-table .num-col {
  text-align: right;
  padding-right: 0;
}

.catalog-spec-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.75rem;
  font-size: 0.8rem;
  margin: 0;
}

.catalog-spec-list dt {
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.catalog-spec-list dd {
  margin: 0;
  color: var(--text-primary);
}

.catalog-sources {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.catalog-sources li a {
  color: var(--rvlvr-purple);
  text-decoration: underline;
  word-break: break-all;
}

.catalog-detail-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  width: 100%;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.catalog-detail-meta code {
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

/* ── Confidence bar ─────────────────────────────────────────────────────────── */

.confidence-bar {
  display: inline-block;
  width: 50px;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.confidence-fill {
  display: block;
  height: 100%;
  background: var(--rvlvr-purple);
  border-radius: 3px;
  transition: width .3s;
}

/* ── Category badges ────────────────────────────────────────────────────────── */

.category-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.category-laptop {
  background: #eff6ff;
  color: #1d4ed8;
}

.category-desktop {
  background: #f0fdf4;
  color: #15803d;
}

.category-server {
  background: #fefce8;
  color: #a16207;
}

.category-network {
  background: #fff7ed;
  color: #c2410c;
}

/* ── Pagination ─────────────────────────────────────────────────────────────── */

.admin-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
}

.admin-pagination a,
.admin-pagination span {
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
}

.admin-pagination a:hover {
  border-color: var(--rvlvr-purple);
  color: var(--rvlvr-purple);
}

.admin-pagination .current {
  background: var(--rvlvr-purple);
  border-color: var(--rvlvr-purple);
  color: #fff;
}

.admin-pagination .disabled {
  color: #adb5bd;
  pointer-events: none;
}

.admin-pagination-info {
  margin-left: auto;
  color: var(--text-muted);
  border: none !important;
  padding: 0 !important;
  font-size: 0.8rem;
}

.admin-pagination-size {
  color: var(--text-muted);
  border: none !important;
  padding: 0 !important;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-pagination-size a {
  border: none !important;
  padding: 0 !important;
  color: var(--rvlvr-purple);
}

.admin-pagination-size strong {
  color: var(--text-primary);
}