:root {
  --bg: #0b0e13;
  --bg2: #0e1116;
  --panel: #141920;
  --panel2: #1a2029;
  --line: #232a35;
  --line2: #2d3542;
  --text: #e7ecf3;
  --muted: #8b95a5;
  --dim: #5d6777;
  --accent: #7c5cff;
  --accent2: #25f4ee;
  --good: #3ddc97;
  --bad: #ff5d6c;
  --warn: #ffb547;
  --yt: #ff3b3b;
  --ig: #e1306c;
  --fb: #2d88ff;
  --tt: #25f4ee;
  --th: #c9ced6;
  --r: 14px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(124, 92, 255, .35); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px; background: var(--bg2); border-right: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 17px; padding: 0 6px; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, #9b83ff, #4b2fd6); box-shadow: 0 0 24px rgba(124, 92, 255, .45); }
.logo-mark i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 10px var(--accent2); }
.ws-select { width: 100%; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.on { background: linear-gradient(90deg, rgba(124, 92, 255, .22), rgba(124, 92, 255, .04)); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-dots { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.chan-dot { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); padding: 4px 8px; }
.chan-dot b { margin-left: auto; font-family: var(--mono); font-weight: 500; color: var(--text); font-size: 12px; }

.main { padding: 26px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; font-weight: 750; }
.head p { margin: 2px 0 0; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #3b4555; background: var(--panel2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 20px -6px rgba(124, 92, 255, .7); }
.btn.primary:hover { background: #8d71ff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel); }
.btn.danger:hover { color: var(--bad); border-color: rgba(255, 93, 108, .5); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.chips { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.chips button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; }
.chips button.on { background: var(--panel2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset; }
.input, textarea.input, select.input { width: 100%; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .2); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 small { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .val { font-family: var(--mono); font-size: 27px; font-weight: 700; letter-spacing: -.03em; margin: 6px 0 4px; }
.kpi::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--glow, var(--accent)); opacity: .12; filter: blur(18px); }
.delta { font-size: 12.5px; font-weight: 600; font-family: var(--mono); }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--dim); }
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 220px; }

/* ---------- platform ---------- */
.pi { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; }
.pi svg { width: 16px; height: 16px; }
.pi.sm { width: 22px; height: 22px; border-radius: 7px; }
.pi.sm svg { width: 12px; height: 12px; }
.pi.youtube { background: var(--yt); }
.pi.instagram { background: linear-gradient(135deg, #feda75, #fa7e1e 25%, #d62976 55%, #962fbf 80%, #4f5bd5); }
.pi.facebook { background: var(--fb); }
.pi.tiktok { background: #000; box-shadow: inset 0 0 0 1px #2a2a2a; }
.pi.threads { background: #000; box-shadow: inset 0 0 0 1px #333; }
.pi.meta { background: linear-gradient(135deg, var(--fb), #d62976); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-family: var(--mono); font-size: 13px; }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--muted); }
.av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--panel2); flex: none; }
.tbl-wrap { overflow-x: auto; }

.post { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.post:last-child { border: 0; }
.post .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .m { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.rank { font-family: var(--mono); color: var(--dim); font-weight: 700; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--panel2); color: var(--muted); border: 1px solid var(--line2); }
.badge.good { color: var(--good); border-color: rgba(61, 220, 151, .35); background: rgba(61, 220, 151, .08); }
.badge.bad { color: var(--bad); border-color: rgba(255, 93, 108, .35); background: rgba(255, 93, 108, .08); }
.badge.warn { color: var(--warn); border-color: rgba(255, 181, 71, .35); background: rgba(255, 181, 71, .08); }
.badge.acc { color: #b4a3ff; border-color: rgba(124, 92, 255, .4); background: rgba(124, 92, 255, .1); }

/* ---------- connect ---------- */
.connect { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.conn { display: flex; flex-direction: column; gap: 12px; }
.conn p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.conn .top { display: flex; align-items: center; gap: 10px; font-weight: 650; }

/* ---------- planner ---------- */
.day { margin-bottom: 18px; }
.day h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.day h4::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sched { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.sched .time { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.sched .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.targets { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 10px; cursor: pointer; background: var(--bg2); }
.pick input { display: none; }
.pick.on { border-color: var(--accent); background: rgba(124, 92, 255, .1); }
.pick span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.drop { border: 1.5px dashed var(--line2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; }
.drop:hover { border-color: var(--accent); color: var(--text); }
.preview-media { max-height: 160px; max-width: 100%; border-radius: 10px; display: block; margin: 0 auto; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 7, 10, .7); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(680px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; padding: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.modal h2 { margin: 0 0 16px; font-size: 19px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 16px; border-radius: 11px; background: var(--panel2); border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: up .2s ease; }
.toast.err { border-color: rgba(255, 93, 108, .5); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(600px 400px at 20% 10%, rgba(124, 92, 255, .18), transparent 60%),
  radial-gradient(500px 360px at 85% 90%, rgba(37, 244, 238, .1), transparent 60%), var(--bg); }
.auth .card { width: min(400px, 100%); padding: 28px; }
.auth h1 { margin: 18px 0 4px; font-size: 22px; }
.auth p { margin: 0 0 20px; color: var(--muted); }
.plats { display: flex; gap: 6px; margin-top: 22px; justify-content: center; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.code { font-family: var(--mono); font-size: 12.5px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; word-break: break-all; }
.steps { margin: 0; padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
.steps b { color: var(--text); }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.burger { display: none; }

/* ---------- report ---------- */
.report { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; }
.report h2 { margin: 0; font-size: 22px; }
.report .sub { color: var(--muted); margin-bottom: 20px; }
.report .kpis { margin-bottom: 20px; }

@media print {
  .side, .head .row, .noprint { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  body { background: #fff; color: #111; }
  .report, .card { background: #fff; border-color: #ddd; color: #111; }
  .muted, th, .kpi .lbl { color: #555 !important; }
}

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .connect { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .6); }
  .burger { display: inline-flex; }
  .main { padding: 16px 16px 50px; }
  .kpis, .halves, .connect { grid-template-columns: 1fr 1fr; }
  .sched { grid-template-columns: 52px 1fr; }
  .sched > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .kpis, .halves, .connect { grid-template-columns: 1fr; }
  .kpi .val { font-size: 23px; }
}
