:root {
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #d9d9de;
  --surface: #ffffff;
  --page: #f4f4f6;
  --accent: #2357d8;
  --valid: #1f8a4c;
  --invalid: #c43b2f;
  --unsure: #a66d00;
  --missing: #c9c9ce;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body { margin: 0; background: var(--page); }

main { padding: 16px; }

a { color: var(--accent); }

h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 8px 0 4px; }

.site-header {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.site-title { font-weight: 600; text-decoration: none; color: var(--text); margin-right: auto; }
.site-user { color: var(--muted); }

button, .button {
  font: inherit; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-block;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

kbd {
  font: 11px ui-monospace, monospace; padding: 0 4px; border: 1px solid var(--line);
  border-radius: 3px; color: var(--muted); background: var(--page);
}

.hint { color: var(--muted); }
.notice { padding: 8px 12px; background: #fff6d6; border-radius: 6px; display: inline-block; }

table.fields { border-collapse: collapse; background: var(--surface); }
table.fields th, table.fields td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.fields td.count { text-align: right; font-variant-numeric: tabular-nums; }

.counts { display: flex; flex-wrap: wrap; gap: 8px; }
.counts div { background: var(--surface); padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); }
.counts div.mine { border-color: var(--accent); }
.counts dt { color: var(--muted); font-size: 13px; }
.counts dd { margin: 0; font-size: 20px; font-variant-numeric: tabular-nums; }

.screen {
  display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 16px;
  align-items: start;
}
.screen > aside {
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); padding: 12px; border-radius: 8px; border: 1px solid var(--line);
}
.description .status { color: var(--muted); }
.markdown p { margin: 0 0 8px; }

fieldset.items { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.items[disabled] { opacity: 0.85; }
fieldset.item-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.item-fields[disabled] { opacity: 0.7; }

.item {
  background: var(--surface); border: 2px solid var(--line); border-radius: 8px;
  padding: 12px; margin-bottom: 12px; outline: none;
}
.item.active, .item:focus-within { border-color: var(--accent); }
.item img.photo { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto 8px; border-radius: 4px; }
.item.duplicate { opacity: 0.7; }

.missing {
  display: flex; align-items: center; justify-content: center;
  background: var(--missing); color: #4a4a4f; height: 240px; border-radius: 4px; margin-bottom: 8px;
}
.missing.small { height: 72px; width: 96px; font-size: 11px; text-align: center; margin: 0; }

.choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.choice {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer; user-select: none;
}
.choice:has(input:checked) { border-color: var(--accent); background: #e8eefc; }
.verdict-valid:has(input:checked) { border-color: var(--valid); background: #e3f4ea; }
.verdict-invalid:has(input:checked) { border-color: var(--invalid); background: #fbe7e5; }
.verdict-unsure:has(input:checked) { border-color: var(--unsure); background: #fbf0d9; }

.item .reasons { display: none; }
.item[data-verdict="invalid"] .reasons { display: flex; }
.item[data-verdict="invalid"] .findings { display: none; }

.shows, .reading { display: block; margin: 6px 0; }
input[type=text], select, textarea { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; }
input.note { width: 100%; margin-top: 6px; }
textarea { width: 100%; }

.errors { color: var(--invalid); margin: 6px 0; padding-left: 18px; }
.correction-note { background: #fff6d6; padding: 6px 8px; border-radius: 4px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 16px; }
.actions .correction { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.actions > textarea { flex-basis: 100%; }

.review-extra { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.review-extra form { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.strip { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.strip-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.strip-photos img { height: 72px; border-radius: 3px; }

.meta dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin: 8px 0; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.state { font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.badge { font-size: 12px; padding: 2px 6px; border-radius: 10px; background: #eef0f4; color: var(--text); }
.badge.signal { background: #fbe7e5; }
.entry { border-top: 1px solid var(--line); padding: 6px 0; font-size: 13px; }
.entry .who { color: var(--muted); margin: 0; }
.entry .comment { margin: 4px 0; font-style: italic; }
.entry ul { margin: 4px 0; padding-left: 16px; }

.description-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.description-page > section { background: var(--surface); padding: 12px; border-radius: 8px; border: 1px solid var(--line); }
.description-page .markdown { max-width: 70ch; }
.new-version { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.examples, .example-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.examples img { height: 120px; border-radius: 4px; }
.example-choice { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; border: 2px solid var(--line); border-radius: 6px; cursor: pointer; }
.example-choice:has(input:checked) { border-color: var(--accent); background: #e8eefc; }
.example-choice img { height: 96px; border-radius: 3px; }
.version { border-top: 1px solid var(--line); padding: 8px 0; }
.version .who { color: var(--muted); margin: 0 0 4px; font-size: 13px; }
.comment-form { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin-top: 6px; }

@media (max-width: 1100px) {
  .screen, .description-page { grid-template-columns: 1fr; }
  .screen > aside { position: static; max-height: none; }
}

.admin-section { margin-bottom: 28px; }
.admin-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.login-link p { margin: 4px 0; }
.link-field { width: min(720px, 100%); font-family: ui-monospace, monospace; }
table.fields td.url { max-width: 360px; overflow-wrap: anywhere; }
