:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --brand: #1f6feb; --brand-ink: #fff; --brand-soft: #e8f0fe;
  --ok: #137333; --ok-soft: #e6f4ea; --err: #b3261e; --err-soft: #fce8e6; --warn: #8a5300; --warn-soft: #fef3e0;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; }
nav { display: flex; gap: 4px; }
nav button { background: none; border: 0; padding: 7px 12px; border-radius: 8px; color: var(--muted); font: inherit; cursor: pointer; }
nav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.who { margin-left: auto; color: var(--muted); font-size: 13px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 10px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 5px; }
input[type=text], input[type=url], input[type=number], input[type=password], input[type=datetime-local], input[type=time], input:not([type]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.btn { border: 1px solid #cfd4dc; background: #fff; color: var(--ink); padding: 7px 13px; border-radius: 8px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input, .inline > select { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 160px; gap: 12px; }
.banner { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.err { background: var(--err-soft); color: var(--err); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.search { max-width: 280px; }

/* Dashboard */
.client-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.client-head .spacer { flex: 1; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { grid-column: 1 / -1; font-size: 13px; padding: 6px 10px; border-radius: 6px; }
.status.running { background: var(--brand-soft); color: var(--brand); }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.err { background: var(--err-soft); color: var(--err); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #eef0f3; color: var(--muted); vertical-align: middle; }
.pill.active { background: var(--ok-soft); color: var(--ok); }

/* Editor */
.step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.step.locked { opacity: .55; pointer-events: none; }
.step-body > label:first-of-type { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.radio { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 8px 0; cursor: pointer; }
.radio input { margin-top: 3px; }
.save-bar { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }

.log td { font-size: 12.5px; }
.log .ERROR { color: var(--err); font-weight: 600; }
.log .OK { color: var(--ok); font-weight: 600; }
details summary { cursor: pointer; color: var(--brand); margin-top: 10px; }
details ol { padding-left: 20px; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

dialog { border: 0; border-radius: 12px; padding: 20px; width: min(460px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(20,24,33,.4); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d2330; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 20; }
#toast.show { opacity: 1; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
}

a.btn { display: inline-block; text-decoration: none; }

/* Login page */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(380px, 100%); box-shadow: 0 6px 30px rgba(0,0,0,.06); }
.auth-card h1 { margin: 14px 0 6px; }
.auth-logo { margin-bottom: 4px; }
.auth-btn { width: 100%; margin-top: 18px; padding: 10px; }
.auth-card .banner { margin: 12px 0 0; }

/* Accounts */
.acct { display: flex; gap: 14px; align-items: flex-start; }
.acct-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; flex: none; }
.acct-icon.fb { background: #1877f2; }
.acct-icon.g { background: #0f9d58; }
.acct-body { flex: 1; min-width: 0; }
.acct-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c4c9d1; margin-right: 6px; }
.dot.on { background: var(--ok); }
.logout-form { margin: 0; }
.logout-form button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 7px 10px; border-radius: 8px; }
.logout-form button:hover { background: #f3f4f6; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------------- Post Cycle additions */
.logo-mark { background: #7c3aed; }
:root { --brand: #6d28d9; --brand-soft: #efe9fd; }
.grid2.even { grid-template-columns: 1fr 1fr; }

/* Dashboard rows */
.camp { display: grid; grid-template-columns: 56px minmax(0, 1.6fr) minmax(0, 1.3fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.camp .thumb { width: 56px; height: 56px; }
.camp h4 { margin: 0; font-size: 14.5px; }
.camp h4 a { color: var(--ink); text-decoration: none; }
.camp h4 a:hover { color: var(--brand); text-decoration: underline; }
.camp .acts { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.camp .msg { grid-column: 2 / -1; font-size: 12.5px; padding: 5px 9px; border-radius: 6px; background: var(--err-soft); color: var(--err); }
.next-line { font-size: 13px; }
.next-line b { font-weight: 600; }
.pill.paused { background: #eef0f3; color: var(--muted); }
.pill.err { background: var(--err-soft); color: var(--err); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 13px; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 99px; background: #c9ced6; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }

/* Thumbs */
.thumb { width: 72px; height: 72px; border-radius: 8px; background: #eef0f3; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 11px; position: relative; flex: none; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .kind { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; }

/* Schedule editor */
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button { border: 1px solid #cfd4dc; background: #fff; border-radius: 99px; padding: 5px 12px; font: inherit; cursor: pointer; color: var(--muted); }
.days button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.hours input { max-width: 130px; flex: 0 1 130px; }
.hours[aria-disabled=true], .sub[aria-disabled=true] { opacity: .45; pointer-events: none; }
.preview { margin-top: 12px; background: var(--brand-soft); color: var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.preview .slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.preview .slots span { background: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; }

/* Media list */
.media-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.mitem { display: grid; grid-template-columns: 28px 96px minmax(0, 1fr) auto; gap: 12px; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fff; }
.mitem.off { background: #fafafb; }
.mitem.off .thumb, .mitem.off textarea { opacity: .55; }
.mitem.next { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.mitem .num { font-weight: 700; color: var(--muted); text-align: center; padding-top: 4px; }
.mitem .thumb { width: 96px; height: 96px; cursor: zoom-in; }
.mitem .meta { min-width: 0; }
.mitem .meta .top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.mitem textarea { min-height: 60px; font-size: 13px; }
.mitem .side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.mitem .order { display: flex; gap: 4px; }
.pill.next { background: var(--brand); color: #fff; }
.drop { border: 2px dashed #cfd4dc; border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); margin-top: 10px; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.up { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-top: 8px; }
.up .prog { flex: 1; height: 6px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.up .prog i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.up.err { color: var(--err); }

dialog.viewer { width: auto; max-width: 92vw; padding: 10px; background: #111; }
dialog.viewer img, dialog.viewer video { max-width: 88vw; max-height: 82vh; display: block; }

@media (max-width: 760px) {
  .camp { grid-template-columns: 56px minmax(0, 1fr); }
  .camp .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .camp .msg { grid-column: 1 / -1; }
  .grid2.even { grid-template-columns: 1fr; }
  .mitem { grid-template-columns: 72px minmax(0, 1fr); }
  .mitem .num { display: none; }
  .step { grid-template-columns: 1fr; }
  .step-n { display: none; }
  .card { padding: 14px; }
  .mitem .thumb { width: 72px; height: 72px; }
  .mitem .side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; }
}

/* v2: schedule mode, plan, posts */
.inline.sub { margin: 0 0 6px 26px; }
.radio span b { font-weight: 600; }
.plan { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.plan .pi { border: 1px solid var(--line); border-radius: 8px; padding: 6px; font-size: 12px; min-width: 0; }
.plan .pi .thumb { width: 100%; height: 90px; margin-bottom: 6px; }
.plan .pi .t { font-weight: 600; }
.plan .day { grid-column: 1 / -1; font-weight: 600; font-size: 13px; margin-top: 4px; color: var(--muted); }
td .gone { color: var(--muted); }
@media (max-width: 760px) { .inline.sub { margin-left: 0; flex-wrap: wrap; } .plan { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
