/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --blue: #1755e7;
  --blue-dark: #1244c4;
  --dark: #0b1228;
  --dark2: #131b35;
  --sidebar: #0f172a;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --gray: #64748b;
  --gray-light: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; color: var(--text); background: #f8fafc; font-size: 14px; line-height: 1.6; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar); flex-shrink: 0; display: flex; flex-direction: column; }
.main-content { flex: 1; overflow-x: hidden; }
.page-header { background: #fff; border-bottom: 1px solid var(--border); padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; }
.page-header h1 { font-size: 20px; font-weight: 700; color: var(--dark); }
.page-body { padding: 28px 32px; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar-logo { padding: 20px 20px 8px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.sidebar-logo .logo-text { font-size: 15px; font-weight: 700; color: #fff; }
.sidebar-logo .logo-text span { color: var(--green); }
.sidebar-nav { padding: 12px 8px; flex: 1; }
.nav-label { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: .08em; padding: 12px 12px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: rgba(255,255,255,0.65); font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s; cursor: pointer; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(23,85,231,0.3); color: #fff; }
.nav-item svg { opacity: .7; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 12px 8px 16px; border-top: 1px solid rgba(255,255,255,0.07); }
.credit-badge { background: rgba(255,255,255,0.06); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.credit-badge .credit-label { font-size: 11px; color: rgba(255,255,255,0.45); }
.credit-badge .credit-value { font-size: 20px; font-weight: 700; color: #fff; }
.credit-badge .credit-plan { font-size: 11px; color: var(--green); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ─── Stats grid ─────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .stat-label { font-size: 12px; color: var(--gray); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--dark); }
.stat-card .stat-sub { font-size: 12px; color: var(--gray); margin-top: 4px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 13.5px; font-weight: 600; cursor: pointer; border: none; transition: background .15s, opacity .15s; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover { background: rgba(23,85,231,0.06); text-decoration: none; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--gray); }
.btn-ghost:hover { background: var(--gray-light); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-control { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 14px; color: var(--text); background: #fff; transition: border-color .15s; outline: none; }
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,85,231,0.1); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-hint { font-size: 12px; color: var(--gray); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; background: #fafafa; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafcff; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 13.5px; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 8px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ─── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; gap: 0; }
.tab-item { padding: 10px 18px; font-size: 13.5px; font-weight: 600; color: var(--gray); border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: color .15s; white-space: nowrap; }
.tab-item:hover { color: var(--blue); text-decoration: none; }
.tab-item.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ─── Problem list ───────────────────────────────────────────────────────── */
.problem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.problem-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.problem-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.problem-icon.high { background: #fee2e2; }
.problem-icon.medium { background: #fef3c7; }
.problem-icon.low { background: #f1f5f9; }
.problem-label { font-size: 13px; font-weight: 600; }
.problem-tip { font-size: 12px; color: var(--gray); margin-top: 2px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 6px; background: #fff; border: 1px solid var(--border); margin-bottom: 8px; }
.check-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.check-icon.pass { background: #d1fae5; color: #065f46; }
.check-icon.fail { background: #fee2e2; color: #991b1b; }

/* ─── Auth pages ─────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--dark); }
.auth-box { background: #fff; border-radius: 12px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-text { font-size: 22px; font-weight: 800; color: var(--dark); }
.auth-logo .logo-text span { color: var(--green); }
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { color: var(--gray); margin-bottom: 24px; font-size: 14px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--gray); }

/* ─── Top bar ────────────────────────────────────────────────────────────── */
.topbar { background: #fff; border-bottom: 1px solid var(--border); height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px 0 32px; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--dark); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.credit-pill { display: flex; align-items: center; gap: 6px; background: var(--gray-light); padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--dark); }
.credit-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* ─── Business detail ────────────────────────────────────────────────────── */
.biz-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.biz-icon { width: 56px; height: 56px; border-radius: 12px; background: var(--blue); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.biz-title { font-size: 22px; font-weight: 700; }
.biz-meta { font-size: 13px; color: var(--gray); display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.biz-meta a { color: var(--blue); }
.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.detail-row:last-child { border-bottom: none; }
.detail-key { width: 160px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.detail-val { flex: 1; font-size: 14px; }

/* ─── LLM Score ──────────────────────────────────────────────────────────── */
.score-ring { position: relative; width: 100px; height: 100px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .score-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; }

/* ─── Outreach ───────────────────────────────────────────────────────────── */
.email-preview { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 20px; font-family: Georgia, serif; font-size: 14.5px; line-height: 1.8; white-space: pre-wrap; }
.email-subject { font-size: 13px; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-gray { color: var(--gray); } .text-green { color: var(--green); } .text-red { color: var(--red); } .text-blue { color: var(--blue); }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.w-full { width: 100%; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
