/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: #f0f2f5; color: #1a2030; }

/* ── Layout ── */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 240px; min-width: 240px;
  background: #0a1628;
  color: #c8d8f0;
  display: flex; flex-direction: column;
  padding: 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #0077CC, #005594);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: white; letter-spacing: -0.5px;
  flex-shrink: 0;
}
.brand-name { display: block; font-weight: 700; font-size: 14px; color: white; }
.brand-sub { display: block; font-size: 11px; color: #7090b8; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: #8aadd4; text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #c8d8f0; }
.nav-item.active { background: rgba(0,119,204,0.2); color: white; }
.nav-icon { font-size: 15px; }

.sidebar-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex; flex-direction: column; gap: 8px;
}
.scan-info { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8aadd4; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.idle { background: #4ade80; }
.status-dot.running { background: #fbbf24; animation: pulse 1s infinite; }
.status-dot.error { background: #f87171; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.last-scan { font-size: 11px; color: #566a85; }
.scan-btn {
  background: #0077CC; color: white; border: none;
  border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.scan-btn:hover { background: #005594; }
.scan-btn:disabled { background: #3a4a5a; cursor: not-allowed; }

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

/* ── Top Bar ── */
.top-bar {
  padding: 16px 24px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.top-bar-left { display: flex; align-items: center; gap: 12px; }
.top-bar-left h1 { font-size: 18px; font-weight: 700; color: #0a1628; }
.results-count { font-size: 12px; color: #7090b8; background: #f0f4fa; padding: 3px 10px; border-radius: 20px; }
.top-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #f0f4fa; border: 1.5px solid #e2e8f0;
  border-radius: 8px; padding: 7px 12px;
}
.search-icon { font-size: 13px; }
.search-box input { border: none; background: none; outline: none; font-size: 13.5px; width: 180px; color: #1a2030; }
select {
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  padding: 7px 10px; font-size: 13px; background: #f0f4fa;
  color: #1a2030; cursor: pointer; outline: none;
}
select:focus { border-color: #0077CC; }

/* ── Stats Bar ── */
.stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}
.stat-card {
  padding: 14px 24px;
  border-right: 1px solid #e2e8f0;
  text-align: center;
}
.stat-card:last-child { border-right: none; }
.stat-value { font-size: 28px; font-weight: 800; color: #0a1628; }
.stat-label { font-size: 11px; color: #7090b8; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.stat-card.danger .stat-value { color: #dc2626; }
.stat-card.warning .stat-value { color: #d97706; }
.stat-card.info .stat-value { color: #0077CC; }

/* ── Grid ── */
.grid {
  flex: 1; overflow-y: auto;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  align-content: start;
}
.loading { grid-column: 1/-1; text-align: center; padding: 60px; color: #7090b8; }

/* ── Cards ── */
.card {
  background: white; border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; flex-direction: column; gap: 12px;
}
.card:hover { border-color: #0077CC; box-shadow: 0 4px 20px rgba(0,119,204,0.12); transform: translateY(-1px); }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-name-wrap { display: flex; flex-direction: column; gap: 4px; }
.card-name { font-size: 15px; font-weight: 700; color: #0a1628; }
.card-hq { font-size: 11.5px; color: #7090b8; }
.threat-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.5px;
}
.threat-critical { background: #fee2e2; color: #dc2626; }
.threat-high { background: #ffedd5; color: #c2410c; }
.threat-medium { background: #fef3c7; color: #92400e; }
.threat-low { background: #dcfce7; color: #166534; }

.card-tagline { font-size: 12.5px; color: #4a5568; line-height: 1.5; }

.overlap-row { display: flex; align-items: center; gap: 8px; }
.overlap-label { font-size: 11px; color: #7090b8; white-space: nowrap; }
.overlap-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.overlap-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #0077CC, #005594); }
.overlap-score { font-size: 12px; font-weight: 700; color: #0077CC; width: 24px; text-align: right; }

.card-modules { display: flex; flex-wrap: wrap; gap: 5px; }
.module-chip {
  font-size: 10.5px; padding: 3px 8px; border-radius: 5px;
  background: #f0f4fa; color: #4a6080; font-weight: 500;
}

.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-revenue { font-size: 12px; color: #4a5568; font-weight: 600; }
.card-updated { font-size: 11px; color: #a0aec0; }
.view-btn {
  font-size: 12px; color: #0077CC; font-weight: 600;
  padding: 5px 12px; border-radius: 6px; border: 1.5px solid #0077CC;
  background: transparent; cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.view-btn:hover { background: #0077CC; color: white; }

/* ── Alert indicator ── */
.alert-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; margin-left: 6px; vertical-align: middle;
}

/* ── Detail Panel ── */
.panel-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.35); z-index: 100;
}
.panel-overlay.open { display: block; }
.detail-panel {
  position: fixed; right: -700px; top: 0; bottom: 0;
  width: min(700px, 100vw);
  background: white; z-index: 101;
  transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 30px rgba(0,0,0,0.15);
}
.detail-panel.open { right: 0; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid #e2e8f0;
  background: #f8fafc; gap: 16px;
}
.panel-header-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.panel-company-logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, #0077CC, #005594);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: white; flex-shrink: 0;
}
.panel-header h2 { font-size: 18px; font-weight: 700; color: #0a1628; }
#panel-tagline { font-size: 12.5px; color: #7090b8; margin-top: 2px; }
.panel-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1.5px solid #e2e8f0; background: white;
  cursor: pointer; font-size: 16px; color: #7090b8;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.panel-close:hover { background: #f0f4fa; color: #0a1628; }

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

/* Panel sections */
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: #7090b8; margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1.5px solid #e2e8f0;
}
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta-item { display: flex; flex-direction: column; gap: 3px; }
.meta-label { font-size: 10.5px; color: #a0aec0; text-transform: uppercase; letter-spacing: 0.5px; }
.meta-value { font-size: 13.5px; font-weight: 600; color: #1a2030; }

.threat-row { display: flex; align-items: center; gap: 12px; }

.sw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sw-table th { text-align: left; padding: 8px 10px; background: #f0f4fa; color: #4a6080; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.sw-table td { padding: 8px 10px; border-bottom: 1px solid #f0f4fa; }
.sw-table tr:last-child td { border-bottom: none; }
.check { color: #22c55e; font-weight: 700; }
.cross { color: #ef4444; font-weight: 700; }
.partial { color: #f59e0b; font-weight: 700; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.strength-list, .weakness-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.strength-list li::before { content: '✓ '; color: #22c55e; font-weight: 700; }
.weakness-list li::before { content: '✗ '; color: #ef4444; font-weight: 700; }
.strength-list li, .weakness-list li { font-size: 13px; color: #2d3748; line-height: 1.5; }

.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-item { padding: 10px 14px; background: #f8fafc; border-radius: 8px; border-left: 3px solid #0077CC; }
.news-date { font-size: 10.5px; color: #a0aec0; margin-bottom: 4px; }
.news-headline { font-size: 13px; color: #1a2030; }
.news-headline a { color: #0077CC; text-decoration: none; }
.news-headline a:hover { text-decoration: underline; }

.clients-list { display: flex; flex-wrap: wrap; gap: 8px; }
.client-chip { padding: 4px 12px; background: #f0f4fa; border-radius: 20px; font-size: 12.5px; color: #4a6080; }

.pricing-box { background: #f8fafc; border-radius: 10px; padding: 14px 16px; }
.pricing-model { font-size: 13px; font-weight: 600; color: #0a1628; margin-bottom: 4px; }
.pricing-notes { font-size: 12.5px; color: #4a5568; }

.notes-box { background: #fffbeb; border: 1.5px solid #fde68a; border-radius: 10px; padding: 14px 16px; font-size: 13px; color: #78350f; line-height: 1.6; }

.alert-item { padding: 10px 14px; background: #fff1f1; border-radius: 8px; border-left: 3px solid #ef4444; }
.alert-type { font-size: 10.5px; font-weight: 700; color: #ef4444; text-transform: uppercase; margin-bottom: 3px; }
.alert-detail { font-size: 13px; color: #1a2030; }

.compare-box { background: #f0f6ff; border-radius: 10px; padding: 16px; }
.compare-title { font-size: 13px; font-weight: 700; color: #005594; margin-bottom: 10px; }
.compare-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #dbeafe; font-size: 12.5px; }
.compare-row:last-child { border-bottom: none; }
.compare-dim { color: #4a6080; }
.compare-rd { color: #005594; font-weight: 600; }
.compare-them { color: #c2410c; font-weight: 600; }

.website-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: #0077CC; font-size: 13px; text-decoration: none;
  padding: 6px 14px; border: 1.5px solid #0077CC; border-radius: 8px;
  font-weight: 600; transition: all 0.15s;
}
.website-link:hover { background: #0077CC; color: white; }

/* ── Empty state ── */
.empty { grid-column: 1/-1; text-align: center; padding: 80px 20px; color: #7090b8; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 16px; font-weight: 600; }
.empty-sub { font-size: 13px; margin-top: 6px; }
