/* content-publisher — تم روشن، شبیه تقویم انتشار Buffer */
:root{
  --bg:#f4f5f7; --card:#fff; --ink:#111827; --muted:#6b7280; --line:#e5e7eb;
  --accent:#178a5a; --accent-ink:#0f6b46; --accent-soft:#e7f5ee;
  --radius:14px; --shadow:0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: system-ui, -apple-system, "Segoe UI", Tahoma, "Vazirmatn", sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font)}
a{color:inherit;text-decoration:none}
h1,h2{margin:0}
.muted{color:var(--muted)}
.small{font-size:12px}
.num{font-variant-numeric:tabular-nums}
code{background:#f3f4f6;padding:2px 6px;border-radius:6px}

/* ---------- shell ---------- */
.shell{display:grid;grid-template-columns:264px 1fr;min-height:100vh}
.side{background:var(--card);border-left:1px solid var(--line);padding:16px;display:flex;flex-direction:column;gap:14px;position:sticky;top:0;height:100vh}
.brandline{display:flex;align-items:center;gap:8px;font-size:17px}
.logo{width:26px;height:26px;display:grid;place-items:center;background:var(--accent);color:#fff;border-radius:8px}
.brandpick select{width:100%;padding:8px;border:1px solid var(--line);border-radius:10px;background:#fafafa}
.newbtn{display:block;text-align:center;background:var(--accent);color:#fff;padding:10px;border-radius:999px;font-weight:700}
.nav{display:flex;flex-direction:column;gap:2px}
.nav a{padding:9px 12px;border-radius:10px;color:#374151}
.nav a:hover{background:#f3f4f6}
.nav a.on{background:#eef0f3;font-weight:700}
.foot{margin-top:auto;display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--line);padding-top:12px}
.who{display:flex;flex-direction:column;line-height:1.3}
.who span{color:var(--muted);font-size:12px}
.ghost{color:var(--muted);font-size:13px}
.main{padding:22px 26px}

/* ---------- topbar / toolbar ---------- */
.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;gap:12px;flex-wrap:wrap}
.topbar .left{display:flex;align-items:center;gap:10px}
.topbar h1{font-size:22px}
.topbar .right{display:flex;align-items:center;gap:8px}
.sq{width:34px;height:34px;display:grid;place-items:center;background:#fff;border:1px solid var(--line);border-radius:10px}
.chip{background:#eef0f3;border-radius:999px;padding:4px 12px;font-size:13px;color:#374151}
.seg{padding:7px 14px;border-radius:999px;border:1px solid var(--line);background:#fff;font-size:14px}
.seg.on{background:var(--accent);color:#fff;border-color:var(--accent)}
.newpill{background:var(--accent);color:#fff;padding:8px 16px;border-radius:999px;font-weight:700;font-size:14px}
.toolbar{display:flex;align-items:center;gap:8px;margin-bottom:12px}
.toolbar .spacer{flex:1}
.nav-btn{width:32px;height:32px;display:grid;place-items:center;border:1px solid var(--line);border-radius:9px;background:#fff}
.range{font-size:15px}
.btn{border:1px solid var(--line);background:#fff;border-radius:9px;padding:6px 12px;font-size:14px}

/* ---------- cards / tables / forms ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px}
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.card + .card{margin-top:14px}
table.list{width:100%;border-collapse:collapse}
table.list th,table.list td{text-align:right;padding:10px 8px;border-bottom:1px solid var(--line);font-size:14px}
table.list th{color:var(--muted);font-weight:600;font-size:13px}
form.stack{display:flex;flex-direction:column;gap:14px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
label{display:flex;flex-direction:column;gap:6px;font-size:13px;color:#374151}
label.wide{grid-column:1/-1}
input,select,textarea{border:1px solid var(--line);border-radius:10px;padding:9px 11px;font:inherit;background:#fff;color:var(--ink)}
textarea{resize:vertical}
input:focus,select:focus,textarea:focus{outline:2px solid var(--accent-soft);border-color:var(--accent)}
button{background:var(--accent);color:#fff;border:0;border-radius:10px;padding:10px 16px;font:inherit;font-weight:700;cursor:pointer}
button.danger{background:#dc2626}
button.mini{padding:4px 10px;font-size:12px;font-weight:600}
.inlineform{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;margin-bottom:14px}
.inlineform .grow{flex:1;min-width:180px}
.chanhead{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.chanhead b{font-size:15px}
.chanhead span{color:var(--muted);font-size:13px}
.sw{margin-right:auto;flex-direction:row;align-items:center;gap:6px}
.ok{background:var(--accent-soft);color:var(--accent-ink);border:1px solid #bfe3d0;padding:9px 12px;border-radius:10px;margin-bottom:12px}
.err{background:#fdecea;color:#a52121;border:1px solid #f5c2c0;padding:9px 12px;border-radius:10px}
.pill{display:inline-block;padding:3px 10px;border-radius:999px;font-size:12px;background:#eef0f3;color:#374151}
.pill.published{background:#e7f5ee;color:#0f6b46}
.pill.checked{background:#f2fbf6;color:#4f9d78}
.pill.failed{background:#fdecea;color:#a52121}
.pill.queued,.pill.publishing{background:#fdf0dd;color:#9a5b06}
.fx{color:#0f6b46}
.fv{color:#9a5b06}
.page{font-size:19px;margin:18px 0 6px}

/* PSD cards */
.psd .psdname{font-weight:700;margin-bottom:6px}
.psd .meta{color:var(--muted);font-size:12px;margin:8px 0}
.psd form{margin:0}

/* ---------- calendar ---------- */
.mon{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px;font-size:13px}
.calwrap{padding:0;overflow:auto;max-height:calc(100vh - 210px)}
.cal{--row:46px;direction:ltr;min-width:900px}
/* حالت دستی: کاربر عرض ستون را با کلیدهای «±» عوض می‌کند */
.cal.manual{min-width:calc(64px + 7 * var(--colw, 120px))}
.cal.manual .calhead,.cal.manual .calbody{grid-template-columns:64px repeat(7, var(--colw, 120px))}
.colwctl{display:inline-flex;align-items:center;gap:6px;background:#fff;border:1px solid var(--line);
  border-radius:999px;padding:3px 10px}
.colwctl b{font-size:12px;min-width:46px;text-align:center}
.colwctl .mini{padding:3px 9px}
.calhead{display:grid;grid-template-columns:64px repeat(7,1fr);position:sticky;top:0;z-index:3;background:var(--card);border-bottom:1px solid var(--line)}
.calhead .gutter{border-right:1px solid var(--line)}
.dayhead{padding:8px 6px;text-align:center;border-right:1px solid var(--line);display:flex;flex-direction:column;gap:2px}
.dayhead.today{background:var(--accent-soft)}
.dayhead .dn{font-size:13px;color:var(--muted)}
.dayhead .dd{font-size:13px;font-weight:700}
.calbody{display:grid;grid-template-columns:64px repeat(7,1fr)}
.calbody > .gutter{border-right:1px solid var(--line)}
.hourlabel{height:var(--row);font-size:11px;color:var(--muted);padding:2px 6px 0;text-align:right;direction:rtl}
.daycol{position:relative;border-right:1px solid var(--line);height:calc(var(--row) * 24)}
.hline{height:var(--row);border-bottom:1px solid #f1f2f4}
.ev{position:absolute;left:4px;right:4px;direction:rtl;min-height:24px;border-radius:8px;padding:4px 7px;border-left:3px solid #ccc;box-shadow:0 1px 2px rgba(16,24,40,.06);overflow:hidden;display:flex;flex-direction:column;gap:1px;background:#eef0f3}
.ev .evt{font-size:11px;color:var(--muted)}
.ev .evn{font-size:12px;font-weight:700;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ev .evc{font-size:10px;color:var(--muted);direction:ltr}
.ev.published{background:#e7f5ee}
.ev.checked{background:#f2fbf6}
.ev.planned{background:#eef2ff}

/* باکس‌های گروهی تقویم: چند مورد در یک ساعت، زیر هم و بدون هم‌پوشانی */
.dayhead .dcount{margin-top:3px;background:#eef0f3;border-radius:999px;font-size:10px;padding:1px 7px;color:#374151}
.evgrp{position:absolute;left:4px;right:4px;border-radius:8px;padding:2px 6px;
  background:#eef2ff;border:1px solid #cfd9f7;border-right:3px solid #2563eb;
  box-shadow:0 1px 2px rgba(16,24,40,.06);direction:rtl}
.evgrp:hover{z-index:60}
.evgrp.published{background:#e7f5ee;border-color:#bfe3d0;border-right-color:#16a34a}
.evgrp.checked{background:#f2fbf6;border-color:#cdeadd;border-right-color:#7cc7a3}
.evgrp.failed{background:#fdecea;border-color:#f5c2c0;border-right-color:#dc2626}
.evgrp.queued,.evgrp.publishing{background:#fdf0dd;border-color:#f0dcb4;border-right-color:#d97706}
.evrow{display:flex;align-items:center;gap:4px;height:14px;line-height:14px;min-width:0}
.evrow .evt{font-size:9.5px;color:var(--muted);flex:0 0 28px;width:28px;direction:ltr;text-align:center}
.evdot{width:5px;height:5px;border-radius:50%;flex:0 0 5px}
.evrow .evn{font-size:11px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;min-width:0}
.evrow .evc{font-size:9.5px;color:var(--muted);direction:ltr;flex:0 1 auto;min-width:0;max-width:52px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* راهنمای هاور: پنل ثابت پایین صفحه — هرگز برش نمی‌خورد و همیشه کامل دیده می‌شود */
.evrow{position:relative}
.evtip{display:none;position:fixed;right:18px;bottom:18px;width:min(430px,86vw);max-height:56vh;overflow:auto;
  background:#111827;color:#f9fafb;border-radius:12px;padding:11px 13px;z-index:200;
  box-shadow:0 14px 40px rgba(16,24,40,.35);direction:rtl;text-align:right;
  white-space:pre-wrap;pointer-events:none;font-weight:400}
.evrow:hover .evtip{display:block}
.evtip b{display:block;color:#fff;font-size:13px}
.evtip .tipmeta{display:block;color:#cbd5e1;font-size:11px;margin-top:2px}
.evtip .tiptext{display:block;margin-top:7px;padding-top:7px;border-top:1px solid #374151;
  color:#e5e7eb;font-size:12px;line-height:2}

/* ---------- login ---------- */
.loginbody{display:grid;place-items:center;min-height:100vh;background:var(--bg)}
.login{background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow);padding:28px;width:340px;display:flex;flex-direction:column;gap:12px}
.loginlogo{width:44px;height:44px;display:grid;place-items:center;background:var(--accent);color:#fff;border-radius:12px;font-size:22px}
.login h1{font-size:20px}
.login label{font-size:13px}
.login button{margin-top:6px}

@media(max-width:820px){
  .shell{grid-template-columns:1fr}
  .side{position:static;height:auto;border-left:0;border-bottom:1px solid var(--line)}
  .grid2{grid-template-columns:1fr}
}

/* ---------- nav group (تنظیمات برند) ---------- */
.navgroup>summary{list-style:none;cursor:pointer;padding:9px 12px;border-radius:10px;color:#374151;display:flex;align-items:center;justify-content:space-between}
.navgroup>summary::-webkit-details-marker{display:none}
.navgroup>summary::after{content:"▾";font-size:11px;color:var(--muted);transition:transform .15s}
.navgroup[open]>summary::after{transform:rotate(180deg)}
.navgroup>summary:hover{background:#f3f4f6}
.navgroup>summary.on{background:#eef0f3;font-weight:700}
.subnav{display:flex;flex-direction:column;gap:1px;margin:2px 0 2px 10px;border-right:2px solid var(--line);padding-right:6px}
.subnav a{padding:6px 10px;border-radius:8px;font-size:13px;color:#4b5563}
.subnav a:hover{background:#f3f4f6}
.subnav a.on{background:var(--accent-soft);color:var(--accent-ink);font-weight:700}
/* ---------- per-path accordion ---------- */
.pathcard{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);margin-bottom:10px;overflow:hidden}
.pathcard>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:10px;padding:14px 16px}
.pathcard>summary::-webkit-details-marker{display:none}
.pathcard>summary::before{content:"›";color:var(--muted);font-size:18px;transition:transform .15s}
.pathcard[open]>summary::before{transform:rotate(90deg)}
.pathcard>summary:hover{background:#fafafa}
.ptitle{font-weight:700}
.pdot{width:9px;height:9px;border-radius:50%;margin-right:auto}
.pdot.on{background:#16a34a}
.pdot.off{background:#cbd5e1}
.pathcard .stack{padding:0 16px 16px}
.roww{display:flex;align-items:center;gap:14px}
.roww .sw{margin-right:0}

/* ---------- brand-maker designs ---------- */
.designs{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}
.design{display:flex;flex-direction:column;gap:8px}
.design .thumb{display:block;background:#0d0f13;border-radius:10px;overflow:hidden;border:1px solid var(--line)}
.design .thumb img{display:block;width:100%;height:230px;object-fit:contain;background:#0d0f13}
.dtitle{font-weight:700}
.vars{border-top:1px solid var(--line);padding-top:8px;display:flex;flex-direction:column;gap:4px;max-height:190px;overflow:auto}
.vhead{font-size:12px;color:var(--muted);font-weight:600}
.var{display:flex;justify-content:space-between;gap:8px;font-size:12px}
.vname{color:#374151}
.vdef{color:var(--accent-ink);background:var(--accent-soft);border-radius:6px;padding:1px 8px;max-width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---------- path sections (stacked, not collapsed) ---------- */
.pathhead{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--line)}
.pathcard .stack{padding:14px 16px}
.pathcard.hl{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft), var(--shadow)}
.design{cursor:pointer;transition:box-shadow .15s,border-color .15s}
.design:hover{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft),var(--shadow)}
.design .dtitle{font-size:15px}
a.design{color:inherit}

/* ---------- published list ---------- */
.pub{display:flex;flex-direction:column;gap:8px}
.pubrow{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.pubrow>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:10px;padding:12px 14px}
.pubrow>summary::-webkit-details-marker{display:none}
.pubrow>summary::before{content:"›";color:var(--muted);font-size:18px;transition:transform .15s}
.pubrow[open]>summary::before{transform:rotate(90deg)}
.pubrow>summary:hover{background:#fafafa}
.pubtitle{font-weight:700;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pubbody{display:flex;gap:16px;padding:12px 16px 16px;align-items:flex-start;border-top:1px solid var(--line)}
.pubimg{flex:0 0 auto;width:170px;border-radius:10px;overflow:hidden;border:1px solid var(--line);background:#0d0f13}
.pubimg img{display:block;width:100%;aspect-ratio:4/5;height:auto;max-height:300px;object-fit:contain}
.pubtext{white-space:pre-wrap;line-height:1.9;font-size:14px;color:#374151;flex:1}

/* ---------- live prices in brand settings ---------- */
.prices{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:8px 0 10px}
.pchip{display:inline-flex;align-items:baseline;gap:6px;background:var(--accent-soft);color:var(--accent-ink);
  border:1px solid #bfe3d0;border-radius:999px;padding:5px 12px;font-size:13px}
.pchip small{color:var(--muted)}
.curprice{font-size:13px;color:#374151;background:#f7f9fb;border:1px dashed var(--line);border-radius:9px;padding:7px 10px}
.curprice b{color:var(--accent-ink)}

/* ---------- superadmin panel ---------- */
.tenantcard{border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);background:#fff;padding:14px;display:flex;flex-direction:column;gap:10px}
.tenantcard .thead{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.tenantcard .thead .spacer{flex:1}
.tstats{display:flex;gap:6px;flex-wrap:wrap}
.tenantcard .inlineform{margin:0}
.cred{background:#fbfcfe}
.credhead{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.credhead code{font-size:12px}
.kv{display:grid;grid-template-columns:auto 1fr;gap:4px 10px;align-items:center;font-size:13px}
.kv .k{color:var(--muted)}
.copyable{background:#f3f4f6;user-select:all}
.checks{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:8px}
.chk{flex-direction:row;align-items:flex-start;gap:8px;background:#fafbfc;border:1px solid var(--line);border-radius:10px;padding:8px 10px;cursor:pointer}
.chk input{margin-top:2px}
.info{display:flex;flex-direction:column;gap:6px}
.inforow{display:flex;gap:10px;align-items:baseline;font-size:13px}
.inforow b{min-width:110px;color:#374151}
.savebar{padding-top:12px;gap:12px;flex-wrap:wrap}
table.list input[type=checkbox]{width:16px;height:16px;accent-color:var(--accent)}
.btnlink{display:inline-block;background:#fff;color:var(--accent-ink);border:1px solid var(--accent);
  border-radius:10px;padding:5px 13px;font-size:12px;font-weight:700;margin-inline-start:6px;cursor:pointer;white-space:nowrap}
.btnlink:hover{background:var(--accent-soft)}

/* ---------- feedback ---------- */
.notif{background:#fff8e6;border:1px solid #f0d9a0;color:#7a5a10;border-radius:10px;padding:10px 14px;margin-bottom:12px}
.notif a{color:#7a5a10;font-weight:700;text-decoration:underline}
.fbroom{display:flex;flex-direction:column;gap:10px}
.fbroom.fbfresh{border-color:#f0c76a;box-shadow:0 0 0 2px #fdf3d8}
.freshchip{background:#fdf3d8;color:#8a6410}
.fbthread{display:flex;flex-direction:column;gap:8px}
.fbmsg{border-radius:10px;padding:9px 12px;max-width:760px}
.fbmsg.fbuser{background:#f2f6fb;border:1px solid #dbe6f3}
.fbmsg.fbadmin{background:var(--accent-soft);border:1px solid #bfe3d0;margin-inline-start:24px}
.fbmeta{display:flex;align-items:center;gap:8px;margin-bottom:4px;font-size:12px}
.fbtext{white-space:pre-wrap;line-height:1.9;font-size:14px}
.fbform{margin:0;align-items:flex-end}
.fbform textarea{max-width:560px}
pre.preview{background:#0f172a;color:#e2e8f0;border-radius:10px;padding:14px;white-space:pre-wrap;line-height:2;
  font-family:var(--font);font-size:14px;margin:0;direction:rtl;text-align:right;max-width:760px}

/* ---------- sample output page (posters shown at story size) ---------- */
.samples{display:grid;grid-template-columns:repeat(auto-fill,240px);gap:16px;justify-content:start}
.samplecard{display:flex;flex-direction:column;gap:8px}
.samplehead{display:flex;align-items:center;gap:8px;justify-content:space-between;font-size:13px}
.samplecard img{display:block;width:100%;aspect-ratio:4/5;height:auto;max-height:360px;object-fit:contain;
  border-radius:10px;border:1px solid var(--line);background:#0d0f13}
.samplecard:hover img{border-color:var(--accent)}
.samplecaption{white-space:pre-wrap;font-size:13px;line-height:1.9;background:#f7f9fb;
  border:1px dashed var(--line);border-radius:9px;padding:8px 10px;color:#374151}
