:root {
  color-scheme: dark;
  --bg: #020711;
  --panel: rgba(7, 18, 32, 0.86);
  --panel-strong: rgba(9, 25, 44, 0.96);
  --line: rgba(23, 156, 255, 0.28);
  --line-strong: rgba(34, 181, 255, 0.72);
  --text: #f4f8ff;
  --muted: #92a5bc;
  --dim: #63758b;
  --blue: #00aaff;
  --cyan: #32e7ff;
  --green: #36f082;
  --yellow: #ffcc33;
  --red: #ff5871;
  --orange: #ff9f43;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
  --radius: 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 0%, rgba(0, 170, 255, 0.26), transparent 32rem),
    radial-gradient(circle at 90% 14%, rgba(50, 231, 255, 0.16), transparent 28rem),
    linear-gradient(140deg, #01040b 0%, #06111d 45%, #020711 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(circle at center, #000 0, transparent 72%);
}

a {
  color: inherit;
}

code {
  color: var(--cyan);
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  width: min(1600px, calc(100vw - 32px));
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  height: calc(100vh - 36px);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 20px;
  background: linear-gradient(165deg, rgba(8, 21, 38, 0.94), rgba(1, 6, 12, 0.88));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  margin-top: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid rgba(50, 231, 255, 0.38);
  background:
    radial-gradient(circle at 70% 18%, rgba(50, 231, 255, 0.56), transparent 34%),
    linear-gradient(145deg, rgba(0, 170, 255, 0.28), rgba(0, 0, 0, 0.68));
  color: white;
  font-size: 1.8rem;
  font-weight: 1000;
  box-shadow: 0 0 28px rgba(0, 170, 255, 0.24);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  letter-spacing: 0.12em;
}

.brand span {
  color: var(--muted);
  font-size: 0.85rem;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  appearance: none;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 17px;
  padding: 12px 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-weight: 800;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  border-color: rgba(50, 231, 255, 0.28);
  background: rgba(0, 170, 255, 0.13);
  transform: translateX(2px);
}

.sidebar-card {
  margin-top: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.22);
}

.sidebar-card strong,
.sidebar-card small,
.mini-label {
  display: block;
}

.mini-label {
  color: var(--cyan);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 6px;
}

.sidebar-card small {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.good-text {
  color: var(--green);
}

.warn-text {
  color: var(--yellow);
}

.shell {
  position: relative;
  min-width: 0;
  padding: 42px 0 80px;
}

.hero,
.panel,
.stat-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(8, 21, 38, 0.92), rgba(1, 7, 14, 0.82));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: center;
  border-radius: 34px;
  padding: 34px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: 0.9;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 7px;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 0;
}

.hero-actions,
.export-actions,
.search-row,
.token-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.button {
  appearance: none;
  border: 1px solid rgba(67, 197, 255, 0.65);
  border-radius: 999px;
  background: linear-gradient(135deg, #00aaff, #006eff);
  color: white;
  cursor: pointer;
  padding: 12px 18px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 12px 34px rgba(0, 145, 255, 0.26);
  transition: transform 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.7;
}

.button.secondary {
  background: rgba(4, 18, 33, 0.76);
  color: var(--text);
}

.button.danger {
  border-color: rgba(255, 88, 113, 0.78);
  background: linear-gradient(135deg, rgba(255, 88, 113, 0.88), rgba(108, 18, 31, 0.88));
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

.stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 22px;
}

.stat-card {
  border-radius: 24px;
  padding: 18px;
  min-height: 128px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  margin-bottom: 14px;
  color: var(--cyan);
  background: rgba(0, 170, 255, 0.13);
  border: 1px solid rgba(0, 170, 255, 0.28);
  font-size: 1.2rem;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.stat-label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.86rem;
}

.panel {
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

input,
textarea {
  width: 100%;
  min-width: 180px;
  border: 1px solid rgba(86, 174, 255, 0.28);
  border-radius: 18px;
  color: var(--text);
  background: rgba(0, 7, 14, 0.65);
  padding: 13px 14px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 96px;
  grid-column: 1 / -1;
}

input:focus,
textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(0, 170, 255, 0.12);
}

.search-row input:first-child {
  min-width: min(360px, 100%);
}

.search-row.compact input,
.token-row input {
  min-width: 220px;
  flex: 1;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.compact-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  border: 1px solid rgba(35, 157, 255, 0.18);
  border-radius: 22px;
  padding: 18px;
  background: rgba(1, 9, 18, 0.72);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid rgba(0, 170, 255, 0.28);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--cyan);
  background: rgba(0, 170, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.good {
  color: var(--green);
  border-color: rgba(54, 240, 130, 0.38);
  background: rgba(54, 240, 130, 0.1);
}

.badge.warn {
  color: var(--yellow);
  border-color: rgba(255, 204, 51, 0.34);
  background: rgba(255, 204, 51, 0.1);
}

.badge.bad {
  color: var(--red);
  border-color: rgba(255, 88, 113, 0.34);
  background: rgba(255, 88, 113, 0.1);
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.dim {
  color: var(--dim);
  line-height: 1.55;
}

.dashboard-summary,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-card {
  border: 1px solid rgba(35, 157, 255, 0.18);
  border-radius: 20px;
  padding: 16px;
  background: rgba(0,0,0,0.22);
}

.summary-card strong,
.summary-card span {
  display: block;
}

.summary-card span {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.5;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--cyan);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.unknown-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.source-item {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 14px;
  background: rgba(0,0,0,0.22);
}

.source-item a {
  color: var(--cyan);
  text-decoration: none;
}

details {
  margin-top: 10px;
  border: 1px solid rgba(35, 157, 255, 0.16);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.18);
}

summary {
  cursor: pointer;
  color: var(--cyan);
  font-weight: 800;
}

.mini-list {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.mini-list > div {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 9px;
}

.vehicle-image-card {
  display: grid;
  gap: 12px;
}

.vehicle-image-stage {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px dashed rgba(50, 231, 255, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.035) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  overflow: hidden;
}

.vehicle-image-stage img {
  width: 100%;
  height: 210px;
  object-fit: contain;
  padding: 12px;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.35));
}

.enrich-btn {
  margin-top: 10px;
}

.code-block {
  overflow-x: auto;
  border: 1px solid rgba(50, 231, 255, 0.22);
  border-radius: 16px;
  padding: 14px;
  background: rgba(0, 4, 9, 0.78);
  color: #dff7ff;
  line-height: 1.5;
  white-space: pre;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 5, 12, 0.72);
  backdrop-filter: blur(10px);
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-card {
  display: grid;
  justify-items: center;
  gap: 9px;
  border: 1px solid rgba(50, 231, 255, 0.32);
  border-radius: 26px;
  padding: 28px;
  background: rgba(3, 13, 24, 0.96);
  box-shadow: var(--shadow);
}

.loader-card span {
  color: var(--muted);
}

.loader-orb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid rgba(0, 170, 255, 0.18);
  border-top-color: var(--cyan);
  box-shadow: 0 0 28px rgba(0, 170, 255, 0.45);
  animation: spin 0.9s linear infinite;
}

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

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  z-index: 30;
  border: 1px solid rgba(50, 231, 255, 0.32);
  border-radius: 18px;
  color: var(--text);
  background: rgba(3, 13, 24, 0.95);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .app-shell {
    display: block;
    width: min(100vw - 24px, 1380px);
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cards,
  .source-list,
  .settings-grid,
  .dashboard-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 18px, 1380px);
  }

  .shell {
    padding-top: 18px;
  }

  .hero,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

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

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel,
  .hero,
  .sidebar {
    padding: 18px;
    border-radius: 22px;
  }

  .unknown-form {
    grid-template-columns: 1fr;
  }
}
