:root {
  --bg: #f4f4f2; --card: #fff; --ink: #1d1d1b; --muted: #6b6b66; --line: #ddddd8;
  --accent: #8a1111; --ok: #1f7a3a; --warn: #a15c00;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, sans-serif; }
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }
main.narrow { max-width: 420px; }
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
header h1 { margin: 0; }
header nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
label { display: block; margin-bottom: 12px; font-size: .95rem; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 6px 0 0; }
input[type=range] { padding: 0; }
button { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
button.ghost { background: #fff; color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
a { color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.error { color: var(--accent); font-weight: 600; }
.muted { color: var(--muted); font-size: .9rem; }
.big { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: .85rem; border: 1px solid var(--line); color: var(--muted); }
.badge.on { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.badge.alert { border-color: var(--warn); color: var(--warn); font-weight: 600; }
.meter { position: relative; height: 28px; background: #eee; border-radius: 6px; overflow: hidden; }
.meter .fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #4a7a3a, #c9a227 60%, #8a1111); transition: transform 90ms linear; }
.meter .mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.meter .mark span { position: absolute; top: 2px; left: 4px; font-size: .75rem; white-space: nowrap; }
code { font-size: .9rem; word-break: break-all; }
.chats { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.feed { list-style: none; margin: 8px 0 0; padding: 0; font-size: .9rem; min-height: 8em; }
.feed li { padding: 2px 0; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed b { margin-right: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 16px; margin: 0; }
.stats dt { color: var(--muted); font-size: .85rem; }
.stats dd { margin: 0; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tabs a { text-decoration: none; color: var(--muted); padding: 4px 0; }
.tabs a[aria-current=page] { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--accent); }
.tabs form { margin-left: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; min-height: 4em; }
.ok { color: var(--ok); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.big-q { font-size: 1.2rem; margin: 8px 0; }
.choices { margin: 4px 0 8px; }
.ranking { margin: 8px 0 0; padding-left: 1.6em; font-size: .92rem; }
.ranking li { padding: 1px 0; }

/* Editorial pages: questions, import, media library */
main.wide { max-width: 1200px; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; }
.btn.ghost { background: #fff; color: var(--accent); }
button.small { padding: 2px 8px; font-size: .85rem; }
.row.between { justify-content: space-between; align-items: center; }
.nowrap { white-space: nowrap; }
.bulk { align-items: center; margin-bottom: 12px; }
.bulk select { width: auto; margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 8px 0 0; }
ul.error { padding-left: 1.2em; margin: 8px 0; }
ul.error:empty { display: none; }
.preview { margin: 0 0 12px; }
.preview img, .preview video { max-width: 100%; max-height: 260px; border-radius: 6px; background: #eee; }
.preview audio { width: 100%; }
.mediagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.mediagrid .card { margin: 0; }
.media .thumb { height: 140px; display: flex; align-items: center; justify-content: center; background: #eee; border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.media .thumb img, .media .thumb video { max-width: 100%; max-height: 100%; }
.media .thumb audio { width: 100%; }
.media .name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media p { margin: 4px 0; }
progress { width: 100%; }
