:root {
  --bg: #f5f5f9; --card: #fff; --ink: #1b1b29; --muted: #6c6c80; --line: #e6e6ef;
  --accent: #5b5bd6; --accent-soft: #c9c9f2; --green: #1a9f64; --red: #d93d4a; --amber: #d98a00;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,20,50,.05), 0 2px 8px rgba(20,20,50,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121218; --card: #1c1c25; --ink: #ececf3; --muted: #9a9aae; --line: #2c2c39;
          --accent: #8080f0; --accent-soft: #3b3b6b; --shadow: none; }
  .pbadge[style*="#111111"] { --pc: #3a3a44 !important; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, sans-serif; background: var(--bg); color: var(--ink); display: flex; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 10px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }

/* sidebar */
.side { width: 230px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); padding: 4px 8px; }
.brand:hover { text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: conic-gradient(#E1306C 0 25%, #1877F2 0 50%, #F2C200 0 75%, #111 0); position: relative; }
.logo::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--card); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); font-weight: 500; }
.side nav a:hover { background: var(--bg); text-decoration: none; }
.side nav a.on { background: var(--accent); color: #fff; }
.side nav svg { width: 18px; height: 18px; fill: currentColor; opacity: .85; }
.dot { margin-left: auto; font-style: normal; background: var(--amber); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 7px; }
.side-platforms { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 0 6px; }
.side-platforms a:hover { text-decoration: none; opacity: .8; }

main { flex: 1; min-width: 0; padding: 26px 30px 60px; max-width: 1320px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); background: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; margin-top: 8px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-actions form, .pr-actions form, .hero-actions form { margin: 0; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; margin-top: 8px; }
.check input { width: auto; }

/* badges */
.pbadge { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink); white-space: nowrap; }
.pbadge b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--pc); color: var(--pt); font-size: 10px; letter-spacing: .02em; }
.sbadge { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.s-draft { background: #ececf3; color: #55556a; }
.s-scheduled { background: #e5e5fb; color: #4646b8; }
.s-published { background: #dff4ea; color: #137a4c; }
.s-due { background: #fdeccd; color: #9a5a00; }
@media (prefers-color-scheme: dark) {
  .s-draft { background: #2c2c39; color: #b9b9c9; } .s-scheduled { background: #2b2b55; color: #b5b5ff; }
  .s-published { background: #143829; color: #7fdcae; } .s-due { background: #3d2c0d; color: #f5c46b; }
}

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: #dff4ea; color: #137a4c; }
.flash-err { background: #fde3e5; color: #a1222d; }
.due-banner { display: block; background: #fdeccd; color: #7a4700; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .flash-ok { background: #143829; color: #7fdcae; } .flash-err { background: #431a1e; color: #ff9aa2; } .due-banner { background: #3d2c0d; color: #f5c46b; } }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }
.pf-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.pf-card { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--pc); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); box-shadow: var(--shadow); }
.pf-card:hover { text-decoration: none; border-color: var(--pc); }
.pf-top { display: flex; justify-content: space-between; align-items: center; }
.pf-nums { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.pf-nums b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.pf-nums span { font-size: 11.5px; color: var(--muted); }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg a, .seg label { padding: 5px 12px; border-radius: 6px; color: var(--muted); font-weight: 600; cursor: pointer; font-size: 13px; text-align: center; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg .on { background: var(--accent); color: #fff; }
.seg input { display: none; }
.seg-full { display: flex; margin-bottom: 12px; } .seg-full label { flex: 1; }

.hero { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 48px; text-align: center; max-width: 720px; margin: 40px auto; }
.hero p { color: var(--muted); font-size: 15px; max-width: 520px; margin: 10px auto 22px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart circle { cursor: default; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend-col { flex-direction: column; gap: 6px; }
.legend b { color: var(--ink); margin-left: 4px; }
.chart-empty { color: var(--muted); padding: 24px 8px; text-align: center; font-size: 13px; }
.chart-empty.big { padding: 50px; font-size: 14px; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg); border-radius: 5px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; min-width: 2px; }
.bar-val { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { width: 150px; flex-shrink: 0; }
.donut-num { font-size: 22px; font-weight: 700; fill: var(--ink); }
.donut-lbl { font-size: 11px; fill: var(--muted); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li a { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.mini-list li:last-child a { border-bottom: 0; }
.mini-list li a:hover { text-decoration: none; background: var(--bg); }
.ml-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; }

.top-posts { display: flex; flex-direction: column; }
.top-post { display: grid; grid-template-columns: 24px 54px 1fr auto; gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.top-post:last-child { border-bottom: 0; }
.top-post:hover { text-decoration: none; background: var(--bg); }
.rank { font-weight: 700; color: var(--muted); text-align: center; }
.tp-cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-body { min-width: 0; }
.thumb { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--bg); display: block; }
.thumb-empty { display: grid; place-items: center; font-size: 10px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }
.metrics { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* posts list */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters select, .filters input { width: auto; padding: 7px 9px; }
.f-search { flex: 1 1 260px; width: auto !important; }
.f-date { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.sumbar { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); margin: 0 4px 10px; flex-wrap: wrap; }
.sumbar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.post-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.post-row { display: grid; grid-template-columns: 18px 54px 1fr 130px 250px auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.post-row:last-child { border-bottom: 0; }
.pr-main { min-width: 0; }
.pr-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pr-cap { display: block; color: var(--ink); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-tags { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; margin-top: 2px; }
.pr-date { font-size: 13px; line-height: 1.35; }
.pr-date .small { display: block; }
.pr-actions { display: flex; gap: 4px; justify-content: flex-end; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 16px; }

/* calendar */
.cal-nav { display: flex; gap: 8px; align-items: center; }
.cal-nav b { min-width: 140px; text-align: center; font-size: 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 5px 12px; border: 1px solid var(--line); background: var(--card); border-radius: 20px; color: var(--ink); font-weight: 600; font-size: 13px; }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-layout { display: grid; grid-template-columns: 1fr 260px; gap: 16px; align-items: start; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: var(--card); padding: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.cal-day { background: var(--card); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: var(--bg); }
.cal-day.other .cal-num { opacity: .5; }
.cal-num { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; color: var(--ink); padding: 1px 4px; border-radius: 6px; }
.cal-num span { opacity: 0; color: var(--accent); font-size: 15px; }
.cal-day:hover .cal-num span { opacity: 1; }
.cal-num:hover { text-decoration: none; background: var(--bg); }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-day.today .cal-num span { color: #fff; }
.cal-post { display: flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 6px; border-radius: 5px; color: var(--ink); background: var(--bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--pc); }
.cal-post:hover { text-decoration: none; filter: brightness(.96); }
.cal-post i { display: none; }
.cal-post.st-scheduled { background: #ececfd; }
.cal-post.st-published { background: #e6f6ee; }
.cal-post.st-draft { background: transparent; border: 1px dashed var(--line); border-left: 3px solid var(--pc); }
@media (prefers-color-scheme: dark) { .cal-post.st-scheduled { background: #262648; } .cal-post.st-published { background: #15301f; } }
.cal-more { font-size: 11.5px; color: var(--muted); padding-left: 6px; }
.cal-side { position: sticky; top: 20px; }
.cal-key { display: flex; flex-direction: column; gap: 5px; margin-top: 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.cal-key i { display: inline-block; width: 18px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.k-published { background: #c6ecd8; } .k-scheduled { background: #d4d4fa; } .k-draft { border: 1px dashed var(--muted); }

/* editor */
.editor { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.editor-main, .editor-side { display: flex; flex-direction: column; gap: 16px; }
.editor-side .btn-block { margin-top: 0; }
.editor-side { position: sticky; top: 16px; gap: 10px; }
.acc-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-opt { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; cursor: pointer; font-weight: 500; }
.acc-opt input { width: auto; margin: 0; accent-color: var(--pc); }
.acc-opt:has(input:checked) { border-color: var(--pc); box-shadow: inset 0 0 0 1px var(--pc); }
.cap-info { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.cap-info .over { color: var(--red); font-weight: 700; }
.media-box { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; }
.media-big { max-width: 100%; max-height: 340px; border-radius: 8px; display: block; margin-bottom: 10px; }
.media-box input[type=file] { border: 0; padding: 0; }

/* accounts */
.acc-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.acc-groups { display: flex; flex-direction: column; gap: 12px; }
.acc-group { border-left: 4px solid var(--pc); }
.acc-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.acc-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.acc-info { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 160px; }
.pf-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.pf-pick label { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.pf-pick input { width: auto; margin: 0; }
.pf-pick label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.danger-zone { margin-top: 10px; }
.note { margin-top: 14px; padding: 0 4px; }

@media (max-width: 1150px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .pf-cards { grid-template-columns: 1fr 1fr; }
  .post-row { grid-template-columns: 18px 54px 1fr auto; }
  .editor-side { position: static; }
  .post-row .pr-date, .post-row .metrics { grid-column: 3; }
  .cal-layout, .editor, .acc-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; }
}
@media (max-width: 820px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side-platforms { display: none; }
  main { padding: 18px 14px; }
  .grid-2, .pf-cards { grid-template-columns: 1fr; } .span-2 { grid-column: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .cal-day { min-height: 70px; } .cal-post { font-size: 0; padding: 4px; } .cal-post i { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--pc); }
}

/* ---------- v2: shared bits ---------- */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.field-row.four { grid-template-columns: repeat(4, 1fr); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.up { color: var(--green); font-weight: 600; } .down { color: var(--red); font-weight: 600; }
.metrics { flex-wrap: wrap; row-gap: 2px; }
.er { font-weight: 700; color: var(--ink); } .er-good { color: var(--green); } .er-low { color: var(--red); }
.bell { justify-content: flex-start; font-size: 13px; }
.bell.on { color: var(--green); }

/* dropdown menus (templates, hashtag groups, media picker) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list, .menu-grid { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.15); padding: 6px; }
.menu-list { min-width: 240px; display: flex; flex-direction: column; }
.menu-list button, .menu-list a { all: unset; cursor: pointer; padding: 7px 10px; border-radius: 6px; font-size: 13px; display: flex; flex-direction: column; }
.menu-list button:hover, .menu-list a:hover { background: var(--bg); }
.menu-list small { color: var(--muted); }
.menu-list a { color: var(--accent); border-top: 1px solid var(--line); margin-top: 4px; }
.menu-grid { left: 0; right: auto; width: 330px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 280px; overflow: auto; }
.menu-grid button { all: unset; cursor: pointer; border-radius: 8px; }
.menu-grid button:hover { outline: 2px solid var(--accent); }

/* upload drop zone */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 22px 12px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; cursor: pointer; color: var(--muted); transition: .15s; }
.dropzone b { color: var(--ink); }
.dropzone small { font-size: 11.5px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.dropzone.has-file { border-style: solid; border-color: var(--green); }
.media-tools { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.media-tools .check { margin: 0; }

/* ---------- live preview phone ---------- */
.preview-card { padding: 14px; }
.pv-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 12px; }
.pv-tabs button { font: inherit; font-size: 11.5px; font-weight: 600; padding: 6px 2px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; opacity: .65; }
.pv-tabs button.used { opacity: 1; color: var(--ink); }
.pv-tabs button.on { background: var(--pc); color: var(--pt); border-color: var(--pc); opacity: 1; }
.phone { width: 292px; margin: 0 auto; background: #0d0d10; border-radius: 40px; padding: 11px; box-shadow: 0 10px 30px rgba(0,0,0,.25), inset 0 0 0 2px #2a2a30; position: relative; }
.phone::before { content: ""; position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 76px; height: 20px; background: #0d0d10; border-radius: 12px; z-index: 5; }
.phone-screen { height: 560px; border-radius: 30px; overflow: hidden auto; background: #fff; color: #111; font: 12.5px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; position: relative; scrollbar-width: none; }
.phone-screen::-webkit-scrollbar { display: none; }
.phone-screen svg { width: 22px; height: 22px; display: block; }
.pv-tag { color: #00376b; }
.pv-av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(135deg, #7b7bf0, #c55cd6); color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.pv-av.ring { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #E1306C; }
.pv-av.fb { width: 36px; height: 36px; background: #1877F2; }
.pv-noimg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(135deg, #e9e9f3, #d5d5e6); color: #6c6c80; font-size: 12px; text-align: center; padding: 20px; }
.pv-noimg span { font-size: 30px; }
.pv-media { position: relative; width: 100%; background: #000; overflow: hidden; }
.pv-media img, .pv-media video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* feed posts (Instagram / Facebook) */
.pv-feed { padding-top: 40px; }
.pv-head { display: flex; align-items: center; gap: 9px; padding: 8px 12px; }
.pv-head b { font-size: 13px; }
.pv-head small { display: block; color: #65676b; font-size: 11.5px; }
.pv-dots { margin-left: auto; color: #555; letter-spacing: 1px; }
.pv-count { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 12px; }
.pv-dots-row { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.pv-dots-row i { width: 6px; height: 6px; border-radius: 50%; background: #c7c7c7; } .pv-dots-row i.on { background: #0095f6; }
.pv-actions { display: flex; gap: 14px; padding: 9px 12px 4px; align-items: center; }
.pv-right { margin-left: auto; }
.pv-likes { padding: 0 12px; font-weight: 600; }
.pv-cap { padding: 3px 12px; word-wrap: break-word; }
.pv-more { color: #737373; cursor: pointer; }
.pv-time { padding: 4px 12px 16px; color: #737373; font-size: 11px; }
.pv-fbtext { padding: 0 12px 10px; font-size: 13.5px; word-wrap: break-word; }
.fb-feed .pv-tag { color: #216fdb; }
.pv-react { display: flex; justify-content: space-between; padding: 8px 12px; color: #65676b; font-size: 12px; border-bottom: 1px solid #e4e6eb; }
.pv-fbbtns { display: flex; justify-content: space-around; padding: 8px 4px 16px; color: #65676b; font-weight: 600; font-size: 12.5px; }

/* full-screen vertical (TikTok, Snapchat, Stories, Reels) */
.pv-vert { position: absolute; inset: 0; background: #000; color: #fff; overflow: hidden; }
.pv-vert > img, .pv-vert > video { position: absolute; inset: 0; width: 100%; height: 100%; }
.pv-vert::before, .pv-vert::after { content: ""; position: absolute; left: 0; right: 0; pointer-events: none; z-index: 1; }
.pv-vert::before { top: 0; height: 110px; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.pv-vert::after { bottom: 0; height: 220px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.pv-vert > div:not(.pv-noimg) { position: absolute; z-index: 2; }
.pv-vert .pv-tag { color: #fff; font-weight: 700; }
.pv-top { top: 40px; left: 12px; right: 12px; }
.pv-bars { display: flex; gap: 3px; margin-bottom: 8px; }
.pv-bars i { flex: 1; height: 2.5px; background: rgba(255,255,255,.9); border-radius: 2px; }
.pv-user { display: flex; align-items: center; gap: 8px; }
.pv-user span { opacity: .8; font-size: 11.5px; }
.pv-user div span { display: block; }
.pv-top-title { top: 44px; left: 0; right: 0; text-align: center; font-weight: 700; font-size: 15px; }
.tt-tabs { display: flex; justify-content: center; gap: 16px; font-size: 14px; }
.tt-tabs span { opacity: .65; } .tt-tabs b { border-bottom: 2px solid #fff; padding-bottom: 3px; }
.pv-side { right: 8px; bottom: 110px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pv-side svg { width: 28px; height: 28px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.pv-side small { font-size: 10.5px; font-weight: 600; margin-bottom: 9px; }
.tt-av { width: 40px; height: 40px; border: 2px solid #fff; margin-bottom: 14px; position: relative; }
.tt-av::after { content: "+"; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%; background: #fe2c55; color: #fff; font-size: 14px; line-height: 17px; text-align: center; }
.pv-bottom { left: 12px; right: 62px; bottom: 18px; display: flex; flex-direction: column; gap: 6px; }
.pv-vcap { font-size: 12.5px; word-wrap: break-word; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.pv-music { display: flex; align-items: center; gap: 6px; font-size: 11.5px; white-space: nowrap; overflow: hidden; }
.pv-music svg { width: 13px; height: 13px; flex-shrink: 0; }
.tt-handle { font-size: 14px; }
.pv-follow { border: 1px solid rgba(255,255,255,.8); border-radius: 6px; padding: 1px 8px; font-weight: 600; opacity: 1 !important; font-size: 11.5px; }
.pv-sticker { left: 20px; right: 20px; top: 45%; text-align: center; font-weight: 700; font-size: 15px; background: rgba(255,255,255,.92); color: #111; padding: 8px 10px; border-radius: 10px; word-wrap: break-word; max-height: 40%; overflow: hidden; }
.pv-sticker .pv-tag { color: #111; }
.pv-bottom-bar { left: 12px; right: 12px; bottom: 16px; display: flex; align-items: center; gap: 12px; }
.pv-input { flex: 1; border: 1px solid rgba(255,255,255,.7); border-radius: 22px; padding: 8px 14px; font-size: 12px; }
.sc-caption { left: 0; right: 0; top: 58%; background: rgba(0,0,0,.55); color: #fff; text-align: center; padding: 6px 12px; font-size: 13.5px; word-wrap: break-word; }
.sc-av { background: #F2C200; color: #111; }
.pv-warn { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.pv-warn div { background: #fdeccd; color: #7a4700; padding: 7px 10px; border-radius: 8px; }
.pv-warn .ok { background: #dff4ea; color: #137a4c; }
@media (prefers-color-scheme: dark) { .pv-warn div { background: #3d2c0d; color: #f5c46b; } .pv-warn .ok { background: #143829; color: #7fdcae; } }

/* ---------- posts bulk actions ---------- */
.bulk-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 16px; margin-bottom: 8px; flex-wrap: wrap; }
.bulk-bar .check { margin: 0; color: var(--muted); }
.bulk-acts { display: none; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.bulk-bar.show { background: var(--card); border: 1px solid var(--accent); border-radius: 10px; position: sticky; top: 8px; z-index: 10; box-shadow: var(--shadow); }
.bulk-bar.show .bulk-acts { display: flex; }
.pick { width: 16px; height: 16px; accent-color: var(--accent); }
.post-row.picked { background: color-mix(in srgb, var(--accent) 7%, transparent); }

/* ---------- calendar drag & drop ---------- */
.cal-post[draggable=true] { cursor: grab; }
.cal-post.dragging { opacity: .4; }
.cal-day.drop { outline: 2px dashed var(--accent); outline-offset: -3px; }

/* ---------- templates, media, followers ---------- */
.snip { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.snip-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.snip-text { font-size: 13px; color: var(--muted); }
.snip .pr-tags span { color: var(--accent); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud a { padding: 3px 10px; border-radius: 14px; background: var(--bg); font-size: 13px; }
.tag-cloud small { color: var(--muted); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.media-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: relative; }
.media-tile { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.media-kind { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.media-meta { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; }
.fol-row { display: grid; grid-template-columns: auto 1fr 100px; gap: 8px; align-items: center; margin-bottom: 8px; }
.fol-name { display: flex; flex-direction: column; font-size: 13px; line-height: 1.25; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fol-name small { font-size: 11px; }
.fol-row input { padding: 6px 8px; }

/* ---------- v3: Claude AI ---------- */
.btn-ai { background: linear-gradient(135deg, #d97757, #b0569e); color: #fff; border-color: transparent; }
.btn-ai:hover { filter: brightness(1.08); border-color: transparent; }
.settings { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.settings > .btn { align-self: flex-start; }
.lang-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang-pick label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; cursor: pointer; }
.lang-pick input { width: auto; margin: 0; }
.lang-pick span { margin-left: auto; color: var(--muted); }
.lang-pick label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.lang-pick label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.field em { font-style: normal; margin-left: 6px; }

.ai-wait { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; border-color: var(--accent); }
.ai-wait p { margin: 4px 0 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 1s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-empty ol { line-height: 1.7; padding-left: 20px; }
.ai-text { font-size: 15px; line-height: 1.6; margin: 0 0 8px; }
.ai-platform { border-top: 3px solid var(--pc); }
.ai-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.ai-cols h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ai-cols h3 + .tips { margin-bottom: 0; }
.heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; margin-bottom: 14px; }
.heat-h { font-size: 10px; color: var(--muted); text-align: left; }
.heat-d { font-size: 11px; color: var(--muted); font-weight: 600; align-self: center; }
.heat-c { aspect-ratio: 1; border-radius: 3px; background: var(--bg); }
.heat-c[style] { background: color-mix(in srgb, var(--pc) calc(var(--a) * 100%), var(--bg)); cursor: help; }
.slot-list, .next-list, .tips { list-style: none; margin: 0 0 14px; padding: 0; }
.slot-list li { display: grid; grid-template-columns: 120px 36px 1fr; gap: 8px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line); font-size: 13px; }
.score { display: inline-block; background: color-mix(in srgb, var(--pc, var(--accent)) 18%, transparent); color: var(--ink); font-weight: 700; font-size: 11.5px; border-radius: 10px; padding: 0 7px; text-align: center; margin-left: 6px; }
.slot-list .score { margin: 0; }
.next-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.next-list .time { font-weight: 700; color: var(--accent); margin-left: 4px; }
.tips li { padding: 5px 0 5px 16px; position: relative; font-size: 13.5px; }
.tips li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.time-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.time-chips .chip { font: inherit; font-size: 12px; cursor: pointer; }
#best-note { display: block; margin-top: 6px; line-height: 1.45; }

.ai-box { border: 1px solid transparent; border-radius: 12px; padding: 14px; margin-bottom: 14px; background:
  linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(135deg, #d97757, #b0569e) border-box; }
.ai-box-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ai-box .check { margin-top: 4px; }
.ai-results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.ai-cap { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-cap-head { display: flex; justify-content: space-between; font-size: 12.5px; }
.ai-cap-head span { color: var(--muted); }
.ai-cap-text { font-size: 14px; line-height: 1.6; white-space: normal; flex: 1; }
.ai-cap-tags { color: var(--accent); font-size: 12.5px; word-break: break-word; }
.ai-cap-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-tip { grid-column: 1 / -1; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
@media (max-width: 1150px) { .ai-cols, .ai-results, .lang-pick { grid-template-columns: 1fr; } }

/* ---------- v4: security + auto-posting ---------- */
.auth-body { display: block; }
.auth { max-width: 400px; margin: 9vh auto 40px; padding: 0 16px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.auth-card { padding: 26px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card p.muted { margin: 0 0 16px; }
.auth-foot { text-align: center; margin-top: 14px; }
.code-input { font-size: 22px; letter-spacing: .25em; text-align: center; }
.logout { margin: 0; }
.logout .bell { width: 100%; }

.sec-status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 12px; }
.sec-status > div { padding: 6px 12px; border-radius: 20px; font-size: 13px; background: var(--bg); }
.sec-status .ok { background: #dff4ea; color: #137a4c; }
.sec-status .mid { background: #fdeccd; color: #7a4700; }
.sec-status .bad { background: #fde3e5; color: #a1222d; }
@media (prefers-color-scheme: dark) { .sec-status .ok { background: #143829; color: #7fdcae; } .sec-status .mid { background: #3d2c0d; color: #f5c46b; } .sec-status .bad { background: #431a1e; color: #ff9aa2; } }
.steps { padding-left: 20px; line-height: 1.8; }
.big-key { font-size: 15px; letter-spacing: .08em; padding: 3px 8px; user-select: all; }
.inline-form { display: flex; gap: 8px; margin: 8px 0; }
.inline-form input { max-width: 200px; }
.codes-box { background: var(--bg); border: 2px dashed var(--accent); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.codes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.codes code { text-align: center; font-size: 14px; padding: 6px; background: var(--card); user-select: all; }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.log th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.log td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log tr.warn td { background: color-mix(in srgb, var(--red) 7%, transparent); }

.s-auto { background: #fff1d6; color: #8a5a00; }
@media (prefers-color-scheme: dark) { .s-auto { background: #3a2c10; color: #ffcf73; } }
.auto-tag { font-style: normal; margin-left: 2px; }
.auto-check { margin: 4px 0 8px; font-size: 13.5px; }
.err-banner { background: #fde3e5; color: #a1222d; }
@media (prefers-color-scheme: dark) { .err-banner { background: #431a1e; color: #ff9aa2; } }
.pr-err { font-size: 12.5px; color: var(--red); margin-top: 3px; }
.meta-card { margin-top: 14px; max-width: 820px; }
.meta-card .sec-status { padding: 0; }
.meta-page { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.meta-page form { margin: 0 0 0 auto; }
.copy-me { user-select: all; word-break: break-all; }
@media (max-width: 820px) { .codes { grid-template-columns: 1fr 1fr; } }
