:root {
  --bg: #0f1218;
  --panel: #171b23;
  --panel2: #1e232d;
  --line: #2a303c;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --green: #2fbf71;
  --red: #ef5a5a;
  --yellow: #e9b949;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
h2 { font-size: 18px; margin: 18px 0 8px; }
h3 { font-size: 15px; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.grow { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; }
nav { display: flex; gap: 4px; }
nav button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; font: inherit; }
nav button.active, nav button:hover { color: var(--text); background: var(--panel2); }
.sync-box { margin-left: auto; display: flex; align-items: center; gap: 10px; }

main { padding: 16px 20px 60px; max-width: 1800px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--red); }
.btn.ghost { background: none; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: wait; }

input, select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
select.inline { padding: 3px 6px; font-size: 13px; }
label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
label input, label select { color: var(--text); font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.presets { display: flex; gap: 4px; }
.presets button { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); padding: 6px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.presets button.active { color: #fff; border-color: var(--accent); }
#search { min-width: 220px; }

.crumbs { display: flex; gap: 6px; align-items: center; margin: 4px 0 12px; font-size: 15px; }
.crumbs a { color: var(--accent); cursor: pointer; text-decoration: none; }
.crumbs span.sep { color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi .v { font-size: 20px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }

.notice { background: rgba(233, 185, 73, .1); border: 1px solid rgba(233, 185, 73, .4); color: var(--yellow); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.chart-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; height: 240px; margin-bottom: 12px; }

.table-wrap { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-height: 70vh; }
table.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.grid th { position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-weight: 500; font-size: 12px; cursor: pointer; user-select: none; z-index: 1; }
.grid th.l, .grid td.l { text-align: left; }
.grid tr:hover td { background: rgba(79, 140, 255, .05); }
.grid tfoot td { font-weight: 600; background: var(--panel2); position: sticky; bottom: 0; }
.grid.small td, .grid.small th { padding: 5px 8px; font-size: 12.5px; }
.grid td.name { max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.grid td.name a { color: var(--text); cursor: pointer; text-decoration: none; }
.grid td.name a:hover { color: var(--accent); }
.grid td.wrap { white-space: normal; min-width: 260px; text-align: left; }
.sub { color: var(--muted); font-size: 11.5px; display: block; overflow: hidden; text-overflow: ellipsis; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.budget { cursor: pointer; border-bottom: 1px dashed var(--muted); }
.budget:hover { color: var(--accent); }
.budget-input { width: 90px; padding: 3px 6px; }

.switch { position: relative; width: 34px; height: 18px; display: inline-block; cursor: pointer; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #3a4150; border-radius: 18px; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch.busy { opacity: .4; pointer-events: none; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--green); border-color: rgba(47, 191, 113, .4); }
.badge.err { color: var(--red); border-color: rgba(239, 90, 90, .4); }
.badge.test { color: var(--yellow); border-color: rgba(233, 185, 73, .4); }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h3:first-child { margin-top: 0; }

.rules-list { display: grid; gap: 10px; }
.rule { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 16px; align-items: center; }
.rule .info { flex: 1; }
.rule .title { font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.rule .desc { color: var(--muted); font-size: 13px; margin-top: 4px; }
.rule .btns { display: flex; gap: 6px; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 50; display: flex; justify-content: center; align-items: flex-start; overflow: auto; padding: 30px 16px; }
.modal-body { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; width: 860px; max-width: 100%; }
.modal-body h2 { margin-top: 0; }
.modal-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.cond, .win { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.cond select:first-child { min-width: 220px; }
.cond input { width: 120px; }
.days { display: flex; gap: 3px; }
.days label { margin: 0; flex-direction: row; }
.days input { display: none; }
.days span { display: inline-block; padding: 5px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-size: 12px; }
.days input:checked + span { color: #fff; background: var(--accent); border-color: var(--accent); }
.win input[type=time] { width: 110px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips label { margin: 0; flex-direction: row; }
.chips input { display: none; }
.chips span { display: inline-block; padding: 4px 10px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-size: 12.5px; }
.chips input:checked + span { color: #fff; border-color: var(--accent); background: rgba(79, 140, 255, .25); }
#previewRes { margin-top: 12px; }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 100; max-width: 480px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }
.toast.err { border-color: var(--red); color: #ffb4b4; }
.toast.ok { border-color: var(--green); }

@media (max-width: 900px) {
  .cards, .grid2, .grid3 { grid-template-columns: 1fr; }
  main { padding: 12px 16px 60px; }
  .rule { flex-direction: column; align-items: flex-start; }
}

/* ---- v2: вход, роли, гео, балансы ---- */
.auth { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }
.auth-box { width: 360px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.auth-box .btn { width: 100%; margin-top: 6px; }
.brand.big { font-size: 20px; margin-bottom: 4px; }
textarea { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; resize: vertical; }
body:not(.is-admin) .admin-only { display: none !important; }
.small-modal { width: 560px; }
.card.narrow { max-width: 640px; }
.toolbar label.check { margin: 0; color: var(--muted); }
.grid tr.group td { background: var(--panel2); font-weight: 600; text-align: left; color: var(--text); }
.grid tr.group td span { color: var(--muted); font-weight: 400; margin-left: 8px; }
.geo { display: inline-block; min-width: 26px; padding: 1px 6px; border-radius: 5px; background: rgba(79, 140, 255, .15); color: #9fc0ff; font-size: 12px; text-align: center; }
.vert { display: inline-block; padding: 1px 6px; border-radius: 5px; background: rgba(233, 185, 73, .12); color: var(--yellow); font-size: 12px; }
.badge.rej { color: var(--red); border-color: rgba(239, 90, 90, .4); margin-left: 6px; }
.badge.warn { color: var(--yellow); border-color: rgba(233, 185, 73, .4); margin-left: 6px; }
tr.inactive td { opacity: .55; }
.low { color: var(--red); font-weight: 600; }
#whoami { margin-left: 8px; }

/* ---- v3: светлая тема ---- */
:root[data-theme="light"] {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel2: #eef1f6;
  --line: #dde2ea;
  --text: #1b2230;
  --muted: #667085;
  --accent: #2f6fec;
  --green: #12924f;
  --red: #d63a3a;
  --yellow: #a86b0c;
  color-scheme: light;
}
:root[data-theme="light"] .geo { color: #2553b5; background: rgba(47, 111, 236, .12); }
:root[data-theme="light"] .switch span { background: #c5ccd8; }
:root[data-theme="light"] .toast { box-shadow: 0 6px 24px rgba(20, 30, 50, .15); }
:root[data-theme="light"] .modal { background: rgba(20, 30, 50, .35); }

/* ---- компактные KPI + панель над таблицей ---- */
.kpis { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 10px; }
.kpi { padding: 7px 10px; }
.kpi .v { font-size: 16px; }
.chart-wrap { height: 210px; }
.toolbar { gap: 8px; margin-bottom: 10px; }
.tablebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.tablebar .crumbs { margin: 0; font-size: 13.5px; }
.tablebar label.check { margin: 0; color: var(--muted); font-size: 13px; }
.tablebar + .table-wrap { border-top-left-radius: 0; border-top-right-radius: 0; }
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 4px 10px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.seg button.active { background: var(--accent); color: #fff; }
.seg button:not(.active):hover { color: var(--text); }
#btnBack:disabled { opacity: .35; cursor: default; }
.btn.icon { font-size: 15px; line-height: 1; padding: 5px 8px; }
.btn.on { border-color: var(--accent); color: var(--accent); }

.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-width: 220px; max-height: 60vh; overflow: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.menu label { flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 4px 6px; color: var(--text); border-radius: 6px; cursor: grab; }
.menu label:hover { background: var(--panel2); }
.menu label.dragover { outline: 1px dashed var(--accent); }
.menu .menu-foot { display: flex; justify-content: space-between; gap: 6px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }

.grid th[draggable="true"] { cursor: grab; }
.grid th.dragging { opacity: .4; }
.grid th.dragover { box-shadow: inset 2px 0 0 var(--accent); }

/* ---- тесный режим ---- */
body.dense { font-size: 13px; }
body.dense main { padding: 10px 12px 40px; }
body.dense .top { padding: 6px 12px; }
body.dense .grid th, body.dense .grid td { padding: 3px 7px; font-size: 12.5px; }
body.dense .grid td.name { max-width: 300px; }
body.dense .sub { display: inline; margin-left: 6px; }
body.dense .kpi { padding: 5px 8px; }
body.dense .kpi .l { font-size: 11px; }
body.dense .kpi .v { font-size: 14px; }
body.dense .kpis { gap: 6px; margin-bottom: 8px; }
body.dense .btn, body.dense input, body.dense select { padding: 4px 8px; }
body.dense .switch { transform: scale(.85); }
body.dense .card { padding: 12px; }

/* ---- логотип ---- */
.brand { display: flex; align-items: center; gap: 8px; }
.logo { display: inline-flex; width: 26px; height: 26px; flex: none; }
.logo.lg { width: 34px; height: 34px; }
.logo svg { width: 100%; height: 100%; overflow: visible; }
.logo .dollar { font: 700 7px/1 -apple-system, sans-serif; fill: #8dff3c; opacity: 0; animation: ll-rise 2.4s ease-out infinite; }
.logo .dollar.d2 { animation-delay: .8s; }
.logo .dollar.d3 { animation-delay: 1.6s; }
.logo .bubble { fill: #d9ffb8; opacity: 0; animation: ll-bubble 1.6s ease-in infinite; }
.logo .bubble.b2 { animation-delay: .5s; }
.logo .bubble.b3 { animation-delay: 1s; }
.logo .wave { animation: ll-wave 2s ease-in-out infinite alternate; }
@keyframes ll-rise { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx, 0px), -12px); opacity: 0; } }
@keyframes ll-bubble { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: .9; } 100% { transform: translateY(-8px); opacity: 0; } }
@keyframes ll-wave { from { transform: translateX(-2px); } to { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .logo * { animation: none !important; } .logo .dollar { opacity: .8; } }
:root[data-theme="light"] .switch input:checked + span { background: var(--green); }
.presets button.active { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ---- v4: выбор строк и массовые действия ---- */
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; background: rgba(79, 140, 255, .1); border: 1px solid var(--accent); border-bottom: 0; }
.bulkbar .row-inline { display: inline-flex; align-items: center; gap: 6px; }
.grid th.sel, .grid td.sel { width: 28px; padding-right: 0; }
.grid td.sel input, .grid th.sel input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.grid tr.selected td { background: rgba(79, 140, 255, .1); }

/* ---- v5: график ---- */
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 8px; margin-bottom: 10px; }
.chart-card .chart-wrap { background: none; border: 0; padding: 0; margin: 0; height: 230px; border-radius: 0; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-title { font-weight: 600; font-size: 13.5px; }
.chart-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-item b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.lg-box { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }
.lg-line { width: 16px; height: 2px; border-radius: 2px; background: var(--c); display: inline-block; position: relative; }
.lg-line::after { content: ""; position: absolute; left: 4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--panel); }
.lg-ccy { font-size: 11.5px; }
body.dense .chart-card .chart-wrap { height: 190px; }

.notice a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---- v6: автозалив ---- */
.launch-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
.creo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; min-height: 60px; }
.creo-grid.dragover { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 10px; }
.creo { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: default; }
.creo .thumb { aspect-ratio: 1 / 1; background: #0003 center / cover no-repeat; display: flex; align-items: center; justify-content: center; }
.creo .thumb video { width: 100%; height: 100%; object-fit: cover; }
.creo .meta { padding: 5px 7px; font-size: 11.5px; line-height: 1.3; }
.creo .meta .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.creo .meta .sm { color: var(--muted); }
.creo .del { position: absolute; top: 4px; right: 4px; padding: 1px 6px; font-size: 12px; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 6px; cursor: pointer; }
.creo .kind { position: absolute; top: 4px; left: 4px; padding: 1px 6px; font-size: 10.5px; background: rgba(0,0,0,.55); color: #fff; border-radius: 6px; }
.creo-grid.pick .creo { cursor: pointer; }
.creo.picked { outline: 2px solid var(--accent); outline-offset: -2px; }
.creo.picked::after { content: "✓"; position: absolute; top: 4px; right: 6px; background: var(--accent); color: #fff; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.upload-btn { cursor: pointer; }
.tpl { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tpl:last-child { border-bottom: 0; }
.tpl .info { flex: 1; min-width: 0; }
.tpl .info .t { font-weight: 600; }
.tpl .info .d { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-inline { display: inline-flex; align-items: center; gap: 6px; }
.joblog { white-space: pre-wrap; font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); max-height: 160px; overflow: auto; text-align: left; margin: 0; }
@media (max-width: 1000px) { .launch-grid { grid-template-columns: 1fr; } }
:root[data-theme="light"] .chips input:checked + span { color: var(--accent); background: rgba(47, 111, 236, .12); }

/* ---- v7: запуски-таблица ---- */
.runs-head h2 { margin: 0; }
.runs-head p { margin: 2px 0 12px; }
.run-kpis { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.run-kpis > div { padding: 12px 16px; border-right: 1px solid var(--line); }
.run-kpis > div:last-child { border-right: 0; }
.run-kpis .l { color: var(--muted); font-size: 12.5px; }
.run-kpis .v { font-size: 24px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.run-kpis .s { color: var(--muted); font-size: 12px; }
.run-kpis .v.bad { color: var(--red); }
.prep-wrap { max-height: calc(100vh - 290px); }
table.prep { width: max-content; min-width: 100%; }
.grid.prep th, .grid.prep td { text-align: left; padding: 0; border-right: 1px solid var(--line); }
.grid.prep th { padding: 7px 8px; position: sticky; top: 0; white-space: nowrap; }
.grid.prep th .fill { visibility: hidden; margin-left: 4px; cursor: pointer; color: var(--accent); }
.grid.prep th:hover .fill { visibility: visible; }
.grid.prep td.stk, .grid.prep th.stk { position: sticky; left: 0; z-index: 2; background: var(--panel2); }
.grid.prep td.stk2, .grid.prep th.stk2 { position: sticky; left: 34px; z-index: 2; background: var(--panel2); }
.grid.prep th.stk, .grid.prep th.stk2 { z-index: 3; }
.grid.prep td.stk { width: 34px; text-align: center; }
.grid.prep td.stk2 { min-width: 76px; padding: 0 8px; color: var(--muted); font-size: 12px; }
.grid.prep .cell { width: 100%; height: 34px; border: 0; border-radius: 0; background: transparent; padding: 0 8px; font-size: 13px; color: var(--text); }
.grid.prep .cell:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--panel); }
.grid.prep select.cell { padding-right: 4px; }
.grid.prep .cell.ro { color: var(--muted); display: flex; align-items: center; }
.grid.prep .cell.chk { display: flex; align-items: center; justify-content: center; }
.grid.prep .cell.chk input { width: 15px; height: 15px; accent-color: var(--accent); }
.grid.prep .mbtn { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 34px; padding: 0 8px; cursor: pointer; font-size: 13px; white-space: nowrap; overflow: hidden; }
.grid.prep .mbtn .ph { color: var(--muted); }
.grid.prep .mbtn:hover { background: rgba(79, 140, 255, .08); }
.grid.prep tr.selected td { background: rgba(79, 140, 255, .08); }
.grid.prep tr.dirty td.stk2 { color: var(--yellow); }
.grid.prep tr.err td.stk2 { color: var(--red); }
.prep-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; }
.sep-v { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.small-note { font-size: 12px; margin-top: 0; }
.runact { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
.runact button, .runact a { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 3px; text-decoration: none; }
.runact button:hover, .runact a:hover { color: var(--accent); }
.joblog.big { max-height: 60vh; font-size: 12.5px; }
.pick-list { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }
.pick-list > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.pick-list > div:last-child { border-bottom: 0; }
.pick-list label { flex-direction: row; align-items: center; gap: 8px; margin: 0; color: var(--text); }

/* ---- v8: выпадающие ГЕО и языки, подсказки колонок ---- */
.pop { position: absolute; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, .3); width: 320px; }
.pop .pop-in { padding: 10px; border-bottom: 1px solid var(--line); }
.pop .pop-in input { width: 100%; }
.pop .pop-list { max-height: 300px; overflow: auto; padding: 4px 0; }
.pop .pop-list label { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; margin: 0; padding: 7px 12px; color: var(--text); cursor: pointer; font-size: 14px; }
.pop .pop-list label:hover { background: var(--panel2); }
.pop .pop-list label input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.pop .pop-list small { display: block; color: var(--muted); font-size: 12px; }
.pop .pop-foot { padding: 8px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.pop .pop-foot a { color: var(--muted); }
.tagbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--accent); border-radius: 8px; background: var(--panel); min-height: 40px; }
.tagbox input { border: 0; background: none; padding: 4px; flex: 1; min-width: 60px; outline: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; background: rgba(79, 140, 255, .15); font-size: 13px; }
.tag b { cursor: pointer; font-weight: 400; color: var(--muted); }
.flag { font-size: 15px; line-height: 1; }
.grid.prep .mbtn.geo { gap: 4px; justify-content: flex-start; }
.grid.prep th .hint, .grid.prep th .gear { margin-left: 5px; color: var(--muted); cursor: help; font-size: 12px; }
.grid.prep th .gear { cursor: pointer; }
.grid.prep th .gear.on { color: var(--accent); }
.grid.prep .cell[readonly] { color: var(--muted); }

.pop .pop-form { padding: 14px; display: grid; gap: 12px; }
.pop .pop-form label { margin: 0; gap: 6px; }
.pop .pop-form select { width: 100%; padding: 9px 10px; }
.pop .pop-form p { margin: 0; font-size: 12.5px; }

/* ---- v9: исключения гео ---- */
.pop.wide { width: 400px; }
.pop .pop-sec { padding: 10px 12px; border-top: 1px solid var(--line); }
.pop .pop-sec-t { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.pop .pop-sec .row-inline { display: flex; gap: 6px; }
.pop .pop-sec .row-inline input { flex: 1; }
.pop .pop-list.small { max-height: 180px; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; }
.pop .pop-list.small:empty { display: none; }
.pop .exr { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.pop .exr:last-child { border-bottom: 0; }
.pop .exr small { display: block; color: var(--muted); font-size: 11.5px; }
.pop .pad { padding: 8px 10px; }
.tags-ex { display: flex; flex-wrap: wrap; gap: 6px; }
.tag.ex { background: rgba(239, 90, 90, .14); }
.exb { margin-left: 4px; padding: 0 5px; border-radius: 5px; background: rgba(239, 90, 90, .16); color: var(--red); font-size: 11.5px; }

/* ---- v10: проверка строк ---- */
.grid.prep tr.warn td.stk2 { color: var(--yellow); }
.grid.prep tr.ok td.stk2 { color: var(--green); }
#logBody .ck { padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; color: var(--text); white-space: normal; }
#logBody .ck.ok { background: rgba(47, 191, 113, .1); }
#logBody .ck.bad { background: rgba(239, 90, 90, .1); }
#logBody .ck.warn { background: rgba(233, 185, 73, .12); }
#logBody .ck div { margin-top: 3px; }

/* ---- v11: папки креативов ---- */
.fcrumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 15px; font-weight: 600; }
.fcrumbs a { color: var(--accent); cursor: pointer; font-weight: 500; }
.fcrumbs a.dropover, .folder.dropover { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 6px; }
.fcrumbs .sep { color: var(--muted); font-weight: 400; }
.folder { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; }
.folder .ico { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; font-size: 46px; }
.folder .meta { padding: 5px 7px; font-size: 12px; }
.folder .meta .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.folder .meta .sm { color: var(--muted); font-size: 11.5px; }
.folder .fact { position: absolute; top: 4px; right: 4px; display: none; gap: 2px; }
.folder:hover .fact { display: flex; }
.folder .fact button { background: rgba(0,0,0,.5); color: #fff; border: 0; border-radius: 6px; padding: 1px 6px; cursor: pointer; font-size: 12px; }
.creo .csel { position: absolute; top: 5px; right: 30px; width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.creo.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.creo[draggable="true"] { cursor: grab; }
#creoBulk { border-radius: 8px; border-bottom: 1px solid var(--accent); margin: 8px 0; }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

/* кнопки в шапке библиотеки — ровно в одну линию */
.upload-btn { margin: 0; display: inline-flex; flex-direction: row; align-items: center; color: #fff; font-size: 12px; line-height: 1.45; }
#runsCreo .row-inline { display: inline-flex; align-items: center; gap: 8px; }
#runsCreo .row-inline .btn { height: 30px; display: inline-flex; align-items: center; }

#extensionTable td{padding:20px;white-space:normal}#extensionTable .ll-extension-status{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.ll-badge{border-radius:24px;padding:4px 12px;color:#46de81;background:#102b1c;font-size:13px}.ll-unbind{display:flex;justify-content:flex-end;margin-top:24px}#extensionTable .muted{margin-top:14px}

.ll-proxy{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-top:16px}.ll-proxy label{flex-basis:100%}.ll-proxy-value{display:block;flex-basis:100%;width:100%;min-width:0;min-height:84px;padding:12px;box-sizing:border-box;font:14px/1.5 monospace;background:var(--panel2);color:var(--text);border:1px solid var(--line);border-radius:8px;white-space:pre-wrap;overflow-wrap:anywhere;resize:vertical}
