:root {
  --bg: #f6f4ef; --panel: #ffffff; --ink: #1d1b18; --muted: #6b665e; --line: #e4dfd5;
  --accent: #c2562b; --accent-ink: #ffffff; --ok: #2f7d4f; --warn: #a86a00; --bad: #b3261e;
  --soft: #f0ece4; --radius: 10px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --panel: #201f1c; --ink: #ece8e1; --muted: #a39d92; --line: #34312c;
    --accent: #e0774a; --accent-ink: #1a0d06; --ok: #5cbf86; --warn: #e0a640; --bad: #f2786d;
    --soft: #2a2825; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
header.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 700; letter-spacing: .01em; color: var(--ink); text-decoration: none; }
header.top nav { display: flex; gap: 14px; flex: 1; }
header.top nav a { color: var(--muted); text-decoration: none; }
header.top nav a:hover { color: var(--ink); }
main { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.notice { background: var(--soft); border-left: 3px solid var(--ok); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.errors { background: var(--soft); border-left: 3px solid var(--bad); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.errors ul, .problems ul { margin: 4px 0 0 18px; padding: 0; }
.alert { border-left: 3px solid var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* post cards */
.cards { display: grid; gap: 10px; }
.card { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: start; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-decoration: none; color: inherit; }
.card:hover { border-color: var(--muted); }
.thumb { width: 64px; height: 64px; border-radius: 6px; background: var(--soft) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.card .text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-line; }
.card .meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.chip.published { color: var(--ok); }
.chip.failed { color: var(--bad); }
.status { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--soft); white-space: nowrap; }
.status.review { color: var(--warn); }
.status.scheduled, .status.publishing { color: var(--accent); }
.status.published { color: var(--ok); }
.status.failed, .status.partial { color: var(--bad); }
.empty { color: var(--muted); padding: 10px 2px; }

/* editor */
.editor { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 820px) { .editor { grid-template-columns: 1fr; } }
label.field { display: block; font-weight: 600; margin: 0 0 6px; }
input[type=text], input[type=datetime-local], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
textarea { resize: vertical; min-height: 180px; }
textarea.override { min-height: 90px; }
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.net { border-top: 1px solid var(--line); padding: 10px 0; }
.net:first-child { border-top: 0; }
.net .row { display: flex; align-items: center; gap: 8px; }
.net .row label { flex: 1; font-weight: 600; }
.count { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.count.over { color: var(--bad); font-weight: 700; }
.net details { margin-top: 6px; }
.net summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.net .result { font-size: 13px; margin-top: 4px; }
.problems { color: var(--bad); font-size: 13px; margin-top: 4px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.media-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--panel); }
.media-item img, .media-item video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--soft); }
.media-item textarea { min-height: 60px; font-size: 13px; margin-top: 6px; }
.media-item .tools { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.media-item input.sort { width: 48px; padding: 3px 6px; font-size: 12px; }
.sidebar .panel + .panel { margin-top: 14px; }
.when label { display: block; margin: 4px 0; }
.actions { display: grid; gap: 8px; margin-top: 12px; }
.log { font-size: 12px; color: var(--muted); max-height: 220px; overflow: auto; }
.log div { padding: 3px 0; border-top: 1px solid var(--line); }
table.conn { width: 100%; border-collapse: collapse; }
table.conn td, table.conn th { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.login { max-width: 360px; margin: 12vh auto; }
.login input { margin: 8px 0 14px; }
