*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d12;
  --surface: #16161f;
  --surface2: #1e1e2a;
  --border: #2a2a38;
  --text: #e8e8f0;
  --text-dim: #7878a0;
  --accent: #6c63ff;
  --accent-hover: #7d75ff;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --orange: #f97316;
  --grade-a: #22c55e;
  --grade-b: #6c63ff;
  --grade-c: #eab308;
  --grade-d: #f97316;
  --grade-f: #ef4444;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }
.app { max-width: 1400px; margin: 0 auto; padding: 0 24px 48px; }

/* Header */
.header { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.header-left { display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 24px; }
.logo-text { font-size: 20px; font-weight: 800; color: var(--text); }
.logo-sub { font-size: 12px; color: var(--text-dim); border-left: 1px solid var(--border); padding-left: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; font-family: var(--font); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-icon { font-size: 16px; }

/* Stats Bar */
.stats-bar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; text-align: center; }
.stat-value { display: block; font-size: 24px; font-weight: 700; color: var(--text); }
.stat-label { display: block; font-size: 11px; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Filters */
.filters { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.filter-group select { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: 13px; font-family: var(--font); cursor: pointer; min-width: 140px; }
.filter-group select:focus { outline: none; border-color: var(--accent); }

/* Loading */
.loading { display: flex; align-items: center; gap: 12px; padding: 48px; justify-content: center; color: var(--text-dim); }
.loading.hidden { display: none; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Deal Grid */
.deals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* Deal Card */
.deal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; cursor: pointer; transition: all 0.15s; position: relative; }
.deal-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.deal-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.deal-title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; }
.grade-badge { font-size: 20px; font-weight: 800; min-width: 40px; text-align: center; }
.grade-A { color: var(--grade-a); }
.grade-B { color: var(--grade-b); }
.grade-C { color: var(--grade-c); }
.grade-D { color: var(--grade-d); }
.grade-F { color: var(--grade-f); }
.deal-score { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.deal-price { font-size: 22px; font-weight: 800; color: var(--text); }
.deal-price-label { font-size: 11px; color: var(--text-dim); }
.deal-metrics { display: flex; gap: 16px; margin: 12px 0; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.metric { display: flex; flex-direction: column; }
.metric-value { font-size: 14px; font-weight: 700; }
.metric-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.deal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); font-size: 11px; padding: 3px 8px; border-radius: 4px; }
.deal-footer { display: flex; justify-content: space-between; align-items: center; }
.model-badge { font-size: 11px; color: var(--text-dim); background: var(--surface2); padding: 4px 8px; border-radius: 4px; }
.watch-btn { font-size: 18px; background: none; border: none; cursor: pointer; color: var(--text-dim); transition: color 0.15s; padding: 4px; }
.watch-btn:hover { color: var(--accent); }
.watch-btn.active { color: var(--yellow); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; }
.pagination button { padding: 8px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 13px; font-family: var(--font); }
.pagination button:hover:not(:disabled) { background: var(--surface2); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { color: var(--text-dim); font-size: 13px; padding: 0 12px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; max-width: 560px; width: 90%; max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; }
.modal-close:hover { color: var(--text); }

/* Modal Content */
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.modal-title { font-size: 20px; font-weight: 800; }
.modal-price { font-size: 28px; font-weight: 800; color: var(--text); }
.modal-grade { font-size: 32px; font-weight: 800; }
.modal-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.modal-meta-item { background: var(--surface2); padding: 12px; border-radius: 8px; }
.modal-meta-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.modal-meta-value { font-size: 16px; font-weight: 700; margin-top: 2px; }
.modal-section { margin-top: 20px; }
.modal-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 12px; font-weight: 600; }
.modal-description { color: var(--text-dim); line-height: 1.6; }
.score-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.score-bar-label { font-size: 12px; color: var(--text-dim); min-width: 140px; }
.score-bar { flex: 1; height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.score-bar-value { font-size: 12px; font-weight: 700; min-width: 32px; text-align: right; }
.modal-actions { display: flex; gap: 12px; margin-top: 24px; }
.btn-watch-add { background: var(--yellow); color: #000; font-weight: 700; }
.btn-watch-add:hover { background: #fbbf24; }
.btn-watch-remove { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }

/* Empty state */
.empty-state { grid-column: 1 / -1; text-align: center; padding: 64px; color: var(--text-dim); }
.empty-state p { font-size: 16px; margin-top: 12px; }

/* Responsive */
@media (max-width: 768px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
  .deals-grid { grid-template-columns: 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
  .filter-group select { width: 100%; }
  .header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; z-index: 200; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 18px; color: var(--text); font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.toast.hidden { display: none; }

/* Deal card scored-at */
.deal-scored-at { font-size: 10px; color: var(--text-dim); margin-top: 4px; }