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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  line-height: 1.6;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
.site-header {
  background: #0f172a;
  color: #fff;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.site-header h1 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
.site-header .tagline { font-size: 0.8rem; color: #94a3b8; margin-left: auto; }

.container { max-width: 860px; margin: 2.5rem auto; padding: 0 1.5rem; }

/* ---- Card ---- */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  margin-bottom: 1.5rem;
}
.card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1.25rem; color: #0f172a; }

/* ---- Form ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
}
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.82rem; font-weight: 600; color: #475569; }
.field input {
  padding: 0.55rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #0f172a;
  background: #fff;
  transition: border-color .15s;
}
.field input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.field .hint { font-size: 0.75rem; color: #94a3b8; }
.required-mark { color: #ef4444; }

details.optional-section { margin-top: 1.25rem; }
details.optional-section summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2563eb;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
details.optional-section summary::before { content: '▶'; font-size: 0.7rem; transition: transform .2s; }
details[open].optional-section summary::before { transform: rotate(90deg); }
details.optional-section .form-grid { margin-top: 1rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-download { background: #0f172a; color: #fff; }
.btn-download:hover { background: #1e293b; }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---- Score badge ---- */
.score-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.score-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.score-circle .num { font-size: 1.6rem; line-height: 1; }
.score-circle .denom { font-size: 0.7rem; opacity: .7; }
.score-strong  { background: #dcfce7; color: #15803d; }
.score-medium  { background: #fef9c3; color: #854d0e; }
.score-weak    { background: #fee2e2; color: #991b1b; }
.score-info h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.25rem; }
.score-info .action {
  display: inline-block;
  padding: 0.25rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.action-build   { background: #dcfce7; color: #15803d; }
.action-research{ background: #fef9c3; color: #854d0e; }
.action-avoid   { background: #fee2e2; color: #991b1b; }

.score-breakdown { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.score-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.score-item .label { color: #64748b; }
.score-item .val   { font-weight: 700; color: #0f172a; }

/* ---- Rendered report ---- */
.report-body { font-size: 0.92rem; }
.report-body h1 { font-size: 1.4rem; margin: 1.5rem 0 0.5rem; color: #0f172a; }
.report-body h2 { font-size: 1.1rem; margin: 2rem 0 0.6rem; color: #0f172a; border-bottom: 2px solid #e2e8f0; padding-bottom: 0.3rem; }
.report-body h3 { font-size: 0.95rem; margin: 1.25rem 0 0.4rem; color: #1e293b; }
.report-body p  { margin-bottom: 0.75rem; }
.report-body ul, .report-body ol { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.report-body li { margin-bottom: 0.25rem; }
.report-body blockquote {
  border-left: 3px solid #2563eb;
  padding: 0.5rem 1rem;
  background: #eff6ff;
  border-radius: 0 6px 6px 0;
  margin: 0.75rem 0;
  color: #1e40af;
  font-size: 0.85rem;
}
.report-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.85rem; }
.report-body th {
  background: #f1f5f9;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
}
.report-body td { padding: 0.45rem 0.75rem; border: 1px solid #e2e8f0; }
.report-body tr:nth-child(even) td { background: #f8fafc; }
.report-body code { background: #f1f5f9; padding: 0.15em 0.4em; border-radius: 3px; font-size: 0.85em; }
.report-body input[type="checkbox"] { margin-right: 0.4rem; }

/* ---- Error ---- */
.error-box {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: #991b1b;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* ---- Settings link in header ---- */
.settings-link {
  margin-left: auto;
  color: #94a3b8;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}
.settings-link:hover { color: #fff; text-decoration: none; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.6;
}
.badge-connected { background: #dcfce7; color: #15803d; }
.badge-not-set   { background: #f1f5f9; color: #64748b; }

/* ---- Settings page ---- */
.settings-intro { font-size: 0.85rem; color: #64748b; margin-bottom: 1.25rem; }

.provider-section { padding: 1.25rem 0; }
.provider-header  { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.3rem; }
.provider-name    { font-size: 0.95rem; font-weight: 700; color: #0f172a; }
.provider-note    { font-size: 0.8rem; color: #94a3b8; margin-bottom: 0.9rem; }
.provider-note a  { color: #64748b; }
.provider-divider { border: none; border-top: 1px solid #e2e8f0; margin: 0.5rem 0; }

.btn-danger-soft {
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-soft:hover { background: #fecaca; }

/* ---- Success box ---- */
.success-box {
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: #15803d;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* ---- Live data hint ---- */
.live-hint { color: #15803d; }

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  color: #94a3b8;
  font-size: 0.78rem;
  padding: 2rem 1rem;
}
