/* B2B TV — админка. Тёмная тема в духе панели ЛоялСити, акценты — цвета логотипа. */
:root {
  --bg: #0b1120;
  --bg2: #0f172a;
  --card: #151f33;
  --card2: #1b2740;
  --line: #26344f;
  --line2: #33456a;
  --text: #e6ebf5;
  --muted: #8d9bb5;
  --dim: #5f6d88;
  --brand: #c026d3;
  --brand2: #7c3aed;
  --grad: linear-gradient(135deg, #d946ef 0%, #8b5cf6 55%, #6366f1 100%);
  --indigo: #6366f1;
  --green: #10b981;
  --green2: #34d399;
  --yellow: #f59e0b;
  --red: #ef4444;
  --cyan: #22d3ee;
  --orange: #fb923c;
  --r: 16px;
  --r2: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.45 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, .12), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(217, 70, 239, .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: #a5b4fc; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(192, 38, 211, .35); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.right { margin-left: auto; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 17, 32, .82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .2px; white-space: nowrap; }
.brand img { width: 40px; height: 40px; filter: drop-shadow(0 4px 12px rgba(217, 70, 239, .45)); }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px;
  color: var(--muted); font-weight: 600; white-space: nowrap; cursor: pointer; border: 0; background: none;
}
.tab:hover { color: var(--text); background: var(--card); text-decoration: none; }
.tab.on { color: #fff; background: var(--card2); box-shadow: inset 0 0 0 1px var(--line2); }
.tab.on svg { color: #e879f9; }
.top .me { margin-left: auto; display: flex; align-items: center; gap: 8px; }

main { max-width: 1320px; margin: 0 auto; padding: 22px 20px 80px; }
.page-h { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-h h1 { font-size: 24px; margin: 0; letter-spacing: -.3px; }
.page-h .sub { color: var(--muted); }

/* ---------- карточки ---------- */
.card {
  background: linear-gradient(180deg, rgba(27, 39, 64, .75), rgba(21, 31, 51, .9));
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px;
}
.card.hover { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card.hover:hover { border-color: #4b3b7a; transform: translateY(-2px); box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h3 svg { color: #e879f9; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  main { padding: 14px 12px 80px; }
  .top-in { padding: 8px 12px; gap: 10px; }
  .brand span { display: none; }
}

/* KPI */
.kpi { position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.kpi .val { font-size: 34px; font-weight: 800; letter-spacing: -1px; margin-top: 6px; line-height: 1.1; }
.kpi .val small { font-size: 16px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.kpi .note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi .glow { position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; filter: blur(40px); opacity: .35; }
.c-green { color: var(--green2); } .c-yellow { color: var(--yellow); } .c-red { color: #f87171; }
.c-indigo { color: #a5b4fc; } .c-brand { color: #f0abfc; } .c-cyan { color: var(--cyan); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card2);
  color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.pri { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(192, 38, 211, .3); }
.btn.green { background: #059669; border-color: transparent; color: #fff; }
.btn.red { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .45); color: #fca5a5; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn.big { padding: 16px 18px; font-size: 16px; border-radius: 14px; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--line2); background: var(--bg2); color: var(--muted); cursor: pointer; user-select: none;
}
.toggle.on.eco { background: rgba(16, 185, 129, .15); border-color: rgba(16, 185, 129, .5); color: var(--green2); }
.toggle.on.snd { background: rgba(99, 102, 241, .18); border-color: rgba(99, 102, 241, .55); color: #c7d2fe; }

/* ---------- поля ---------- */
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: #a855f7; box-shadow: 0 0 0 3px rgba(168, 85, 247, .18); }
textarea { width: 100%; min-height: 80px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
label.f input, label.f select, label.f textarea { color: var(--text); font-size: 14px; font-weight: 400; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type=search] { min-width: 240px; flex: 1; max-width: 380px; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: #c026d3; }

/* ---------- метки и точки ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(99, 102, 241, .15); color: #c7d2fe; border: 1px solid rgba(99, 102, 241, .3); white-space: nowrap; }
.tag.cat { background: rgba(217, 70, 239, .12); color: #f5d0fe; border-color: rgba(217, 70, 239, .3); }
.tag.ok { background: rgba(16, 185, 129, .13); color: #6ee7b7; border-color: rgba(16, 185, 129, .35); }
.tag.bad { background: rgba(239, 68, 68, .13); color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
.tag.warn { background: rgba(245, 158, 11, .14); color: #fcd34d; border-color: rgba(245, 158, 11, .35); }
.tag.grey { background: rgba(148, 163, 184, .1); color: var(--muted); border-color: var(--line2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--dim); }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(16, 185, 129, .2); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
.dot.warn { background: var(--yellow); box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }

/* ---------- списки ---------- */
.cat-h { margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .8px; }
.cat-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.list { display: flex; flex-direction: column; gap: 8px; }
.li {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r2);
  background: var(--card); border: 1px solid var(--line); cursor: pointer;
}
.li:hover { border-color: #4b3b7a; background: var(--card2); }
.li .t { font-weight: 700; }
.li .s { color: var(--muted); font-size: 12px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; min-width: 70px; }
.stat b { font-size: 16px; }
.stat span { color: var(--dim); font-size: 11px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; border: 1px dashed var(--line2); border-radius: var(--r); }

/* канал */
.ch-card { display: flex; flex-direction: column; gap: 12px; }
.ch-top { display: flex; gap: 12px; align-items: flex-start; }
.logo-box {
  width: 64px; height: 64px; flex: none; border-radius: 14px; background: #0a0f1c; border: 1px solid var(--line2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.logo-box img { max-width: 86%; max-height: 86%; object-fit: contain; }
.logo-box.big { width: 92px; height: 92px; border-radius: 18px; }
.logo-ph { color: var(--dim); font-weight: 800; font-size: 20px; }
.ch-name { font-weight: 800; font-size: 16px; line-height: 1.25; }
.ch-addr { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ch-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.ch-meta b { color: var(--text); font-size: 14px; }
.ch-foot { display: flex; gap: 6px; align-items: center; }

/* ---------- ролики (превью) ---------- */
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.clip { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; position: relative; }
.clip .pv { aspect-ratio: 16/9; background: #05080f center/cover no-repeat; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.clip .pv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip .pv .play { position: absolute; width: 38px; height: 38px; border-radius: 50%; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.clip .pv:hover .play { opacity: 1; }
.clip .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .7); padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.clip .ci { padding: 8px 10px; display: flex; gap: 6px; align-items: center; }
.clip .ci .t { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.clip .state { position: absolute; left: 6px; top: 6px; }

/* ---------- окна ---------- */
.overlay { position: fixed; inset: 0; background: rgba(3, 6, 14, .72); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; animation: fade .15s; }
.modal { width: 100%; max-width: 980px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: up .18s; }
.modal.narrow { max-width: 520px; }
.modal.wide { max-width: 1200px; }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg2); border-radius: 20px 20px 0 0; z-index: 2; }
.modal-h h2 { margin: 0; font-size: 18px; }
.modal-b { padding: 18px 20px 22px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; }
@media (max-width: 720px) { .overlay { padding: 0; } .modal { border-radius: 0; min-height: 100vh; } .modal-h { border-radius: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(12px); opacity: 0; } }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.subtab { padding: 10px 16px; cursor: pointer; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; }
.subtab.on { color: #fff; border-bottom-color: #d946ef; }
.subtab .cnt { margin-left: 6px; color: var(--dim); font-weight: 600; }

/* таблицы */
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 700; }
table.t td { padding: 9px 10px; border-bottom: 1px solid rgba(38, 52, 79, .6); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: rgba(255, 255, 255, .02); }
.scroll { max-height: 60vh; overflow-y: auto; }

/* полоски прогресса и диаграммы */
.bar { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--grad); }
.bar.green > i { background: linear-gradient(90deg, #059669, #34d399); }
.bar.warn > i { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar.red > i { background: linear-gradient(90deg, #dc2626, #f87171); }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .mh { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.meter .mh b { color: var(--text); }
.chart { width: 100%; height: 160px; }
.chart text { fill: var(--dim); font-size: 10px; }

/* приставка */
.prio { border: 1px solid rgba(217, 70, 239, .35); background: linear-gradient(180deg, rgba(192, 38, 211, .12), rgba(21, 31, 51, .9)); }
.prio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.prio-btn { padding: 16px 12px; border-radius: 14px; font-weight: 800; font-size: 15px; text-align: center; background: var(--card2); border: 1px solid var(--line2); cursor: pointer; min-height: 64px; color: var(--text); }
.prio-btn:hover { border-color: #d946ef; }
.prio-btn.on { background: var(--grad); border-color: transparent; color: #fff; }
.prio-btn small { display: block; font-weight: 600; color: var(--muted); font-size: 11px; margin-top: 4px; }
.prio-btn.on small { color: #fde4ff; }
.prio-nav { display: flex; gap: 10px; }
.prio-nav .btn { flex: 1; }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.actions .btn { justify-content: flex-start; padding: 12px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--muted); }
@media (max-width: 720px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv > div:nth-child(even) { margin-bottom: 8px; } }

/* задачи */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task.done .tt { text-decoration: line-through; color: var(--dim); }
.task input { margin-top: 3px; width: 18px; height: 18px; accent-color: #10b981; }

/* всплывашки */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card2); border: 1px solid var(--line2); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); animation: up .2s; max-width: 380px; }
.toast.ok { border-color: rgba(16, 185, 129, .5); }
.toast.err { border-color: rgba(239, 68, 68, .55); }

/* вход */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 30px; text-align: center; }
.login img { width: 120px; filter: drop-shadow(0 10px 30px rgba(217, 70, 239, .5)); }
.login h1 { margin: 6px 0 4px; font-size: 22px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; text-align: left; }

.spin { width: 18px; height: 18px; border: 2px solid var(--line2); border-top-color: #d946ef; border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; color: var(--muted); }
video.player { width: 100%; max-height: 70vh; background: #000; border-radius: 12px; }
.screens { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.screens img { width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.upl { border: 1px dashed var(--line2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* --- правки после просмотра (10.10): ничего не должно уезжать за край на телефоне --- */
.grid > *, .row > *, .col > * { min-width: 0; }
.actions .btn { white-space: normal; text-align: left; line-height: 1.25; }
.prio-nav { flex-wrap: wrap; }
@media (max-width: 720px) {
  .prio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prio-btn { font-size: 14px; padding: 14px 8px; }
  .prio-nav .btn.big { padding: 14px 10px; font-size: 15px; flex: 1 1 30%; }
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-b { padding: 14px 12px 20px; }
  .card { padding: 14px; }
  .filters input[type=search] { min-width: 0; max-width: none; width: 100%; }
  .filters select { flex: 1 1 45%; }
  .li { flex-wrap: wrap; }
  .stat { min-width: 56px; }
  table.t { font-size: 13px; }
  .page-h h1 { font-size: 20px; }
}
.scroll { overflow-x: auto; }

/* --- включённый приоритет: видно издалека (забытый приоритет = заведение смотрит только рекламу) --- */
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .55); } 50% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); } }
.prio-alert { border: 2px solid #f59e0b; background: linear-gradient(135deg, rgba(245, 158, 11, .22), rgba(239, 68, 68, .14)); animation: pulse 2s infinite; margin-bottom: 14px; }
.prio-alert h3 { color: #fde68a; font-size: 17px; }
.prio-alert h3 svg { color: #fbbf24; }
.card.prio-on { border: 2px solid #f59e0b; animation: pulse 2s infinite; }
.tag.prio { background: #f59e0b; color: #1a1205; border-color: #f59e0b; }
.tag.exp { background: rgba(251, 146, 60, .15); color: #fdba74; border-color: rgba(251, 146, 60, .4); }
