:root {
  --bg-dark: #e3f2fd;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f5;
  --yellow: #ffcb05;
  --yellow-dim: #e6b800;
  --red: #e3350d;
  --blue: #3d7dca;
  --blue-light: #64b5f6;
  --green: #78c850;
  --text: #1a237e;
  --text-muted: #5c6bc0;
  --border: #bbdefb;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 50%, #90caf9 100%);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-light); }

.navbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 3px solid var(--yellow);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--yellow);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand span { color: var(--red); }

.nav-links { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--blue); }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 { font-size: 1.75rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  border-top: 4px solid var(--yellow);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-card .label { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.25rem; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; color: var(--yellow); }

.card-panel {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); color: inherit; }
.btn-primary { background: var(--yellow); color: #1a1a2e; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.btn-secondary { background: var(--blue); color: white; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.btn-danger { background: var(--red); color: white; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.btn-outline { background: white; border: 2px solid var(--border); color: var(--text); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: var(--bg-card-hover); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-sealed { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.badge-opened { background: #fff9e6; color: #f57f17; border: 1px solid #ffeb3b; }
.badge-pulled { background: #e8f5e9; color: #2e7d32; border: 1px solid #81c784; }
.badge-purchased { background: #f3e5f5; color: #6a1b9a; border: 1px solid #ce93d8; }
.badge-traded { background: #fff3e0; color: #e65100; border: 1px solid #ffb74d; }
.badge-sold { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; color: var(--text-muted); font-size: 0.9rem; }
.form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: #fafafa;
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(61, 125, 202, 0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: white;
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
}
.tab:hover { border-color: var(--blue-light); }
.tab.active { background: var(--yellow); color: #1a1a2e; border-color: var(--yellow); font-weight: 600; box-shadow: 0 2px 8px rgba(255, 203, 5, 0.3); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.card-tile {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.card-tile:hover { transform: scale(1.03); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
.card-tile.owned { border-color: var(--green); box-shadow: 0 2px 4px rgba(120, 200, 80, 0.3); }
.card-tile.missing { opacity: 0.5; }

.card-tile img {
  width: 100%;
  aspect-ratio: 2.5/3.5;
  object-fit: cover;
  background: #e8f5e9;
}

.card-tile .info { padding: 0.5rem; font-size: 0.8rem; }
.card-tile .owned-badge {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: var(--green);
  color: #052e16;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.set-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.set-card:hover { border-color: var(--yellow); box-shadow: 0 4px 12px rgba(255, 203, 5, 0.3); }
.set-card img { width: 48px; height: 48px; object-fit: contain; }
.set-card .progress { flex: 1; }
.progress-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  margin-top: 0.4rem;
  overflow: hidden;
}
.progress-bar .fill { height: 100%; background: linear-gradient(90deg, var(--yellow) 0%, var(--yellow-dim) 100%); border-radius: 4px; transition: width 0.3s ease; }

.auth-container {
  max-width: 420px;
  margin: 4rem auto;
  padding: 2rem;
  background: white;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  border-top: 4px solid var(--yellow);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.auth-container h1 { text-align: center; margin-bottom: 1.5rem; color: var(--yellow); text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); }
.error { background: #ffebee; color: #c62828; padding: 0.75rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid #ef9a9a; }

.search-results {
  position: absolute;
  z-index: 50;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-result-item {
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  transition: background 0.15s;
}
.search-result-item:hover { background: #f5f5f5; }
.search-result-item img { width: 36px; height: 50px; object-fit: cover; border-radius: 4px; }

.search-wrapper { position: relative; }

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.profit { color: var(--green); }
.loss { color: var(--red); }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
