:root {
  --text: #161616;
  --muted: #666;
  --line: #d9d9d6;
  --soft: #f6f6f3;
  --accent: #9d1c20;
  --warn: #7a5b00;
  --ok: #2f5d3a;
  --bg: #ffffff;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 920px;
  margin: 0 auto;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  font-size: 1.05rem;
}

.logout { margin: 0; }

.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:hover { color: var(--text); }

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 56px 24px 72px;
}

h1 {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 650;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.1rem;
  font-weight: 650;
  margin: 0 0 12px;
}

.lead {
  color: var(--muted);
  margin: 0 0 36px;
  max-width: 560px;
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
}

.alert {
  border-left: 3px solid var(--accent);
  background: #fbf4f4;
  color: #5f1114;
  padding: 10px 14px;
  margin: 0 0 24px;
  font-size: 0.925rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
}

input[type="password"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 12px;
  font: inherit;
  color: var(--text);
}

input[type="password"]:focus,
input[type="file"]:focus {
  outline: 2px solid #161616;
  outline-offset: -1px;
}

input[type="file"] { cursor: pointer; }

input[type="file"]::file-selector-button {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  padding: 8px 12px;
  margin-right: 12px;
  font: inherit;
  cursor: pointer;
}

.btn {
  display: inline-block;
  align-self: flex-start;
  border: 1px solid var(--text);
  background: var(--text);
  color: #fff;
  padding: 11px 20px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { background: #000; }

.btn-ghost {
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover { background: var(--soft); }

.auth { max-width: 380px; margin: 4vh auto 0; }

.auth .btn { margin-top: 6px; }

.upload { max-width: 620px; }

.upload .stack { margin-top: 8px; }

.filename {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.result-head {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.stats {
  display: flex;
  gap: 0;
  margin: 28px 0 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  flex: 1;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.stat:last-child { border-right: 0; }

.stat strong {
  display: block;
  font-size: 2rem;
  font-weight: 650;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat.critical strong { color: var(--accent); }
.stat.warning strong { color: var(--warn); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.actions .text-link { margin-left: 8px; }

.text-link {
  color: var(--muted);
  text-underline-offset: 3px;
}

.text-link:hover { color: var(--text); }

.result-head .hint { margin-top: 18px; }

.issues { margin-top: 40px; }

.issues + .issues {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.section-title {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}

.group { margin-bottom: 32px; }

.group h3 {
  font-size: 1rem;
  font-weight: 650;
  margin: 0 0 10px;
}

.group h3 .count {
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}

.issue {
  border-top: 1px solid var(--line);
}

.issue:last-child { border-bottom: 1px solid var(--line); }

.issue summary {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 2px;
  cursor: pointer;
  list-style: none;
}

.issue summary::-webkit-details-marker { display: none; }

.issue summary:hover { background: var(--soft); }

.sev {
  flex: 0 0 118px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.issue.critical .sev { color: var(--accent); }
.issue.warning .sev { color: var(--warn); }

.issue-title {
  flex: 1;
  font-weight: 500;
}

.para {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.issue-body {
  padding: 4px 2px 18px 132px;
  font-size: 0.925rem;
}

.issue-body p { margin: 0 0 10px; }

.issue-body blockquote {
  margin: 0 0 10px;
  padding: 8px 14px;
  border-left: 2px solid var(--line);
  color: #3d3d3d;
  font-style: italic;
}

.empty {
  margin-top: 40px;
  padding: 36px;
  border: 1px solid var(--line);
}

.empty p { color: var(--muted); margin: 0; }

.error-page .lead { margin-bottom: 28px; }

.bottom {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.cookie-note {
  max-width: 640px;
  margin: 8px 0 0;
  line-height: 1.5;
}

@media (max-width: 640px) {
  main { padding-top: 36px; }
  h1 { font-size: 1.6rem; }
  .stats { flex-direction: column; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .issue summary { flex-wrap: wrap; gap: 4px 12px; }
  .sev { flex-basis: 100%; }
  .para { margin-left: auto; }
  .issue-body { padding-left: 2px; }
}
