:root {
  --brand: #1cb600;
  --brand-dark: #169400;
  --brand-soft: #e6f8e2;
  --violet: #763cbc;
  --violet-soft: #f1e9fb;
  --yellow: #d98f00;
  --yellow-soft: #fdf3d6;
  --red: #e91e2f;
  --red-soft: #fde8ea;
  --gray: #89878a;
  --gray-soft: #f4f5f8;
  --ink: #222123;
  --muted: #89878a;
  --line: #dfdee0;
  --bg: #f4f5f8;
  --card: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__nav { display: flex; gap: 18px; width: 100%; max-width: 720px; font-size: 14px; }
.topbar__nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.topbar__nav a:hover { color: var(--ink); }
.topbar__brand { font-weight: 800; color: var(--ink); }
.topbar__user { margin: 0 0 0 auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__user span { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.topbar__user button {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 8px; padding: 4px 10px; font: inherit; font-weight: 600; cursor: pointer;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }

.h1 { font-size: 22px; margin: 8px 0 4px; letter-spacing: -0.01em; }
.h2 { font-size: 13px; margin: 24px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.lead { color: var(--muted); margin: 0 0 16px; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); text-decoration: none; font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 700; color: var(--ink); }
.field__hint { font-size: 12px; color: var(--muted); }
.field__error { font-size: 12px; color: var(--red); }
.field__control,
.form input,
.form select {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.field__control:focus, .form input:focus, .form select:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}
.field__file { padding: 10px; background: var(--gray-soft); }

.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--primary:disabled { opacity: 0.55; }
.btn--ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); margin-top: 16px; }

.filters { display: flex; gap: 8px; margin-bottom: 16px; }
.filters .field__control { flex: 1; }
.filters .btn { width: auto; padding: 12px 16px; }

.btn--ms { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--ink); }
.btn--ms:hover { background: #000; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--gray-soft); border-radius: 12px; }
.segmented[hidden] { display: none; }
.segmented__item {
  flex: 1; padding: 10px 8px; border: 0; border-radius: 9px; background: transparent;
  font: inherit; font-size: 15px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.segmented__item--on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.variants { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.variants[hidden] { display: none; }
.variants__legend { font-size: 12px; color: var(--muted); padding: 0; margin-bottom: 6px; font-weight: 700; }
.variants--tabbed .variants__legend { display: none; }
.variant {
  display: flex; align-items: center; gap: 12px; padding: 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.variant:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-soft); }
.form .variant input { width: 20px; height: 20px; flex: 0 0 20px; padding: 0; margin: 0 0 0 4px; accent-color: var(--brand); }
.variant__thumb {
  width: 64px; height: 64px; flex: 0 0 64px; border-radius: 10px; overflow: hidden;
  background: var(--gray-soft); display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); text-align: center; line-height: 1.2;
}
.variant__thumb img { width: 100%; height: 100%; object-fit: cover; }
.variant__body { display: grid; gap: 2px; min-width: 0; }
.variant__body strong { font-size: 15px; line-height: 1.3; }
.variant__body small { font-size: 12px; color: var(--muted); }

.reference { display: grid; gap: 8px; }
.reference[hidden] { display: none; }

.result-head { border-left: 6px solid var(--gray); }
.result-head--green { border-left-color: var(--brand); }
.result-head--yellow { border-left-color: var(--yellow); }
.result-head--red { border-left-color: var(--red); }
.result-head__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.result-head__title { font-weight: 800; }
.result-head__meta { color: var(--muted); font-size: 13px; }
.score { font-size: 28px; font-weight: 800; }

.verdict { margin-top: 12px; font-size: 18px; font-weight: 800; }
.verdict--green { color: var(--brand-dark); }
.verdict--yellow { color: var(--yellow); }
.verdict--red { color: var(--red); }
.summary { margin: 8px 0 0; color: #47464a; }

.counters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.counter { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.counter--green { background: var(--brand-soft); color: #0d5e00; }
.counter--yellow { background: var(--yellow-soft); color: #7a5000; }
.counter--red { background: var(--red-soft); color: #8e1119; }
.counter--unknown { background: var(--gray-soft); color: #47464a; }

.processing { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.spinner {
  width: 26px; height: 26px; flex: 0 0 26px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.criteria { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.criterion {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 6px solid var(--gray);
  border-radius: 14px;
  padding: 12px 14px;
}
.criterion--green { border-left-color: var(--brand); }
.criterion--yellow { border-left-color: var(--yellow); background: #fffdf7; }
.criterion--red { border-left-color: var(--red); background: #fff8f8; }
.criterion__head { display: flex; align-items: center; gap: 8px; }
.criterion__title { font-weight: 700; }
.criterion__text { margin: 8px 0 0; color: #47464a; font-size: 15px; }
.criterion__fix { margin: 6px 0 0; font-size: 14px; color: var(--ink); }
.criterion__evidence { font-size: 13px; color: var(--muted); }
.criterion__evidence summary { cursor: pointer; }
.criterion__foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--red);
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 1px 6px;
}
.pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--violet);
  background: var(--violet-soft);
  border-radius: 999px;
  padding: 3px 9px;
}

.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: 0 0 12px; background: var(--gray); }
.dot--green { background: var(--brand); }
.dot--yellow { background: var(--yellow); }
.dot--red { background: var(--red); }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 18px 0 12px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.tab--on { background: var(--ink); border-color: var(--ink); color: #fff; }

.checks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; }
.checks__item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.checks__item:last-child { border-bottom: 0; }
.checks__item input { width: 20px; height: 20px; margin: 1px 0 0; flex: 0 0 20px; accent-color: var(--brand); }
.checks__item label { font-size: 15px; line-height: 1.35; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list__item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.list__item a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-decoration: none; color: inherit; }
.list__main { flex: 1; font-weight: 700; font-size: 15px; }
.list__main small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.list__meta { color: var(--muted); font-size: 12px; text-align: right; }
.list__item--empty { padding: 14px; color: var(--muted); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery img { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.gallery--reference img { border: 2px solid var(--violet); }
.ref { margin: 0; }
.ref figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; }
.alert--error { background: var(--red-soft); color: #8e1119; }
.alert--success { background: var(--brand-soft); color: #0d5e00; }
.alert--info { background: var(--violet-soft); color: #4b2079; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; margin-top: 6px; word-break: break-word; }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 32px; }

@media (max-width: 440px) {
  .topbar { padding: 12px; }
  .topbar__nav { gap: 14px; font-size: 13px; }
  .topbar__user span { display: none; }
}
