/* ============================================================
   CardVault AI — Premium UI
   HutchGroup LLC
   Theme: Midnight Navy + Gold — Luxury Collector's Platform
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:        #070B14;
  --bg-surface:     #0D1321;
  --bg-raised:      #121929;
  --bg-card:        #16203A;
  --bg-hover:       #1A2642;

  /* Gold system */
  --gold:           #C9A84C;
  --gold-light:     #E8C96A;
  --gold-dim:       rgba(201, 168, 76, 0.15);
  --gold-border:    rgba(201, 168, 76, 0.25);
  --gold-glow:      rgba(201, 168, 76, 0.08);

  /* Blue accent (interactive) */
  --blue:           #4F8EF7;
  --blue-dim:       rgba(79, 142, 247, 0.12);
  --blue-border:    rgba(79, 142, 247, 0.3);

  /* Semantic */
  --emerald:        #10B981;
  --emerald-dim:    rgba(16, 185, 129, 0.12);
  --red:            #EF4444;
  --red-dim:        rgba(239, 68, 68, 0.12);
  --amber:          #F59E0B;
  --amber-dim:      rgba(245, 158, 11, 0.12);

  /* Text */
  --text:           #F1F5F9;
  --text-sub:       #94A3B8;
  --text-dim:       #64748B;
  --text-gold:      #C9A84C;

  /* Borders */
  --border:         rgba(255,255,255,0.06);
  --border-strong:  rgba(255,255,255,0.12);

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  22px;

  /* Shadows */
  --shadow-card:  0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-glow:  0 0 30px rgba(201, 168, 76, 0.12);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg-base);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ─────────────────────────────────────────────── */
.app-shell {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Header ────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 11, 20, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--gold-border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #C9A84C 0%, #F0CE57 50%, #9A7A2A 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 12px rgba(201,168,76,0.35);
  flex-shrink: 0;
}
.app-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}
.app-brand span { color: var(--gold); }

/* ── Navigation ────────────────────────────────────────────── */
.app-nav {
  display: flex;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.app-nav::-webkit-scrollbar { display: none; }
.nav-item {
  flex: 1;
  min-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 8px 12px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  transition: color .2s;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  position: relative;
}
.nav-item .nav-icon { font-size: 18px; }
.nav-item:hover { color: var(--text-sub); }
.nav-item.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ── Page ──────────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Typography ────────────────────────────────────────────── */
.page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.2;
}
.page-sub {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 24px;
  line-height: 1.5;
}
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* ── Value Display ─────────────────────────────────────────── */
.value-hero {
  background: linear-gradient(135deg, #0D1321 0%, #16203A 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-xl);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}
.value-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(201,168,76,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.value-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.value-amount {
  font-size: 42px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 8px;
}
.value-meta {
  font-size: 13px;
  color: var(--text-sub);
}

/* ── Stat Row ──────────────────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stat-box {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 12px;
  text-align: center;
}
.stat-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.stat-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ── Cards (UI panels) ─────────────────────────────────────── */
.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 14px;
}
.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .18s ease;
  letter-spacing: 0.1px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #C9A84C, #E8C96A);
  color: #070B14;
}
.btn-primary:hover { background: linear-gradient(135deg, #D4B85C, #F0D07A); }

.btn-secondary {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}
.btn-secondary:hover { background: rgba(79,142,247,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ── Upload Zone ───────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gold-border);
  border-radius: var(--r-xl);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gold-glow);
  position: relative;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--gold);
  background: var(--gold-dim);
}
.upload-icon { font-size: 44px; margin-bottom: 12px; display: block; }
.upload-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.upload-sub {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 20px;
}

/* ── Card Collection Grid ──────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.card-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all .2s;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.card-item:hover {
  border-color: var(--gold-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.card-img-wrap {
  aspect-ratio: 3/4;
  background: var(--bg-base);
  overflow: hidden;
  position: relative;
}
.card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.card-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  color: var(--text-dim);
}
.card-info {
  padding: 10px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-player-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.2px;
}
.card-meta {
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.3;
}
.card-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.card-value.unknown { color: var(--text-dim); font-size: 11px; font-weight: 500; }

/* ── Tag Badges ────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tag-rc       { background: rgba(239,68,68,0.15);   color: #EF4444; }
.tag-auto     { background: rgba(79,142,247,0.15);   color: #4F8EF7; }
.tag-patch    { background: rgba(245,158,11,0.15);   color: #F59E0B; }
.tag-gold     { background: var(--gold-dim);         color: var(--gold); }
.tag-numbered { background: rgba(139,92,246,0.15);   color: #8B5CF6; }
.tag-ssp      { background: rgba(16,185,129,0.15);   color: #10B981; }
.tag-prizm    { background: rgba(236,72,153,0.15);   color: #EC4899; }
.tag-base     { background: rgba(255,255,255,0.06);  color: var(--text-dim); }

/* ── Detected Card Grid (Scanner) ──────────────────────────── */
#cardGridInner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.card-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color .2s;
}
.card-cell.identified { border-color: rgba(201,168,76,0.4); }
.card-cell img { width: 100%; display: block; }
.card-cell-label {
  padding: 7px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-sub);
  line-height: 1.3;
}
.card-cell-label strong { color: var(--text); display: block; font-size: 11px; }

/* ── Form Inputs ───────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus { border-color: var(--gold); }
.form-input::placeholder { color: var(--text-dim); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
}
.form-check input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; }
.form-check label { font-size: 13px; color: var(--text-sub); cursor: pointer; flex: 1; }
.form-check.active { border-color: var(--gold-border); background: var(--gold-glow); }
.form-check.active label { color: var(--text); }

/* ── Toggle Checkbox Group ─────────────────────────────────── */
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── Progress / Confidence ─────────────────────────────────── */
.confidence-track {
  background: var(--bg-base);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
}
.confidence-fill {
  height: 100%;
  border-radius: 100px;
  transition: width .4s ease;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

/* ── Toast ─────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
  white-space: nowrap;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#toast.show { opacity: 1; }
#toast.error { border-color: rgba(239,68,68,0.4); color: #EF4444; }
#toast.success { border-color: rgba(201,168,76,0.4); color: var(--gold); }

/* ── Mode Selector ─────────────────────────────────────────── */
.mode-pills {
  display: flex;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}
.mode-pill {
  flex: 1;
  padding: 10px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}
.mode-pill.active {
  background: var(--bg-raised);
  color: var(--gold);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  border: 1px solid var(--gold-border);
}

/* ── Booklet Card ──────────────────────────────────────────── */
.booklet-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 12px;
  text-decoration: none;
  display: block;
  transition: all .2s;
}
.booklet-card:hover {
  border-color: var(--gold-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.booklet-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.booklet-meta { font-size: 12px; color: var(--text-sub); }
.booklet-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}

/* ── Batch Progress ────────────────────────────────────────── */
.batch-page-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  transition: border-color .2s;
}
.batch-page-row.done { border-color: rgba(201,168,76,0.25); }
.batch-page-row .page-name { flex: 1; color: var(--text-sub); font-size: 12px; }
.batch-page-row .page-result { font-size: 11px; font-weight: 700; color: var(--emerald); }

/* ── Card Detail ───────────────────────────────────────────── */
.card-hero-image {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  display: block;
  margin-bottom: 20px;
}
.card-detail-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 4px;
}
.card-detail-sub {
  font-size: 15px;
  color: var(--text-sub);
  margin-bottom: 16px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .detail-key { color: var(--text-dim); font-weight: 600; }
.detail-row .detail-val { color: var(--text); font-weight: 700; text-align: right; }

/* ── Value Estimate Panel ──────────────────────────────────── */
.estimate-box {
  background: linear-gradient(135deg, #0D1321, #16203A);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-xl);
  padding: 22px;
  text-align: center;
  box-shadow: var(--shadow-glow);
}
.estimate-price {
  font-size: 36px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.estimate-range {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}
.estimate-trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 100px;
}
.estimate-trend.up   { background: var(--emerald-dim); color: var(--emerald); }
.estimate-trend.down { background: var(--red-dim);     color: var(--red); }
.estimate-trend.flat { background: var(--amber-dim);   color: var(--amber); }

/* ── Grading Recommendation ────────────────────────────────── */
.grade-rec {
  border-radius: var(--r-lg);
  padding: 16px;
  margin-top: 12px;
}
.grade-rec.strong  { background: var(--emerald-dim); border: 1px solid rgba(16,185,129,0.25); }
.grade-rec.maybe   { background: var(--amber-dim);   border: 1px solid rgba(245,158,11,0.25); }
.grade-rec.no      { background: var(--bg-raised);   border: 1px solid var(--border); }
.grade-rec-title   { font-size: 13px; font-weight: 800; margin-bottom: 4px; }
.grade-rec-desc    { font-size: 12px; color: var(--text-sub); }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-sub { font-size: 14px; color: var(--text-sub); margin-bottom: 24px; }

/* ── Settings ──────────────────────────────────────────────── */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; font-weight: 600; color: var(--text); }
.setting-sub   { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.setting-val   { font-size: 13px; font-weight: 700; color: var(--gold); }

/* ── Debug Log ─────────────────────────────────────────────── */
#debugBox {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  margin-top: 12px;
}
#debugLog {
  max-height: 140px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  user-select: text;
  -webkit-user-select: text;
  color: var(--text-sub);
  line-height: 1.6;
}

/* ── Error Box ─────────────────────────────────────────────── */
#errorBox {
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--r-md);
  padding: 14px;
  color: var(--red);
  font-weight: 600;
  font-size: 13px;
  margin-top: 12px;
}

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ── Utility ───────────────────────────────────────────────── */
.text-gold    { color: var(--gold); }
.text-emerald { color: var(--emerald); }
.text-red     { color: var(--red); }
.text-sub     { color: var(--text-sub); }
.text-center  { text-align: center; }
.fw-800       { font-weight: 800; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-16        { margin-bottom: 16px; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.wrap         { flex-wrap: wrap; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* ── Mobile safe area ──────────────────────────────────────── */
@media (max-width: 380px) {
  .page-title { font-size: 22px; }
  .value-amount { font-size: 34px; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* ── Selection ─────────────────────────────────────────────── */
::selection { background: var(--gold-dim); color: var(--text); }

/* ── Portfolio Dashboard ────────────────────────────────────── */
.port-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .port-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.port-kpi {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}

.port-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.port-kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.port-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .port-charts-row { grid-template-columns: 1fr; }
}

/* Top 10 ranking */
.port-rank-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

.port-rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.rank-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--electric-purple);
  width: 32px;
  flex-shrink: 0;
}

.rank-info { flex: 1; min-width: 0; }

.rank-player {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-set { font-size: 12px; color: var(--muted); margin-top: 2px; }

.rank-right { text-align: right; flex-shrink: 0; }

.rank-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--slime-green);
  margin-bottom: 6px;
}

.rank-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  width: 80px;
}

.rank-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--electric-purple), var(--slime-green));
  border-radius: 2px;
  transition: width 1s ease;
}

/* Grading candidates */
.grade-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.grade-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,232,24,0.04);
  border: 1px solid rgba(255,232,24,0.15);
  border-radius: 10px;
}

.grade-info { flex: 1; }
.grade-player { font-size: 14px; font-weight: 700; }
.grade-set { font-size: 12px; color: var(--muted); margin-top: 2px; }
.grade-value { font-size: 15px; font-weight: 700; color: var(--radical-yellow); flex-shrink: 0; }
.grade-rec { font-size: 12px; color: var(--muted); flex-shrink: 0; margin-left: 8px; }

/* Booklets */
.booklet-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.booklet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
}
