:root {
  --bg: #F6F4F3; --surface: #FFFFFF; --surface-2: #F1EEEC; --line: #E4DFDC; --line-strong: #CFC8C4;
  --text: #121212; --muted: #6E6763; --red: #E0162B; --red-hover: #C4101F; --red-soft: #FDE8EA;
  --ok: #1F8A4C; --ok-soft: #E3F4EA; --warn: #B7791F; --warn-soft: #FDF3E1;
  --ink: #121212; --on-red: #FFFFFF;
  --font: 'Onest', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0E0E0F; --surface: #17171A; --surface-2: #1F1F23; --line: #2A2A2F; --line-strong: #3A3A41;
  --text: #F4F2F1; --muted: #9A9499; --red: #F0283C; --red-hover: #FF4254; --red-soft: #3A1418;
  --ok: #4CC47F; --ok-soft: #13301F; --warn: #E5B25C; --warn-soft: #33270F;
  --ink: #F4F2F1;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }

.mark { width: 34px; height: 34px; flex: none; }
.mark .a { fill: var(--red); }
.mark .b { fill: none; stroke: var(--ink); stroke-width: 3.4; }

.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; text-decoration: none; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; }
.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav:hover { color: var(--text); background: var(--surface-2); }
.nav.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 3px 0 0 var(--red); }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.side-foot .who { font-size: 13px; color: var(--muted); }
.side-foot form { margin: 0; }
.row-btns { display: flex; gap: 6px; }

.content { padding: 36px 44px 60px; max-width: 1100px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
h2 { margin: 0 0 14px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat .num { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.stat .num.red { color: var(--red); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; font-size: 14px; }
.btn:hover { border-color: var(--text); }
.btn-red { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn-red:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger:hover { color: var(--red); border-color: var(--red); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.icon-btn { width: 34px; height: 34px; padding: 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 12px 10px; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
.title-cell a { font-weight: 700; text-decoration: none; }
.title-cell a:hover { color: var(--red); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ink { background: var(--ink); color: var(--bg); }

.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field label, .label { font-weight: 700; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
input[type=text], input[type=password], input[type=url], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface);
}
input:focus, select:focus, textarea:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px var(--red-soft); }
textarea { min-height: 320px; resize: vertical; font: 14px/1.6 'Cascadia Mono', Consolas, monospace; }
input[type=file] { font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 8px; }

.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.preview { border: 1px solid var(--line); border-radius: 10px; padding: 4px 18px; background: var(--surface-2); min-height: 320px; overflow: auto; }
.md img { max-width: 100%; border-radius: 10px; }
.md h2, .md h3, .md h4 { margin: 16px 0 8px; }
.md blockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid var(--red); color: var(--muted); }
.md code { background: var(--surface); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.md a { color: var(--red); }
.thumb { max-width: 280px; border-radius: 12px; border: 1px solid var(--line); display: block; margin-bottom: 8px; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; font-weight: 600; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.err { background: var(--red-soft); color: var(--red); }
.banner-preview { padding: 12px 16px; border-radius: 12px; font-weight: 600; }
.banner-preview.info { background: var(--surface-2); }
.banner-preview.warning { background: var(--warn-soft); color: var(--warn); }
.banner-preview.critical { background: var(--red); color: #fff; }

.release-line { display: flex; align-items: baseline; gap: 10px; }
.release-line .ver { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.empty { color: var(--muted); padding: 10px 0; margin: 0; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-plain li:first-child { border-top: 0; }
.list-plain a { font-weight: 600; text-decoration: none; }
.list-plain a:hover { color: var(--red); }

/* Вход */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px, 100%); }
.auth-card .brand { justify-content: center; padding-bottom: 26px; font-size: 22px; }
.auth-card .mark { width: 44px; height: 44px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0; border: 0; }
  .grid-3, .grid-2, .editor { grid-template-columns: 1fr; }
  .content { padding: 24px 18px; }
}

.upload-progress { margin: 6px 0 16px; }
.upload-label { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.upload-label span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }
