/* ── SEO Clarity™ — Calmware Design System ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal: #0D9488;
  --teal-light: #CCFBF1;
  --teal-dark: #0F766E;
  --amber: #F59E0B;
  --amber-light: #FEF3C7;
  --green: #10B981;
  --red: #EF4444;
  --blue: #3B82F6;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-600: #4B5563;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

body { font-family: 'Inter', -apple-system, sans-serif; background: #F0FDFA; color: var(--gray-800); min-height: 100vh; }

/* ── Onboarding page ─────────────────────────────────────────────────────────── */
.onboarding-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F0FDFA 0%, #ECFDF5 100%);
  padding: 2rem;
}
.onboarding-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  max-width: 580px;
  width: 100%;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--teal-light);
}
.onboarding-logo { text-align: center; margin-bottom: 2rem; }
.onboarding-logo .logo-mark { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.onboarding-logo h1 { font-size: 1.75rem; font-weight: 800; color: var(--teal-dark); }
.onboarding-logo .tagline { color: var(--gray-400); font-size: 0.875rem; margin-top: 0.25rem; }

.key-section { margin-bottom: 1.5rem; }
.key-section label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }
.key-section .key-desc { font-size: 0.8rem; color: var(--gray-400); margin-bottom: 0.5rem; }
.key-section .key-desc a { color: var(--teal); text-decoration: none; }
.key-section .key-desc a:hover { text-decoration: underline; }
.key-input-row { display: flex; gap: 0.5rem; }
.key-input-row input {
  flex: 1;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  font-family: monospace;
  outline: none;
  transition: border 0.2s;
}
.key-input-row input:focus { border-color: var(--teal); }
.key-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; }
.badge-required { background: #FEE2E2; color: #991B1B; }
.badge-optional { background: var(--teal-light); color: var(--teal-dark); }
.badge-free { background: #D1FAE5; color: #065F46; }

.key-divider { border: none; border-top: 1px solid var(--gray-100); margin: 1.25rem 0; }

.btn-primary {
  width: 100%;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.15s;
  margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--teal-dark); transform: translateY(-1px); }

.skip-link { text-align: center; margin-top: 1rem; font-size: 0.8rem; color: var(--gray-400); }
.skip-link a { color: var(--teal); cursor: pointer; text-decoration: none; }

.tier-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; margin-bottom: 1.5rem; }
.tier-card { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 10px; padding: 0.875rem; text-align: center; }
.tier-card .tier-name { font-size: 0.75rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.05em; }
.tier-card .tier-price { font-size: 1.25rem; font-weight: 800; color: var(--teal-dark); margin: 0.25rem 0; }
.tier-card .tier-features { font-size: 0.7rem; color: var(--gray-400); line-height: 1.5; }

/* ── Main dashboard ──────────────────────────────────────────────────────────── */
.header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1300px; margin: 0 auto; padding: 0.875rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo-mark { font-size: 1.75rem; }
.logo-title { font-size: 1.1rem; font-weight: 800; color: var(--teal-dark); }
.logo-sub { font-size: 0.7rem; color: var(--gray-400); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.api-pill {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 999px; padding: 0.35rem 0.875rem;
  font-size: 0.75rem; color: var(--gray-600); cursor: pointer;
}
.api-pill:hover { background: var(--teal-light); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-300); }
.status-dot.ok { background: var(--green); }
.status-dot.warn { background: var(--amber); }

.search-bar { background: var(--teal); padding: 1.25rem 1.5rem; }
.search-inner {
  max-width: 1300px; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end;
}
.input-group { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; min-width: 140px; }
.input-group label { font-size: 0.68rem; font-weight: 700; color: rgba(255,255,255,0.75); text-transform: uppercase; letter-spacing: 0.07em; }
.input-group input, .input-group select {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px; padding: 0.55rem 0.75rem; color: white;
  font-size: 0.875rem; font-family: inherit; outline: none;
  transition: border 0.2s, background 0.2s;
}
.input-group input::placeholder { color: rgba(255,255,255,0.5); }
.input-group input:focus, .input-group select:focus { border-color: white; background: rgba(255,255,255,0.25); }
.input-group select option { background: var(--teal-dark); color: white; }
.btn-run {
  background: var(--amber); color: white; border: none; border-radius: 8px;
  padding: 0.6rem 1.5rem; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  white-space: nowrap; transition: background 0.15s, transform 0.15s; font-family: inherit;
}
.btn-run:hover { background: #D97706; transform: translateY(-1px); }
.btn-run:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.tabs-wrapper { background: white; border-bottom: 1px solid var(--gray-200); overflow-x: auto; }
.tabs { max-width: 1300px; margin: 0 auto; display: flex; padding: 0 1.5rem; }
.tab {
  background: none; border: none; border-bottom: 3px solid transparent;
  padding: 0.85rem 0.875rem; font-size: 0.78rem; font-weight: 600;
  color: var(--gray-400); cursor: pointer; white-space: nowrap;
  font-family: inherit; transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--teal); }
.tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab .tab-badge {
  display: inline-block; background: var(--amber-light); color: #92400E;
  font-size: 0.6rem; padding: 0.1rem 0.35rem; border-radius: 999px; margin-left: 0.3rem; font-weight: 700;
}

.panels { max-width: 1300px; margin: 0 auto; padding: 1.5rem; }
.panel { display: none; }
.panel.active { display: block; }
.panel-header { margin-bottom: 1.5rem; }
.panel-header h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.2rem; }
.panel-header p { color: var(--gray-400); font-size: 0.875rem; }

.metrics-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.metric-card {
  background: white; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.metric-card .metric-icon { font-size: 1.4rem; margin-bottom: 0.5rem; }
.metric-card .metric-label { font-size: 0.7rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }
.metric-card .metric-value { font-size: 1.6rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.metric-card .metric-sub { font-size: 0.72rem; color: var(--gray-400); margin-top: 0.25rem; }

.card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.card h3 { font-size: 0.85rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media(max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th { text-align: left; padding: 0.5rem 0.75rem; font-size: 0.68rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--gray-200); }
td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--gray-100); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-teal { background: var(--teal-light); color: var(--teal-dark); }
.badge-amber { background: var(--amber-light); color: #92400E; }

.info-box { background: var(--teal-light); border: 1px solid #99F6E4; border-radius: 10px; padding: 1rem 1.25rem; font-size: 0.82rem; color: var(--teal-dark); line-height: 1.6; margin-bottom: 1.5rem; }
.warn-box { background: var(--amber-light); border: 1px solid #FCD34D; border-radius: 10px; padding: 1rem 1.25rem; font-size: 0.82rem; color: #92400E; line-height: 1.6; }
.no-key-box { background: var(--gray-50); border: 1px dashed var(--gray-300); border-radius: 10px; padding: 2rem; text-align: center; color: var(--gray-400); }
.no-key-box h4 { font-size: 1rem; color: var(--gray-600); margin-bottom: 0.5rem; }
.no-key-box p { font-size: 0.82rem; }
.no-key-box .btn-small { display: inline-block; margin-top: 0.75rem; background: var(--teal); color: white; border: none; border-radius: 8px; padding: 0.5rem 1.25rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit; }

.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius); min-height: 110px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.audit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.audit-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); text-align: center; }
.audit-card .audit-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }
.audit-card .audit-value { font-size: 2rem; font-weight: 800; }
.audit-card .audit-label { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.25rem; }
.audit-card.ok .audit-value { color: var(--green); }
.audit-card.warn .audit-value { color: var(--amber); }
.audit-card.error .audit-value { color: var(--red); }

.speed-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.speed-score { text-align: center; flex: 1; min-width: 80px; }
.speed-score .score-num { font-size: 1.75rem; font-weight: 800; }
.speed-score .score-label { font-size: 0.7rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.05em; }
.score-good { color: var(--green); }
.score-mid { color: var(--amber); }
.score-bad { color: var(--red); }

.aeo-hero { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1.5rem; }
.aeo-score-card { background: white; border: 2px solid var(--teal); border-radius: var(--radius); padding: 2rem; text-align: center; min-width: 150px; box-shadow: var(--shadow-md); }
.aeo-score-num { font-size: 3.5rem; font-weight: 900; color: var(--teal); line-height: 1; }
.aeo-score-label { font-size: 0.72rem; color: var(--gray-400); font-weight: 600; margin-top: 0.5rem; text-transform: uppercase; }

.kw-input-area { margin-bottom: 1.5rem; }
.kw-input-area textarea, .aeo-textarea {
  width: 100%; border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 0.75rem; font-size: 0.875rem; font-family: inherit; resize: vertical;
  background: white; outline: none;
}
.kw-input-area textarea:focus, .aeo-textarea:focus { border-color: var(--teal); }
.btn-secondary {
  background: var(--teal-light); color: var(--teal-dark); border: 1px solid var(--teal);
  border-radius: 8px; padding: 0.5rem 1.25rem; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; font-family: inherit; margin-top: 0.5rem; transition: background 0.2s;
}
.btn-secondary:hover { background: var(--teal); color: white; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.4); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 999; }
.toast { background: var(--gray-900); color: white; padding: 0.75rem 1.25rem; border-radius: 8px; font-size: 0.82rem; box-shadow: var(--shadow-md); animation: slideIn 0.3s ease; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.footer { text-align: center; padding: 1.5rem; font-size: 0.72rem; color: var(--gray-400); border-top: 1px solid var(--gray-200); margin-top: 3rem; }
.footer a { color: var(--teal); text-decoration: none; }

.progress-bar-row { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0; font-size: 0.8rem; }
.progress-label { width: 100px; color: var(--gray-600); flex-shrink: 0; font-size: 0.75rem; }
.progress-track { flex: 1; background: var(--gray-100); border-radius: 999px; height: 7px; }
.progress-fill { height: 7px; border-radius: 999px; background: var(--teal); }
.progress-count { width: 50px; text-align: right; color: var(--gray-600); font-size: 0.75rem; }
