:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #18202f;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #2f5bea;
  --accent-soft: #eef3ff;
  --danger: #c4320a;
  --ok: #067647;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header and tabs ---------- */

.top {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 60px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.top .brand { font-weight: 700; color: var(--ink); white-space: nowrap; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tab {
  display: flex; align-items: center; gap: 6px; padding: 0 14px; height: 100%;
  color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count {
  background: var(--bg); border-radius: 10px; padding: 0 7px; font-size: 12px; color: var(--muted);
}
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent); }
.top-right { margin-left: auto; display: flex; gap: 16px; align-items: center; }
.top-right .strong { font-weight: 600; color: var(--ink); }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

/* ---------- basics ---------- */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px;
}
.card.narrow { max-width: 680px; }
h1 { font-size: 24px; margin: 0 0 4px; line-height: 1.3; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 6px; }
.page-head { margin-bottom: 20px; }
.page-head p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.big { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.error { color: var(--danger); }
.count {
  display: inline-block; min-width: 22px; padding: 0 7px; margin-left: 4px;
  border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 12px; text-align: center;
}
.flash {
  background: #ecfdf3; border: 1px solid #abefc6; color: var(--ok);
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 20px;
}

/* ---------- lists ---------- */

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list.flat { border: 0; border-radius: 0; }
.item {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 20px; border-top: 1px solid var(--line); color: var(--ink);
}
.item:first-child { border-top: 0; }
.list.flat .item { padding: 14px 0; }
a.item:hover { background: #fafbfc; text-decoration: none; }
.item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item-side { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.arrow { color: var(--muted); font-size: 22px; line-height: 1; }
.when { font-size: 13px; color: var(--muted); }
.when.strong { color: var(--ink); font-weight: 600; }
.score { font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 2px 8px; font-size: 13px; }

.empty { text-align: center; padding: 56px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .button { margin-top: 8px; }

.chip {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 6px;
  background: var(--bg); color: var(--muted);
}
.chip-linkedin { background: #e8f1fb; color: #0a66c2; }
.chip-x { background: #eceef1; color: #111; }
.chip-substack { background: #fff1e8; color: #c2410c; }
.chip-youtube { background: #fdecec; color: #c4320a; }
.chip-tiktok { background: #fdeef6; color: #b42373; }
.chip-riteshnaikcom { background: #ecfdf3; color: var(--ok); }

.badge {
  display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}
.b-scheduled, .b-auto-post { background: var(--accent-soft); color: var(--accent); border-color: #c7d7fe; }
.b-in-review, .b-you-post, .b-timely { background: #fff6ed; color: #b54708; border-color: #fedf89; }
.b-ready, .b-posted, .b-published, .b-evergreen { background: #ecfdf3; color: var(--ok); border-color: #abefc6; }
.b-posting { background: #f4f3ff; color: #5925dc; border-color: #d9d6fe; }
.b-needs-fix, .b-rejected, .b-failed { background: #fef3f2; color: var(--danger); border-color: #fecdca; }

/* ---------- forms and buttons ---------- */

form.inline { display: inline; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }

input[type=text], input[type=url], input[type=password], input[type=datetime-local], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.6; }
textarea[readonly] { background: var(--bg); }

button, .button {
  display: inline-block; font: inherit; font-weight: 500; cursor: pointer; border-radius: 8px; padding: 9px 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-align: center;
}
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: #2549c9; border-color: #2549c9; }
.block { display: block; width: 100%; }
.small { font-size: 13px; }
button.small, .button.small { padding: 5px 12px; font-size: 13px; }
button.link { border: 0; padding: 0; background: none; color: var(--accent); font-weight: 400; }
button.link.danger { color: var(--danger); font-size: 13px; margin-top: 6px; }
button.done { background: #ecfdf3; border-color: #abefc6; color: var(--ok); }

/* ---------- draft page ---------- */

.draft-head { margin-bottom: 18px; }
.draft-head .back { display: inline-block; margin-bottom: 10px; color: var(--muted); }
.draft-head h1 { margin-top: 8px; }
.draft-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.draft-side { position: sticky; top: 80px; }

.editor { padding: 0; overflow: hidden; }
.vtabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); background: #fafbfc; }
.vtab {
  border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; background: none;
  padding: 8px 16px; color: var(--muted); margin-bottom: -1px;
}
.vtab.active { background: var(--card); border-color: var(--line); color: var(--ink); font-weight: 600; }
.vpanel textarea { border: 0; border-radius: 0; padding: 18px 22px; min-height: 420px; font-size: 15px; }
.vpanel textarea:focus { outline: none; }
.js .vpanel { display: none; }
.js .vpanel.active { display: block; }
.vpanel + .vpanel { border-top: 1px solid var(--line); }
.js .vpanel + .vpanel { border-top: 0; }
.editor-foot { display: flex; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: #fafbfc; }
.editor-foot input { flex: 1; }
.counter { font-size: 13px; color: var(--muted); white-space: nowrap; }
.counter.over { color: var(--danger); font-weight: 600; }
.editor .error { padding: 10px 22px 0; margin: 0; }

.notes { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; font-size: 14px; }
.notes summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.notes p { margin: 10px 0 0; color: var(--ink); }
.notes.warn { border-color: #fecdca; background: #fffbfa; }
.notes.warn summary { color: var(--danger); }

.action h2 { margin-bottom: 6px; }
.action .block { margin-top: 10px; }
.action input[type=datetime-local] { margin-top: 10px; }
.action p { margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip-btn { padding: 5px 10px; font-size: 13px; border-radius: 16px; }
.chip-btn.picked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.more { margin-top: 14px; font-size: 14px; }
.more summary { cursor: pointer; color: var(--muted); }
.more .stack { margin-top: 10px; }

.steps { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.step { display: flex; gap: 10px; align-items: flex-start; }
.step .num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 8px;
}
.step .block { margin-top: 0; }
.grow { flex: 1; }

.preview { padding: 16px 18px; }
.preview-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.preview-head div { display: flex; flex-direction: column; line-height: 1.3; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.preview-body { white-space: pre-wrap; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.see-more { border: 0; background: none; padding: 0; color: var(--muted); font-size: 14px; }

.post-image, .preview-image { display: block; width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.preview-image { margin-top: 12px; }
.image-card .post-image { margin-bottom: 8px; }
.brief { margin-bottom: 10px; font-size: 14px; }
.brief summary { cursor: pointer; color: var(--muted); }
.brief pre { white-space: pre-wrap; font: inherit; font-size: 13px; background: var(--bg); border-radius: 8px; padding: 10px 12px; margin: 8px 0 0; }
.upload { margin-top: 12px; display: block; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; font-weight: 500; cursor: pointer; }
.upload input { margin-top: 6px; font-size: 13px; }

.login { max-width: 380px; margin: 12vh auto 0; }
.login form { display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 900px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .tab { padding: 8px 10px; }
  main { padding: 18px 14px 40px; }
  .draft-grid { grid-template-columns: 1fr; }
  .draft-side { position: static; }
  .two { grid-template-columns: 1fr; }
  .item { flex-direction: column; align-items: flex-start; }
}
