:root {
  --bg: #0d1117;
  --panel: #161b22;
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --text: #e6edf3;
  --muted: #9ca3af;
  --border: #252b36;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --info: #38bdf8;
  --shadow: 0 12px 40px rgba(0,0,0,0.35);
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(45,212,191,0.08), transparent 32%),
              radial-gradient(circle at 80% 0%, rgba(148,163,184,0.12), transparent 30%),
              var(--bg);
  color: var(--text);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  margin: -12px -12px 18px;
  background: rgba(22,27,34,0.92);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}
.navbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
}
.nav-links {
  display: flex;
  gap: 16px;
}
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
}
.nav-link:hover, .nav-link:focus {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.user-menu {
  position: relative;
}
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: #0f141c;
  color: var(--text);
  padding: 6px 10px 6px 6px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}
.user-pill .avatar {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #0c1117;
  font-weight: 700;
}
.user-dropdown {
  position: absolute;
  right: 0;
  top: 44px;
  min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
}
.user-dropdown a {
  color: var(--text);
  text-decoration: none;
  padding: 10px 12px;
}
.user-dropdown a:hover {
  background: rgba(255,255,255,0.04);
}
.user-menu:hover .user-dropdown,
.user-menu:focus-within .user-dropdown {
  display: flex;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 8px 20px rgba(20,184,166,0.25);
}
.btn.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  box-shadow: none;
}
.btn.danger { background: var(--danger); box-shadow: 0 8px 20px rgba(239,68,68,0.3); }
.btn.small { padding: 7px 10px; font-size: 14px; }

.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.table th, .table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th { color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: 0.4px; }
.table tr:hover { background: rgba(255,255,255,0.02); }

form label { display: block; margin: 12px 0 6px; font-weight: 600; color: var(--muted); }
form input, form select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b0f14;
  color: var(--text);
}
form input:focus, form select:focus { outline: 1px solid var(--accent); }

.alert { padding: 12px 14px; border-radius: 10px; margin: 10px 0 14px; }
.alert.error { background: rgba(239,68,68,0.14); border: 1px solid rgba(239,68,68,0.35); }

.flex { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

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

.stat-card {
  flex: 1 1 200px;
  background: #0f141c;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.22);
}
.stat-number {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f141c;
  color: var(--text);
  cursor: pointer;
}
.icon-button:hover { background: rgba(255,255,255,0.04); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  background: rgba(56,189,248,0.15);
  color: var(--info);
  border: 1px solid rgba(56,189,248,0.35);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  max-width: 520px;
  width: 92%;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 8px; }
.modal .muted { margin: 0 0 14px; }
.modal-close {
  float: right;
  cursor: pointer;
  color: var(--muted);
}

.modal.wide {
  max-width: 860px;
}
.scan-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}
.video-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  background: #0b0f14;
  border: 1px solid var(--border);
  object-fit: cover;
}
.scan-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.results-table th, .results-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.results-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.results-table tr:hover { background: rgba(255,255,255,0.03); }
.thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: #0b0f14;
  cursor: pointer;
}
.item-image {
  width: 92px;
  height: 92px;
  border-radius: 14px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: #0b0f14;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.tab-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f141c;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: #0c1117;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

@media (max-width: 720px) {
  .navbar { flex-direction: column; align-items: flex-start; gap: 10px; position: static; margin: 0 0 16px; }
  .nav-links { width: 100%; flex-wrap: wrap; }
  .table th, .table td { white-space: normal; }
  .scan-layout { grid-template-columns: 1fr; }
}
