:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2035;
  --bg-card-hover: #1f2847;
  --bg-input: #151c2e;
  --border: #2a3454;
  --border-focus: #6366f1;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; line-height: 1.6; }

.header { position: sticky; top: 0; z-index: 100; background: rgba(10,14,26,0.85); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); padding: 0 2rem; }
.header-inner { max-width: 1400px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 72px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 42px; height: 42px; background: linear-gradient(135deg, var(--accent), #a855f7); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: white; }
.logo-icon svg { width: 22px; height: 22px; }
.logo-text h1 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.logo-text span { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.header-actions { display: flex; gap: 10px; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); font-family: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none; transition: all var(--transition); white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #7c3aed); color: white; box-shadow: 0 2px 12px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--accent); }
.btn-outline { background: transparent; color: var(--accent); border: 1px dashed var(--border); }
.btn-outline:hover { border-color: var(--accent); background: var(--accent-glow); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.stats-bar { max-width: 1400px; margin: 1.5rem auto; padding: 0 2rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; text-align: center; transition: all var(--transition); }
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.main-content { max-width: 1400px; margin: 0 auto; padding: 0 2rem 3rem; }

.add-product-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 2rem; overflow: hidden; }
.section-header { padding: 1.25rem 1.5rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background var(--transition); }
.section-header:hover { background: var(--bg-card-hover); }
.section-header h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; }
.chevron { transition: transform 0.3s; }
.add-product-section.open .chevron { transform: rotate(180deg); }
.add-product-form { padding: 0 1.5rem 1.5rem; max-height: 0; overflow: hidden; transition: max-height 0.4s ease, padding 0.3s; }
.add-product-section.open .add-product-form { max-height: 2000px; padding: 1rem 1.5rem 1.5rem; }

.form-row { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 16px; margin-bottom: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
input[type="text"], input[type="number"], input[type="url"], select { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text-primary); font-family: inherit; font-size: 0.9rem; transition: all var(--transition); outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
input::placeholder { color: var(--text-muted); }

.competitors-section { margin-bottom: 1.25rem; }
.competitors-section h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }
.competitor-row { display: grid; grid-template-columns: 1fr 2fr 2fr 40px; gap: 12px; margin-bottom: 10px; align-items: end; }
.competitor-row .btn-remove { width: 36px; height: 36px; border-radius: 50%; background: rgba(239,68,68,0.12); border: none; color: var(--danger); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition); margin-bottom: 2px; }
.competitor-row .btn-remove:hover { background: var(--danger); color: white; }
.competitor-row-simple { display: flex; gap: 12px; margin-bottom: 10px; align-items: end; }
.competitor-row-simple .btn-remove { width: 36px; height: 36px; border-radius: 50%; background: rgba(239,68,68,0.12); border: none; color: var(--danger); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition); margin-bottom: 2px; flex-shrink: 0; }
.competitor-row-simple .btn-remove:hover { background: var(--danger); color: white; }
.form-actions { display: flex; justify-content: flex-end; }

.section-header-inline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 12px; }
.section-header-inline h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 700; }
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; min-width: 300px; transition: all var(--transition); }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.search-bar input { background: none; border: none; color: var(--text-primary); font-size: 0.9rem; width: 100%; outline: none; }

.products-grid { display: flex; flex-direction: column; gap: 16px; }
.product-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all var(--transition); }
.product-card:hover { border-color: rgba(99,102,241,0.4); box-shadow: 0 4px 30px rgba(99,102,241,0.08); }
.product-card-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.product-info { display: flex; align-items: center; gap: 16px; }
.product-sku { background: var(--accent-glow); color: var(--accent); padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; }
.product-name { font-size: 1.05rem; font-weight: 600; }
.product-actions { display: flex; gap: 8px; }
.product-card-body { padding: 1.25rem 1.5rem; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 1rem; }
.price-item { background: var(--bg-input); border-radius: var(--radius-sm); padding: 12px 16px; border: 1px solid transparent; }
.price-item.own { border-color: var(--accent); }
.price-item.cheapest { border-color: var(--success); }
.price-item.expensive { border-color: var(--danger); }
.price-item-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.price-item-value { font-size: 1.2rem; font-weight: 700; }
.price-item-value.green { color: var(--success); }
.price-item-value.red { color: var(--danger); }
.price-item-value.accent { color: var(--accent); }
.adjusted-price-row { display: flex; align-items: center; gap: 12px; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.adjusted-price-row label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.adjusted-price-row input { max-width: 160px; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.95rem; font-weight: 600; }
.adjusted-price-row .btn { flex-shrink: 0; }
.product-card-footer { padding: 0.75rem 1.5rem; background: rgba(0,0,0,0.15); font-size: 0.75rem; color: var(--text-muted); display: flex; justify-content: space-between; }

.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state svg { margin-bottom: 1rem; opacity: 0.3; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 20px; box-shadow: 0 4px 24px rgba(0,0,0,0.3); display: flex; align-items: center; gap: 10px; min-width: 300px; animation: slideIn 0.3s ease; font-size: 0.9rem; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

.loading-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(10,14,26,0.85); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; }
.loading-overlay.active { display: flex; }
.loading-content { text-align: center; }
.spinner { width: 48px; height: 48px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-content p { color: var(--text-secondary); font-size: 0.95rem; }

.modal-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(10,14,26,0.85); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 90%; max-width: 700px; max-height: 85vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0,0,0,0.5); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.15rem; font-weight: 700; }
.btn-close { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.btn-close:hover { background: rgba(239,68,68,0.12); color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 1.5rem; }
.modal-body .form-group { margin-bottom: 1rem; }
.modal-body .form-actions { margin-top: 1.5rem; display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 1rem 0; gap: 12px; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .competitor-row { grid-template-columns: 1fr; }
  .search-bar { min-width: 100%; }
  .section-header-inline { flex-direction: column; align-items: flex-start; }
}
