:root {
  --bg: #0e0f13;
  --panel: #16181f;
  --panel-2: #1d2029;
  --line: #2a2e3a;
  --text: #ecebe7;
  --muted: #8d91a0;
  --accent: #ff6a3d;
  --accent-soft: rgba(255, 106, 61, .14);
  --gold: #f5c451;
  --good: #4fd1a5;
  --warn: #f5c451;
  --bad: #ff5d6c;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 260px 1fr;
  font-size: 15px;
  line-height: 1.7;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- sidebar ---------- */
.side {
  position: sticky; top: 0; height: 100vh;
  border-left: 1px solid var(--line);
  padding: 24px 16px;
  display: flex; flex-direction: column; gap: 28px;
  background: linear-gradient(180deg, #13151b, var(--bg));
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; }
.brand b { font-size: 20px; font-weight: 900; display: block; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 12px; }
.mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--accent); transform: rotate(-6deg);
  box-shadow: 0 8px 24px rgba(255, 106, 61, .35);
}
.mark svg { width: 22px; fill: #fff; transform: scaleX(-1); }
nav { display: flex; flex-direction: column; gap: 4px; }
nav a {
  display: flex; gap: 12px; align-items: center; text-decoration: none;
  padding: 11px 14px; border-radius: 12px; color: var(--muted); font-weight: 500;
  transition: background .15s, color .15s;
}
nav a i { font-style: normal; width: 20px; text-align: center; }
nav a:hover { background: var(--panel); color: var(--text); }
nav a.on { background: var(--accent-soft); color: var(--accent); }
.channel-box { margin-top: auto; }
.chip-channel {
  display: flex; gap: 10px; align-items: center; padding: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.chip-channel img { width: 36px; height: 36px; border-radius: 50%; }
.chip-channel b { display: block; font-size: 14px; line-height: 1.3; }
.chip-channel button { margin-inline-start: auto; }

/* ---------- main ---------- */
main { padding: 32px 40px 60px; max-width: 1240px; width: 100%; min-width: 0; }
.grid > * { min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -.5px; }
.head p { margin: 2px 0 0; color: var(--muted); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px;
}
.card h3 { margin: 0 0 14px; font-size: 16px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g2 { grid-template-columns: 1fr 1fr; }
.g-main { grid-template-columns: 1.6fr 1fr; align-items: start; }
.mt { margin-top: 16px; }

.kpi { position: relative; overflow: hidden; }
.kpi small { color: var(--muted); }
.kpi .num { font-size: clamp(20px, 2.4vw, 30px); white-space: nowrap; font-weight: 900; line-height: 1.3; margin-top: 4px; }
.kpi:first-child { background: var(--accent); border-color: var(--accent); }
.kpi:first-child small { color: rgba(255, 255, 255, .8); }

.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.insights li {
  padding: 12px 14px; border-radius: 12px; background: var(--panel-2);
  border-right: 3px solid var(--muted);
}
.insights li.good { border-color: var(--good); }
.insights li.warn { border-color: var(--warn); }

/* bars */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 170px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar span { width: 100%; border-radius: 8px 8px 4px 4px; background: var(--panel-2); min-height: 4px; transition: height .4s; }
.bar.best span { background: var(--accent); }
.bar small { color: var(--muted); font-size: 12px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.hours div { aspect-ratio: 1; border-radius: 4px; background: var(--accent); }
.hours-lbl { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 4px 12px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.tag b { color: var(--accent); margin-inline-start: 4px; font-weight: 500; }

/* table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.vid { display: flex; gap: 12px; align-items: center; min-width: 0; }
.vid img { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--panel-2); flex: none; }
.vid a { text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid a:hover { color: var(--accent); }
.pill { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); }

/* forms */
label.f { display: block; margin-bottom: 16px; }
label.f > span { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; outline: none; transition: border-color .15s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.drop {
  border: 2px dashed var(--line); border-radius: 14px; padding: 22px; text-align: center; cursor: pointer;
  color: var(--muted); transition: border-color .15s, background .15s; display: block; margin-bottom: 16px;
}
.drop:hover, .drop.has { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop input { display: none; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--bg); padding: 5px; border-radius: 14px; border: 1px solid var(--line); margin-bottom: 16px; }
.seg label { text-align: center; padding: 8px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--muted); }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--accent); color: #fff; }
.hint { font-size: 12px; color: var(--muted); margin: -8px 0 16px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 12px; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: right .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { right: 21px; }

.btn {
  border: 0; border-radius: 12px; padding: 10px 18px; cursor: pointer; font-weight: 700;
  background: var(--accent); color: #fff; transition: transform .1s, filter .15s; text-decoration: none; display: inline-flex; gap: 8px; align-items: center;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(255, 93, 108, .35); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* preview */
.preview { position: sticky; top: 24px; }
.preview .thumb { aspect-ratio: 16/9; border-radius: 12px; background: var(--panel-2) center/cover; display: grid; place-items: center; color: var(--muted); margin-bottom: 12px; }
.preview .ttl { font-weight: 700; font-size: 16px; line-height: 1.5; word-break: break-word; }
.progress { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-top: 14px; display: none; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* queue */
.qitem { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.qitem:last-child { border-bottom: 0; }
.qitem .meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 99px; font-weight: 700; }
.b-scheduled { background: rgba(245, 196, 81, .15); color: var(--gold); }
.b-uploading { background: rgba(120, 160, 255, .15); color: #8fb0ff; }
.b-published, .b-scheduled-yt { background: rgba(79, 209, 165, .15); color: var(--good); }
.b-failed { background: rgba(255, 93, 108, .15); color: var(--bad); }
.err { color: var(--bad); font-size: 13px; }

/* rules */
.rule { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.rule .row:first-child { margin-bottom: 12px; }
.rule input[type=text] { background: var(--bg); }
.log-item { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log-item:last-child { border-bottom: 0; }
.log-item .c { color: var(--muted); }
.log-item .r { margin-top: 4px; padding-right: 12px; border-right: 2px solid var(--accent); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.hero { max-width: 620px; margin: 8vh auto; text-align: center; }
.hero h1 { font-size: 34px; font-weight: 900; margin: 0 0 8px; }
.hero ol { text-align: right; line-height: 2.2; color: var(--muted); }
.hero code { background: var(--panel-2); padding: 2px 8px; border-radius: 6px; color: var(--gold); direction: ltr; display: inline-block; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120px);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px; font-weight: 700;
  transition: transform .25s; z-index: 10; max-width: 90vw;
}
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }
.demo-banner { background: var(--accent-soft); color: var(--accent); border-radius: 12px; padding: 8px 14px; font-size: 13px; margin-bottom: 16px; }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .g-main, .g2 { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 720px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .seg label { font-size: 12px; padding: 8px 4px; }
  .side { min-width: 0; position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px 16px; gap: 12px; border-left: 0; border-bottom: 1px solid var(--line); }
  nav { flex-direction: row; overflow-x: auto; width: 100%; }
  nav a { white-space: nowrap; padding: 8px 12px; }
  .channel-box { display: none; }
  main { padding: 20px 16px 40px; }
  .table .hide-sm { display: none; }
  .vid img { width: 72px; }
}
