/* ===========================
   DASHBOARD LAYOUT
   =========================== */

.dash-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
}

.dash-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.nav-logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--fg);
  text-decoration: none;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.dash-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 56px);
}

/* SIDEBAR */
.dash-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.section-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stat-row {
  display: flex;
  gap: 8px;
}

.stat-chip {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
}

.stat-number.accent { color: var(--accent); }

.stat-label {
  font-size: 10px;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
}

.btn-action {
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  transition: opacity 0.2s;
}

.btn-action:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-action.primary {
  background: var(--accent);
  color: #000;
}

.btn-action.primary:hover:not(:disabled) { opacity: 0.88; }

.btn-action.secondary {
  background: var(--bg-card);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-action.secondary:hover:not(:disabled) { border-color: rgba(0,229,160,0.3); color: var(--fg); }

/* ACTIVITY FEED */
.activity-feed {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
}

.activity-entry {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: fadeIn 0.3s ease;
}

.activity-entry.muted { color: var(--fg-muted); }
.activity-entry.success { color: var(--accent); }
.activity-entry.alert { color: var(--tag-alert); }
.activity-entry.error { color: #ef4444; }

.act-time { color: var(--fg-muted); flex-shrink: 0; }
.act-tag {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: 0.1em;
}

.act-tag.scanning { background: var(--accent-dim); color: var(--accent); }
.act-tag.analysis { background: rgba(59,130,246,0.12); color: var(--tag-analysis); }
.act-tag.opportunity { background: rgba(168,85,247,0.12); color: var(--tag-opportunity); }
.act-tag.alert { background: rgba(245,158,11,0.12); color: var(--tag-alert); }
.act-tag.error { background: rgba(239,68,68,0.12); color: #ef4444; }

/* MAIN */
.dash-main {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 900px;
}

.dash-header { margin-bottom: 4px; }

.dash-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.1;
}

.dash-subtitle {
  font-size: 14px;
  color: var(--fg-muted);
  margin-top: 6px;
}

/* TABLE CARD */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-hint { font-size: 12px; color: var(--fg-muted); }

.empty-state {
  padding: 32px 20px;
  color: var(--fg-muted);
  font-size: 13px;
  text-align: center;
}

/* BUSINESSES TABLE */
.biz-table {
  width: 100%;
  border-collapse: collapse;
}

.biz-table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.biz-table td {
  padding: 14px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.biz-table tr:last-child td { border-bottom: none; }

.biz-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.biz-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 28px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'SF Mono', monospace;
}

.score-pill.excellent { background: rgba(0,229,160,0.15); color: var(--accent); }
.score-pill.good { background: rgba(59,130,246,0.12); color: var(--tag-analysis); }
.score-pill.fair { background: rgba(245,158,11,0.12); color: var(--tag-alert); }
.score-pill.poor { background: rgba(239,68,68,0.12); color: #ef4444; }
.score-pill.none { background: var(--bg-card); color: var(--fg-muted); }

.industry-tag {
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 4px;
}

.check-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
}

.check-btn:hover { border-color: var(--accent); color: var(--accent); }

/* CHECKS TABLE */
.checks-list {
  display: flex;
  flex-direction: column;
}

.check-row {
  display: grid;
  grid-template-columns: 180px 64px 100px 80px 1fr;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 13px;
}

.check-row:last-child { border-bottom: none; }

.check-row-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  background: var(--bg-card);
}

.check-biz { font-weight: 500; }
.check-time { font-size: 11px; color: var(--fg-muted); }

.alert-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0,229,160,0.12);
  color: var(--accent);
  letter-spacing: 0.08em;
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.modal-eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-biz-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:hover { border-color: var(--fg-muted); color: var(--fg); }

.modal-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-score {
  font-family: var(--font-display);
  font-size: 64px;
  color: var(--accent);
  line-height: 1;
}

.modal-score-label {
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.1em;
  margin-top: 4px;
}

.modal-narrative {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 8px;
  border-left: 2px solid var(--accent);
}

.modal-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.metric-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.metric-item-label {
  font-size: 10px;
  color: var(--fg-muted);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.metric-item-value {
  font-size: 18px;
  font-weight: 600;
}

.modal-alert {
  background: rgba(0,229,160,0.08);
  border: 1px solid rgba(0,229,160,0.2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-alert.hidden { display: none; }

.threshold-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,229,160,0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  letter-spacing: 0.1em;
}

.watch-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245,158,11,0.12);
  color: var(--tag-alert);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  letter-spacing: 0.1em;
}

/* SPINNER */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.hidden { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* RESPONSIVE */
@media (max-width: 768px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar { position: static; height: auto; }
  .dash-main { padding: 20px; }
  .check-row { grid-template-columns: 1fr auto; }
  .check-row > :nth-child(3),
  .check-row > :nth-child(4),
  .check-row > :nth-child(5) { display: none; }
}
