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

body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: #f0f2f7; color: #1a1f2e; height: 100vh; overflow: hidden; }

.app { display: flex; height: 100vh; }

/* Sidebar */
.sidebar { width: 240px; min-width: 240px; background: #1a1f2e; color: #e2e8f0; display: flex; flex-direction: column; }
.sidebar-logo { display: flex; align-items: center; gap: 12px; padding: 20px 16px; border-bottom: 1px solid #2d3748; }
.logo-icon { font-size: 28px; }
.logo-title { font-size: 15px; font-weight: 700; color: #fff; }
.logo-sub { font-size: 11px; color: #718096; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-item { display: block; padding: 10px 20px; color: #a0aec0; text-decoration: none; font-size: 13px; border-radius: 0; transition: all 0.15s; border-left: 3px solid transparent; }
.nav-item:hover { background: #2d3748; color: #fff; }
.nav-item.active { background: #2d3748; color: #63b3ed; border-left-color: #63b3ed; }

.sidebar-stats { padding: 16px; border-top: 1px solid #2d3748; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-item { text-align: center; }
.stat-num { display: block; font-size: 22px; font-weight: 700; color: #63b3ed; }
.stat-label { font-size: 10px; color: #718096; text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-footer { padding: 16px; border-top: 1px solid #2d3748; }
.scan-btn { width: 100%; padding: 10px; background: #3182ce; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; transition: background 0.15s; }
.scan-btn:hover { background: #2b6cb0; }
.scan-info { font-size: 11px; color: #718096; margin-top: 8px; text-align: center; line-height: 1.4; }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar { padding: 16px 24px; background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.search-wrap { flex: 1; min-width: 200px; }
.search-input { width: 100%; padding: 10px 16px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.15s; }
.search-input:focus { border-color: #3182ce; }

.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-select { padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; background: #fff; cursor: pointer; outline: none; }
.filter-select:focus { border-color: #3182ce; }

.score-filter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4a5568; white-space: nowrap; }
.score-filter input[type=range] { width: 90px; accent-color: #3182ce; }

.results-bar { padding: 12px 24px; font-size: 13px; color: #718096; display: flex; align-items: center; gap: 16px; background: #f7fafc; border-bottom: 1px solid #e2e8f0; }
.clear-btn { padding: 4px 12px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; color: #4a5568; transition: all 0.15s; }
.clear-btn:hover { border-color: #3182ce; color: #3182ce; }

.cards-grid { flex: 1; overflow-y: auto; padding: 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; align-content: start; }

/* Cards */
.company-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); border: 1px solid #e2e8f0; transition: all 0.2s; cursor: default; }
.company-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateY(-2px); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-name { font-size: 15px; font-weight: 700; color: #1a1f2e; line-height: 1.3; }
.fit-badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.fit-high { background: #d1fae5; color: #065f46; }
.fit-mid { background: #fef3c7; color: #92400e; }
.fit-low { background: #fee2e2; color: #991b1b; }

.card-type { display: inline-block; padding: 2px 10px; background: #ebf4ff; color: #1a56db; border-radius: 12px; font-size: 11px; font-weight: 600; margin-bottom: 8px; }
.card-hq { font-size: 12px; color: #718096; margin-bottom: 10px; }

.card-desc { font-size: 13px; color: #4a5568; line-height: 1.5; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.card-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pill { padding: 3px 8px; border-radius: 8px; font-size: 11px; background: #f0f2f7; color: #4a5568; }

.card-footer { display: flex; justify-content: space-between; align-items: center; }
.card-geo { font-size: 11px; color: #718096; }
.view-btn { padding: 7px 16px; background: #1a1f2e; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; transition: background 0.15s; }
.view-btn:hover { background: #3182ce; }

/* Report panel */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100; display: none; }
.overlay.open { display: block; }

.report-panel { position: fixed; right: -520px; top: 0; height: 100vh; width: 500px; background: #fff; z-index: 101; box-shadow: -4px 0 20px rgba(0,0,0,0.15); transition: right 0.3s ease; display: flex; flex-direction: column; }
.report-panel.open { right: 0; }

.panel-header { padding: 20px 24px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; background: #1a1f2e; color: #fff; }
.panel-header h2 { font-size: 18px; }
.close-btn { background: none; border: none; color: #a0aec0; font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; }
.close-btn:hover { color: #fff; }

.panel-body { flex: 1; overflow-y: auto; padding: 24px; }

/* Panel content */
.panel-section { margin-bottom: 24px; }
.panel-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: #718096; margin-bottom: 10px; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px; }
.panel-kv { display: flex; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.panel-kv .key { color: #718096; min-width: 120px; flex-shrink: 0; }
.panel-kv .val { color: #1a1f2e; font-weight: 500; }
.panel-desc { font-size: 14px; color: #4a5568; line-height: 1.6; }
.panel-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.panel-pill { padding: 4px 10px; border-radius: 8px; font-size: 12px; background: #ebf4ff; color: #1a56db; }
.fit-reasoning-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 14px; }
.fit-score-big { font-size: 32px; font-weight: 800; }
.fit-label { font-size: 13px; color: #4a5568; margin-left: 8px; }
.fit-reasoning { font-size: 13px; color: #4a5568; line-height: 1.6; margin-top: 8px; }
.notes-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 14px; font-size: 13px; color: #4a5568; line-height: 1.6; }
.tag { display: inline-block; padding: 3px 10px; background: #f0f2f7; color: #4a5568; border-radius: 12px; font-size: 12px; }

.empty-state { text-align: center; padding: 60px 24px; color: #718096; }
.empty-state .emoji { font-size: 48px; margin-bottom: 16px; }
.loading { text-align: center; padding: 60px; color: #718096; font-size: 14px; }

@media (max-width: 900px) {
  .sidebar { width: 200px; min-width: 200px; }
  .cards-grid { grid-template-columns: 1fr; }
  .report-panel { width: 100vw; }
}
