:root {
  --bg: #f4f6f8; --panel: #fff; --line: #e3e7eb; --text: #25303b; --muted: #7a8794;
  --side: #1d2733; --side-text: #b8c3ce; --accent: #1c5c99; --green: #6aaf35; --red: #c0392b; --amber: #d98e04;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
code { background: #eef1f4; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { border: 1px solid #cfd6dd; border-radius: 4px; padding: 6px 9px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(28, 92, 153, .25); border-color: var(--accent); }
textarea { resize: vertical; }

.shell { display: flex; min-height: 100vh; }
.side { width: 230px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 8px; padding: 16px 18px; color: #fff; }
.brand img { height: 30px; width: auto; background: #fff; border-radius: 4px; padding: 2px 6px; }
.brand span { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-text); }
.brand:hover { text-decoration: none; }
.side nav { display: flex; flex-direction: column; padding: 4px 10px; gap: 1px; }
.side nav a { color: var(--side-text); padding: 8px 10px; border-radius: 5px; display: flex; align-items: center; justify-content: space-between; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.side nav a.on { background: var(--accent); color: #fff; }
.side .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6c7a88; padding: 16px 10px 6px; }
.badge { background: var(--red); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.toSite { margin-top: auto; padding: 14px 20px; color: var(--side-text); font-size: 13px; border-top: 1px solid rgba(255, 255, 255, .07); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 14px 26px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 18px; }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me form { margin: 0; }
.burger { display: none; border: 0; background: none; font-size: 20px; cursor: pointer; }
.content { padding: 22px 26px 40px; display: flex; flex-direction: column; gap: 18px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cfd6dd; background: #fff; border-radius: 4px; padding: 6px 12px; cursor: pointer; white-space: nowrap; color: var(--text); }
.btn:hover { background: #f1f4f7; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #164b7e; }
.btn.danger { color: var(--red); border-color: #e6b8b2; }
.btn.danger:hover { background: #fcefed; }
.btn.small { padding: 3px 9px; font-size: 13px; }
button.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; }

.flash { margin: 16px 26px 0; padding: 10px 14px; border-radius: 5px; border: 1px solid; }
.content .flash, .login .flash { margin: 0; }
.flash-ok { background: #eef7e6; border-color: #cfe5bb; color: #2f5d12; }
.flash-err { background: #fcefed; border-color: #efc4be; color: #8e2a1f; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-width: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cols.wide-left { grid-template-columns: 2fr 1fr; align-items: start; }
.more { margin-left: auto; font-size: 13px; font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { margin-left: auto; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 18px; margin: 0; }
.err { color: var(--red); }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.crumbs { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; color: var(--text); display: flex; flex-direction: column; }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card b { font-size: 26px; font-weight: 600; }
.card span { color: var(--text); }
.card em { font-style: normal; color: var(--muted); font-size: 12px; margin-top: 2px; }
.card.warn { border-color: #f0c36d; background: #fffaf0; }

.line { display: flex; align-items: baseline; gap: 6px; padding: 7px 0; border-bottom: 1px solid #f0f2f4; min-width: 0; flex-wrap: wrap; }
.line:last-child { border-bottom: 0; }
.line.sub { padding-left: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); border-radius: 14px; padding: 3px 10px; font-size: 13px; }
.chip-staff { border-color: var(--accent); }

.tag { display: inline-block; font-size: 11px; line-height: 1.5; padding: 0 7px; border-radius: 3px; background: #eef1f4; color: #53606c; white-space: nowrap; }
.tag.danger { background: #fcefed; color: var(--red); }
.tag.ok { background: #eef7e6; color: #3d7417; }
.tag.warn { background: #fff4dc; color: #8a5a00; }
a.tag:hover { text-decoration: none; filter: brightness(.96); }
.role { font-size: 11px; padding: 1px 7px; border-radius: 3px; background: #eef1f4; white-space: nowrap; }
.role-admin { background: #1c5c99; color: #fff; }
.role-moder { background: #e3eefa; color: #1c5c99; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search] { flex: 1 1 240px; max-width: 360px; }
.panel .filters { margin-bottom: 12px; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.stack label > * { color: var(--text); }

.scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.panel .scroll { border: 0; border-radius: 0; }
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
.grid td { padding: 9px 12px; border-bottom: 1px solid #f0f2f4; vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr:hover td { background: #fafcff; }
.grid .num { text-align: right; }
.grid .wrap { max-width: 520px; overflow-wrap: anywhere; }
.grid tr.dim td { background: #fbfbfb; color: #8a949e; }
.grid tr.current td { background: #f3f9ee; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.acts form { margin: 0; }
.grid td.acts { display: table-cell; white-space: nowrap; }
.grid td.acts > * { display: inline-block; vertical-align: top; margin: 0 4px 4px 0; }
.post-cell { display: flex; gap: 10px; min-width: 320px; max-width: 620px; }
.post-cell > div { min-width: 0; overflow-wrap: anywhere; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; flex: none; background: #eef1f4; }

details.pop { position: relative; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop[open] > form { position: absolute; right: 0; top: 30px; z-index: 3; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); padding: 10px; width: 260px; }
details.box { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
details.box > summary { cursor: pointer; font-weight: 500; }
details.box[open] > summary { margin-bottom: 10px; }

.bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fffaf0; border: 1px solid #f0c36d; border-radius: 6px; padding: 8px 12px; position: sticky; top: 62px; z-index: 4; }
.bulk[hidden] { display: none; }

.pager { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager a, .pager b { min-width: 32px; text-align: center; padding: 4px 8px; border-radius: 4px; border: 1px solid var(--line); background: #fff; }
.pager b { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager .muted { margin-left: 8px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tabs a { padding: 6px 12px; border-radius: 5px; color: var(--text); }
.tabs a.on { background: var(--accent); color: #fff; }
.tabs a:hover { text-decoration: none; background: #e8edf2; }
.tabs a.on:hover { background: var(--accent); }
.tabs .sep { width: 1px; height: 20px; background: var(--line); margin: 0 8px; }

.list { display: flex; flex-direction: column; gap: 12px; }
.complaint header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.complaint blockquote { margin: 10px 0 6px; padding: 8px 12px; background: #f7f9fa; border-left: 3px solid var(--line); overflow-wrap: anywhere; }
.complaint .note { margin: 6px 0; color: #5b6772; font-style: italic; }
.complaint footer { margin-top: 10px; }
.complaint.dim { opacity: .7; }
.plag header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plag .note { margin: 8px 0; color: #5b6772; }
.plag footer { margin-top: 10px; }
.plag footer input[name=reason] { min-width: 280px; }
.plag.dim { opacity: .7; }
.plag-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plag-pair > div { min-width: 0; }
.plag-pair blockquote { margin: 6px 0; padding: 8px 12px; background: #f7f9fa; border-left: 3px solid var(--line); overflow-wrap: anywhere; }
.plag-pair video { width: 100%; max-height: 260px; background: #000; border-radius: 6px; }
.plag-pair a { overflow-wrap: anywhere; }
@media (max-width: 800px) { .plag-pair { grid-template-columns: 1fr; } }

.profile { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; align-items: start; }
.who-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.who-head h2 { font-size: 20px; margin-bottom: 6px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 0 0 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stats > * { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; color: var(--muted); font-size: 12px; display: flex; flex-direction: column; }
.stats b { font-size: 18px; color: var(--text); font-weight: 600; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions h2 { margin-bottom: 2px; }
.actions > form { margin: 0; }
.section { margin-bottom: 10px; }
.section-edit { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }

body.bare { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, #1d2733, #2b3b4d); }
.login { width: 380px; max-width: calc(100vw - 32px); background: #fff; border-radius: 10px; padding: 28px 30px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 14px; }
.login-logo { height: 44px; width: auto; align-self: center; }
.login h1 { font-size: 18px; text-align: center; }
.login p { margin: 0; }
.login .btn { justify-content: center; padding: 9px 12px; }
.qr { align-self: center; border: 1px solid var(--line); border-radius: 6px; image-rendering: pixelated; }
.secret { word-break: break-all; }

@media (max-width: 1100px) {
  .cols, .cols.wide-left, .profile { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .side { position: fixed; left: -240px; z-index: 20; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .burger { display: block; }
  .top { padding: 12px 14px; }
  .content { padding: 14px; }
  .flash { margin: 12px 14px 0; }
  .me a, .me .role { display: none; }
  .facts { grid-template-columns: 1fr; }
}
