:root {
  --bg: #f5f7f9; --card: #fff; --text: #0f1419; --muted: #536471; --line: #e1e8ed;
  --accent: #1d9bf0; --accent-ink: #fff; --danger: #d4213b; --ok: #00a36b; --warn: #c77700;
  --badge-scheduled: #e8f5fd; --badge-published: #e6f6ef; --badge-failed: #fdecee; --badge-draft: #eef1f4;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14; --card: #151b23; --text: #e7e9ea; --muted: #8b98a5; --line: #2a333d;
    --badge-scheduled: #10324a; --badge-published: #0f3a2b; --badge-failed: #4a1820; --badge-draft: #232b34;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 80px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 28px 0 10px; display: flex; gap: 8px; align-items: center; }
h3.day { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.count { background: var(--line); border-radius: 99px; padding: 0 8px; font-size: .8rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.grow { flex: 1; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top nav { display: flex; gap: 4px; align-items: center; }
.top nav a, .link { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; background: none; border: 0; font: inherit; cursor: pointer; }
.top nav a.on, .top nav a:hover, .link:hover { color: var(--text); background: var(--bg); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; display: flex; gap: 8px; align-items: center; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 7v9l6 4' stroke='white' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/100%; display: inline-block; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.row { display: flex; gap: 8px; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.empty { text-align: center; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; justify-content: center; border-style: dashed; margin-bottom: 16px; }
button.primary { padding: 10px; border-radius: 99px; font: inherit; font-weight: 700; cursor: pointer; border: 0; }

input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; min-height: 90px; font-size: 1.05rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-weight: 600; font-size: .9rem; }
label > input, label > select { margin-top: 4px; font-weight: 400; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin-top: 6px; }
label.check input { width: auto; }

.messages { margin-bottom: 12px; }
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; background: var(--badge-draft); }
.msg.success { background: var(--badge-published); } .msg.error { background: var(--badge-failed); }
.msg.warning { background: #fff4d6; color: #5a4300; } .msg.info { background: var(--badge-scheduled); }

.post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.post.status-failed { border-color: var(--danger); }
.post .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.post .text { margin: 8px 0; white-space: normal; overflow-wrap: anywhere; }
.thread { color: var(--accent); font-size: .85rem; }
.badge { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--badge-draft); }
.badge.scheduled, .badge.publishing { background: var(--badge-scheduled); color: var(--accent); }
.badge.published { background: var(--badge-published); color: var(--ok); }
.badge.failed { background: var(--badge-failed); color: var(--danger); }
.error-text { color: var(--danger); font-size: .9rem; margin: 6px 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.actions form { margin: 0; }
.actions.col { flex-direction: column; align-items: stretch; margin: 0; }

.thumbs, .media-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: inline-flex;
  align-items: center; justify-content: center; font-size: .8rem; color: var(--muted); padding: 4px; text-align: center; overflow: hidden; }
.media { display: flex; flex-direction: column; gap: 4px; width: 150px; position: relative; }
.media .thumb { width: 150px; height: 110px; }
.media input { font-size: .8rem; padding: 4px 6px; }
.media .icon { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; }

.login { max-width: 360px; margin: 10vh auto; display: flex; flex-direction: column; gap: 12px; }
.login h1 { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 6px; }

.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 99px; padding: 3px 10px; font: inherit; font-size: .85rem; cursor: pointer; }
.part-head, .part-foot { display: flex; align-items: center; gap: 6px; }
.part-head { margin-bottom: 6px; }
.num { font-weight: 700; color: var(--muted); font-size: .85rem; }
.icon { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--bg); color: var(--text); cursor: pointer; font-size: .9rem; }
.icon:disabled { opacity: .3; cursor: default; }
.btn.file { font-weight: 500; }
.counter { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.warn { color: var(--warn); } .counter.over { color: var(--danger); font-weight: 700; }
.submit-bar { display: flex; gap: 8px; align-items: center; position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }

.account { display: flex; gap: 14px; align-items: flex-start; }
.avatar { width: 48px; height: 48px; border-radius: 50%; }
.steps li { margin-bottom: 6px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 5px; font-size: .88em; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .settings { grid-template-columns: 1fr; }
  .account { flex-direction: column; }
  .actions.col { flex-direction: row; }
}
