:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1d1d1f; --muted: #6b6b70; --line: #e4e2dc;
  --accent: #2f5bea; --accent-ink: #fff; --ok: #1f8a4c; --warn: #b26a00; --err: #c62828;
  --draft: #8a8a8f; --approved: #2f5bea; --scheduled: #5a3fd6; --publishing: #b26a00; --published: #1f8a4c; --cancelled: #b9b9bd;
  --ig: #c13584; --tt: #111;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416; --panel: #1d1d20; --ink: #ececef; --muted: #9b9ba3; --line: #2e2e33;
    --accent: #6d8cff; --draft: #9a9aa2; --cancelled: #55555b; --tt: #e8e8ea; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #141416; --panel: #1d1d20; --ink: #ececef; --muted: #9b9ba3; --line: #2e2e33;
  --accent: #6d8cff; --draft: #9a9aa2; --cancelled: #55555b; --tt: #e8e8ea; --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Inter, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 4px 0 12px; } h2 { font-size: 18px; margin: 0 0 10px; } h3 { font-size: 15px; margin: 16px 0 8px; }
h1 a, h2 a { color: inherit; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 16px; }
.top { display: flex; align-items: center; gap: 18px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top nav { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
.top nav a { color: var(--ink); }
.brand { font-weight: 700; color: var(--ink); }
.banner { padding: 8px 16px; font-size: 14px; text-align: center; }
.banner.test { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.banner.paused { background: color-mix(in srgb, var(--warn) 22%, var(--panel)); font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.narrow { max-width: 460px; margin: 40px auto; }
.err-card { border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.wrap-row { flex-wrap: wrap; align-items: flex-end; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; color: var(--ink); font-size: 14px; }
label.check input { margin-top: 3px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
textarea { resize: vertical; }
input.num { width: 80px; }
.btn { display: inline-block; border: 0; background: var(--accent); color: var(--accent-ink); padding: 9px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.big { padding: 12px 20px; font-size: 16px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--err); }
.danger-text { color: var(--err) !important; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.inline { display: inline; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.hint { font-size: 12px; color: var(--muted); }
.hint.over { color: var(--err); font-weight: 600; }
.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--panel); }
.flash.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.flash.warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--panel)); }
.flash.err { border-color: color-mix(in srgb, var(--err) 60%, var(--line)); background: color-mix(in srgb, var(--err) 7%, var(--panel)); }
.flash ul { margin: 6px 0 0 18px; padding: 0; }
.list-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 4%, transparent); }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--draft); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; }
.stat b { font-size: 22px; } .stat span { font-size: 13px; color: var(--muted); }
.st { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; color: #fff; background: var(--draft); white-space: nowrap; vertical-align: middle; }
.st-approved { background: var(--approved); } .st-scheduled { background: var(--scheduled); } .st-publishing { background: var(--publishing); }
.st-published { background: var(--published); } .st-error { background: var(--err); } .st-cancelled { background: var(--cancelled); }
.st-b-draft { border-left-color: var(--draft) !important; } .st-b-approved { border-left-color: var(--approved) !important; }
.st-b-scheduled { border-left-color: var(--scheduled) !important; } .st-b-publishing { border-left-color: var(--publishing) !important; }
.st-b-published { border-left-color: var(--published) !important; } .st-b-error { border-left-color: var(--err) !important; }
.st-b-cancelled { border-left-color: var(--cancelled) !important; opacity: .55; }
.pf { display: inline-block; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; color: #fff; }
.pf-instagram { background: var(--ig); } .pf-tiktok { background: #111; border: 1px solid #444; }
.th, .th-s, .cal-th { object-fit: cover; background: var(--line); border-radius: 6px; display: block; }
.th { width: 100%; aspect-ratio: 9/16; }
.th-s { width: 40px; height: 56px; flex: none; }
.cal-th { width: 28px; height: 40px; flex: none; }
.ph { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.small-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.media-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.media-card.pick { cursor: pointer; color: var(--ink); font-size: 14px; gap: 0; }
.media-card.pick > input[type=checkbox] { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; z-index: 1; }
.media-card.pick:has(input[type=checkbox]:checked) { outline: 3px solid var(--accent); }
.media-info { padding: 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.media-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos { width: 56px; padding: 3px 6px; }
.steps { display: flex; gap: 24px; padding-left: 20px; flex-wrap: wrap; color: var(--muted); }
.steps li.done { color: var(--ok); } .steps li.done::marker { content: "✓ "; }
.cal-head { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.cal-head h2 { margin: 0; min-width: 170px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.cal-dow { font-size: 12px; color: var(--muted); text-align: center; }
.cal-day { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 110px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day.off { background: transparent; border-style: dashed; opacity: .4; }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-num { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-item { display: flex; gap: 6px; align-items: center; border-left: 3px solid var(--draft); padding: 3px 4px; border-radius: 5px; background: var(--bg); color: var(--ink); font-size: 12px; min-width: 0; }
.cal-item:hover { text-decoration: none; filter: brightness(.97); }
.cal-meta { min-width: 0; line-height: 1.25; }
.cal-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.nowrap { white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.problems { color: var(--err); font-size: 12px; margin: 4px 0 0 16px; padding: 0; }
.lvl-error td { color: var(--err); } .lvl-warn td:nth-child(2) { color: var(--warn); }
.pre { white-space: pre-wrap; }
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.preview-col { position: sticky; top: 12px; }
.phone { background: #000; color: #fff; border-radius: 26px; padding: 10px; border: 6px solid #2a2a2e; max-width: 320px; margin: 0 auto; }
.phone-top { font-size: 13px; padding: 4px 6px 8px; }
.phone-media { position: relative; aspect-ratio: 9/16; background: #111; border-radius: 12px; overflow: hidden; }
.phone-media img, .phone-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.big-ph { height: 100%; }
.badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); padding: 2px 8px; border-radius: 99px; font-size: 12px; }
.phone-caption { font-size: 12px; padding: 8px 6px 4px; white-space: pre-wrap; max-height: 150px; overflow: auto; }
.tt-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.indent { padding-left: 24px; display: flex; flex-direction: column; gap: 6px; }
.consent { font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
code.sel { user-select: all; word-break: break-all; }
details summary { cursor: pointer; color: var(--accent); }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  .top { justify-content: space-between; }
  .top nav { order: 3; flex: 0 0 100%; gap: 6px 14px; font-size: 14px; }
  .grid2, .post-layout { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .preview-col { position: static; }
  .cal { grid-template-columns: 1fr; }
  .cal-dow, .cal-day.off { display: none; }
  .cal-day { min-height: 0; }
  .tbl { display: block; overflow-x: auto; }
}
