:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a1f36;
  --muted: #5c6370;
  --border: #dde3ee;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --pass: #15803d;
  --fail: #b91c1c;
  --warn: #b45309;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

h1 { margin: 0 0 4px; font-size: 1.75rem; }
h2 { margin: 0 0 12px; font-size: 1.25rem; }
h3 { margin: 24px 0 8px; font-size: 1rem; }

.subtitle, .hint { color: var(--muted); margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.hidden { display: none !important; }

.auth-bar {
  text-align: right;
  font-size: 0.9rem;
  color: var(--muted);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-link {
  background: none;
  color: var(--primary);
  padding: 0;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.attempts-label { color: var(--muted); font-size: 0.95rem; }

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge.pass { background: #dcfce7; color: var(--pass); }
.badge.fail { background: #fee2e2; color: var(--fail); }

.doc-meta { color: var(--muted); font-size: 0.9rem; }

.scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.score {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.score-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.score-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.recommendation {
  font-weight: 600;
  margin: 8px 0;
}

.headline { color: var(--muted); font-size: 0.95rem; }

.flagged-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.flagged-list li {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fffbeb;
}

.flagged-list .meta {
  font-size: 0.85rem;
  color: var(--warn);
  font-weight: 600;
  margin-bottom: 6px;
}

.flagged-list .snippet {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.flagged-list .fix {
  font-size: 0.85rem;
  color: var(--muted);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th,
.history-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 6px;
  text-align: left;
}

.error-card { border-color: #fecaca; background: #fef2f2; }

.footer {
  margin-top: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .scores { grid-template-columns: repeat(2, 1fr); }
  .header { flex-direction: column; }
}
