:root {
  --red: #E34A3B;
  --red-dark: #c63a2c;
  --ink: #1c1d20;
  --ink-2: #26282c;
  --ink-3: #3f444b;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e3e6eb;
  --muted: #6b7078;
  --ok: #2E9E48;
  --warn: #F2A900;
  --info: #1E5BB8;
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.5;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.muted { color: var(--muted); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side {
  background: var(--ink); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid #2f3136; margin-bottom: 10px; }
.brand img { background: #fff; border-radius: 10px; padding: 3px 4px; width: 44px; height: auto; }
.brand strong { display: block; font-size: 1rem; }
.brand span { display: block; font-size: .75rem; color: #9aa0a8; }
nav { flex: 1; overflow-y: auto; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #7d838c; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: #d4d7dc;
  text-decoration: none; font-size: .92rem; font-weight: 500;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: #2a2c31; color: #fff; }
.nav-item.active { background: var(--red); color: #fff; }
.nav-item .tag { margin-left: auto; font-size: .65rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #33363c; color: #b9bdc4; }
.nav-item .tag svg { width: 12px; height: 12px; }
.nav-item.soon { opacity: .55; cursor: default; }
.me { border-top: 1px solid #2f3136; padding: 12px 10px 0; font-size: .8rem; color: #9aa0a8; word-break: break-all; }
.me a { color: #d4d7dc; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 18px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 1.25rem; margin: 0; }
main { padding: 24px 28px 60px; max-width: 1200px; }
.icon-btn { appearance: none; border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.only-mobile { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 14px 16px; }
  main { padding: 16px 16px 60px; }
}

/* ---------- Components ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card h2 { font-size: 1.05rem; margin: 0 0 12px; }
.card h3 { font-size: .95rem; margin: 0 0 6px; }
.stat { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--muted); }

.tool-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; transition: border-color .15s, transform .15s; }
.tool-card:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.tool-card .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: #fdeceb; color: var(--red); }
.tool-card .ico svg { width: 22px; height: 22px; }
.tool-card p { margin: 0; font-size: .88rem; color: var(--muted); }
.tool-card.soon { opacity: .6; pointer-events: none; }

.btn {
  appearance: none; border: 0; cursor: pointer; font-weight: 700; font-size: .9rem; border-radius: 999px;
  padding: 10px 18px; background: var(--red); color: #fff; display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.btn:hover { background: var(--red-dark); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: var(--ink-3); }
.btn.small { padding: 6px 12px; font-size: .8rem; }
.btn.danger { background: #fff; color: var(--red-dark); border: 1px solid #f3c9c4; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spacer { flex: 1; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--red); }
.field textarea { min-height: 140px; resize: vertical; }
.hint { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .85rem; cursor: pointer; }
.checks input { accent-color: var(--red); }

.badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.b-pending { background: #e8eefb; color: var(--info); }
.b-publishing { background: #fff4d6; color: #8a6200; }
.b-published { background: #e3f4e7; color: #1f7535; }
.b-partial, .b-failed { background: #fde6e3; color: var(--red-dark); }
.b-canceled { background: #eceef1; color: var(--muted); }
.banner { border-radius: 12px; padding: 12px 14px; font-size: .88rem; margin-bottom: 16px; background: #fff7df; border: 1px solid #f5df9c; }

.posts { display: grid; gap: 10px; }
.post { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.post img, .post .noimg { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #eceef1; }
.post .txt { font-size: .88rem; white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.post .meta { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.post .err { font-size: .75rem; color: var(--red-dark); margin-top: 4px; }
.post .actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 520px) { .post { grid-template-columns: 48px 1fr; } .post img, .post .noimg { width: 48px; height: 48px; } .post .actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; } }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 2px dashed var(--line); border-radius: 12px; padding: 22px 14px; cursor: pointer; background: #fafbfc; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--red); background: #fff5f4; }
.drop.busy { opacity: .7; cursor: wait; }
.drop strong { font-size: .9rem; }
.drop small { font-size: .75rem; color: var(--muted); }
.preview { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 90px; height: 90px; }
.thumb img, .thumb video { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #eceef1; }
.thumb.broken img { visibility: hidden; }
.thumb .x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; font-size: 14px; line-height: 22px; padding: 0;
}
.thumb .warn { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: .62rem; font-weight: 700; text-align: center; background: var(--warn); color: #2a2100; border-radius: 4px; padding: 1px 2px; }
details.hint summary { cursor: pointer; margin-top: 8px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr.best td { background: #eef8f0; font-weight: 700; }

.copy-list { display: grid; gap: 8px; }
.copy-item { display: flex; gap: 8px; align-items: center; font-size: .82rem; }
.copy-item code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #f1f2f4; padding: 6px 8px; border-radius: 8px; }
.copy-item strong { width: 130px; flex: none; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .88rem; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: .9rem; }
