/* ── Автопостер: тема в стиле WikiBot (фирменные цвета Remmers) ─────────
   Светлая тема — осознанно, как у WikiBot: кремовый фон, панели,
   корпоративный синий #041c8d и красный #eb0a14. */

:root {
  --bg:        #faf9f5;
  --panel:     #f0eee6;
  --panel-2:   #e8e6dc;
  --line:      #e3e1d8;
  --ink:       #1f1e1d;
  --muted:     #6b6a64;
  --accent:    #041c8d;   /* синий Remmers */
  --accent-2:  #03156a;   /* тёмный синий: hover */
  --red:       #eb0a14;   /* красный Remmers */
  --accent-soft: #d0ebfc;
  --card:      #ffffff;

  --ok-ink:   #1a6b3c; --ok-soft:   #ddefe3;
  --bad-ink:  #a8261e; --bad-soft:  #f9e3e1;
  --warn-ink: #8a5a06; --warn-soft: #f6ecd4;
  --info-ink: #041c8d; --info-soft: #dfe5f7;
  --gray-ink: #6b6a64; --gray-soft: #ecebe4;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }
code {
  background: var(--panel-2); padding: 1px 6px; border-radius: 5px;
  font-size: .88em; font-family: ui-monospace, Consolas, monospace;
}
h1 { font-size: 1.45rem; margin: 0 0 18px; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 26px 0 10px; }

/* ── Каркас: сайдбар + контент ─────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 236px; flex: 0 0 236px;
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 12px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px; color: var(--ink); font-weight: 600; font-size: 1.02rem;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-icon { width: 22px; height: 22px; flex: none; }
.brand span small {
  display: block; font-size: .68rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--red); line-height: 1.1;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.navlink {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); border-radius: 8px; padding: 8px 10px; font-size: .92rem;
}
.navlink svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.navlink:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.navlink.active { background: var(--panel-2); color: var(--ink); font-weight: 500; }
.navlink.active svg { fill: var(--accent); }
.navlink.accent { color: var(--accent); font-weight: 500; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }

.content { flex: 1 1 auto; min-width: 0; padding: 26px 32px 80px; max-width: 1200px; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; padding: 8px 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .brand { padding-bottom: 8px; }
  .sidebar-foot { margin: 0; border: none; padding: 0; position: absolute; top: 10px; right: 12px; }
  .content { padding: 18px 14px 60px; }
}

/* ── Сообщения ─────────────────────────────────────────────────────────── */
.flash { padding: 10px 16px; border-radius: 10px; margin: 0 0 16px; border: 1px solid transparent; }
.flash.ok  { background: var(--ok-soft);  color: var(--ok-ink);  border-color: #c6e2d0; }
.flash.bad { background: var(--bad-soft); color: var(--bad-ink); border-color: #eccfcc; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.error-text { color: var(--bad-ink); font-size: .85rem; white-space: pre-wrap; }
.empty { color: var(--muted); padding: 48px 0; text-align: center; }

/* ── Бейджи и чипы ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 1px 10px; border-radius: 100px;
  font-size: .77rem; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.badge.green  { background: var(--ok-soft);   color: var(--ok-ink); }
.badge.red    { background: var(--bad-soft);  color: var(--bad-ink); }
.badge.orange { background: var(--warn-soft); color: var(--warn-ink); }
.badge.blue   { background: var(--info-soft); color: var(--info-ink); }
.badge.gray   { background: var(--gray-soft); color: var(--gray-ink); }
.tag.ad {
  font-size: .7rem; color: var(--red); border: 1px solid var(--red);
  border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: middle;
}
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  display: inline-block; min-width: 36px; text-align: center; padding: 1px 8px;
  border-radius: 7px; font-size: .75rem; font-weight: 700;
}
.chip.green { background: var(--ok-soft);   color: var(--ok-ink); }
.chip.red   { background: var(--bad-soft);  color: var(--bad-ink); }
.chip.blue  { background: var(--info-soft); color: var(--info-ink); }
.chip.gray  { background: var(--gray-soft); color: var(--gray-ink); }
a.chip:hover { text-decoration: none; outline: 1px solid currentColor; }

/* ── Таблицы ───────────────────────────────────────────────────────────── */
table.list, table.kv {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden;
}
table.list th, table.kv th {
  text-align: left; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); background: var(--panel);
}
table.list th, table.list td, table.kv th, table.kv td {
  padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top;
}
table.list tr:last-child td, table.kv tr:last-child td { border-bottom: none; }
td.dt { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Формы ─────────────────────────────────────────────────────────────── */
form label { display: block; margin: 12px 0; font-size: .92rem; }
form label > .hint { display: block; margin-top: 3px; }
input[type=text], input[type=url], input[type=password], input:not([type]),
input[type=datetime-local], textarea, select {
  width: 100%; padding: 9px 12px; margin-top: 4px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--ink); font: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}
textarea { resize: vertical; }
fieldset {
  border: 1px solid var(--line); border-radius: 12px; margin: 16px 0;
  padding: 8px 16px 14px; background: var(--card);
}
legend { font-weight: 600; padding: 0 6px; font-size: .95rem; }
label.check { display: inline-flex; align-items: center; gap: 7px; margin: 6px 16px 6px 0; }
label.check input { width: auto; margin: 0; accent-color: var(--accent); }
.targets-row { display: flex; flex-wrap: wrap; }

/* ── Кнопки ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; font-size: .92rem;
  transition: border-color .12s, background .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.danger { color: var(--red); border-color: #f0b9b6; }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--red); }
.btn.small { padding: 3px 12px; font-size: .84rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-wide { width: 100%; }
.actions { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; align-items: center; }
.actions.column { flex-direction: column; align-items: flex-start; }
.inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline-form label { margin: 0; }

/* ── Страницы ──────────────────────────────────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.filters select { width: auto; }
.two-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 400px); gap: 26px; align-items: start; }
@media (max-width: 1000px) { .two-cols { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 20px; margin: 12px 0;
}
details.card summary { cursor: pointer; font-size: .98rem; }
details.card summary::marker { color: var(--muted); }
details.card[open] summary { margin-bottom: 10px; }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.thumb img {
  width: 112px; height: 84px; object-fit: cover; border-radius: 9px;
  border: 1px solid var(--line); display: block;
}
.thumb span { font-size: .8rem; color: var(--muted); }

.preview {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px; position: sticky; top: 20px; max-height: 88vh; overflow-y: auto;
}
.preview h2 { margin-top: 0; }
.preview-card {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 10px 14px; margin: 10px 0;
}
.preview-card h3 {
  margin: 0 0 6px; font-size: .88rem; display: flex; justify-content: space-between;
}
.preview-card .len { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.preview-card .text { white-space: pre-wrap; font-size: .88rem; overflow-wrap: anywhere; }
.preview-card .warn { color: var(--warn-ink); font-size: .82rem; margin-top: 6px; }

.post-body {
  white-space: pre-wrap; font: inherit; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px;
  overflow-wrap: anywhere;
}

/* ── Логин: сплит-карточка в стиле WikiBot ─────────────────────────────── */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(4, 28, 141, .10), transparent 60%),
    radial-gradient(900px 480px at 105% 112%, rgba(4, 28, 141, .08), transparent 55%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 860px;
  display: grid; grid-template-columns: 1.05fr .95fr;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; box-shadow: 0 22px 55px -26px rgba(31, 30, 29, .30);
}
@media (max-width: 720px) { .auth-card { grid-template-columns: 1fr; } .auth-hero { display: none; } }
.auth-hero {
  padding: 44px 40px; border-right: 1px solid var(--line);
  background:
    radial-gradient(520px 260px at 118% -18%, rgba(4, 28, 141, .18), transparent 62%),
    linear-gradient(158deg, #f2ede4 0%, #ece8de 100%);
}
.auth-brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 1.12rem; color: var(--ink);
}
.auth-brand .brand-icon { width: 22px; height: 22px; }
.auth-brand-tag {
  font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--red); align-self: flex-end; margin-bottom: 2px;
}
.auth-headline {
  margin: 26px 0 10px; font-size: 1.5rem; line-height: 1.25;
  font-weight: 600; letter-spacing: -.01em;
}
.auth-sub { margin: 0 0 26px; color: var(--muted); font-size: .93rem; line-height: 1.55; }
.auth-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.auth-feats li { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.feat-ico {
  flex: none; width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-size: 1rem;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.auth-form { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth-form-title { margin: 0 0 4px; font-size: 1.3rem; font-weight: 600; }
.auth-form-hint { margin: 0 0 20px; color: var(--muted); font-size: .88rem; }
.auth-form .btn { margin-top: 14px; }
