/* bugs v4 — баг-репорты. Все классы с префиксом bg-, чтобы не задеть стили трекера. */
.bg-ui { --bg-c: #15151c; --bg-c2: #1c1c25; --bg-in: #101016; --bg-t: #eeeef4; --bg-m: #9a9ab0; --bg-l: #2e2e3a; --bg-a: #6f6fff; --bg-ok: #3ad6a0; --bg-bad: #ff7070; --bg-on: #26264a; --bg-shadow: rgba(0,0,0,.55);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-size: 14px; color: var(--bg-t); box-sizing: border-box; }
/* светлая тема трекера (html[data-theme=light]) */
html[data-theme="light"] .bg-ui { --bg-c: #fff; --bg-c2: #f4f6f9; --bg-in: #fff; --bg-t: #1b2230; --bg-m: #6b7486; --bg-l: #dde2ea; --bg-a: #2f6bff; --bg-ok: #16a34a; --bg-bad: #dc2626; --bg-on: #e7efff; --bg-shadow: rgba(15,23,42,.22); }
.bg-ui *, .bg-ui *::before, .bg-ui *::after { box-sizing: border-box; }
.bg-ui .hidden, .bg-ui.hidden { display: none !important; }
html.bg-capturing .bg-ui:not(.bg-recbar) { visibility: hidden !important; }

/* кнопка 🐞 */
.bg-fab { position: fixed; right: 18px; bottom: 18px; z-index: 2147483000; }
.bg-fabbtn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--bg-l); background: var(--bg-c); box-shadow: 0 6px 20px var(--bg-shadow);
  font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; position: relative; touch-action: none; transition: transform .15s; }
.bg-fabbtn:hover { transform: scale(1.07); }
.bg-fabdot { position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg-bad); border: 2px solid var(--bg-c); }
.bg-menu { position: absolute; right: 0; bottom: 56px; width: 280px; background: var(--bg-c); border: 1px solid var(--bg-l); border-radius: 12px;
  box-shadow: 0 16px 40px var(--bg-shadow); padding: 6px; }
.bg-mtitle { font-weight: 700; padding: 8px 10px 6px; }
.bg-menu button { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; font: inherit; color: inherit; }
.bg-menu button:hover { background: var(--bg-c2); }
.bg-menu small { flex-basis: 100%; color: var(--bg-m); font-size: 12px; padding-left: 24px; }
.bg-mic { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--bg-m); padding: 0 10px 6px 34px; cursor: pointer; }
.bg-msep { height: 1px; background: var(--bg-l); margin: 4px 6px; }
.bg-mnote { font-size: 12px; color: var(--bg-m); padding: 4px 10px 8px; }
.bg-mcnt, .bg-acnt, .bg-navcnt { margin-left: auto; background: var(--bg-bad); color: #fff; border-radius: 10px; font-size: 11.5px; font-weight: 700; padding: 1px 7px; }
.bg-mcnt { background: var(--bg-a); }

/* общие элементы */
.bg-modal { position: fixed; inset: 0; z-index: 2147483100; background: rgba(15,23,42,.5); display: grid; place-items: center; padding: 16px; }
.bg-box { background: var(--bg-c); border: 1px solid var(--bg-l); border-radius: 14px; box-shadow: 0 24px 60px var(--bg-shadow); width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 18px 20px; }
.bg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.bg-head h3, .bg-box h3 { margin: 0; font-size: 18px; }
.bg-x { margin-left: auto; border: 0; background: var(--bg-c2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--bg-t); }
.bg-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--bg-l); background: var(--bg-c); color: var(--bg-t); border-radius: 8px; padding: 8px 12px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; text-decoration: none; }
.bg-btn:hover { background: var(--bg-c2); }
.bg-primary, .bg-primary:hover { background: var(--bg-a); border-color: var(--bg-a); color: #fff; }
.bg-ok { color: var(--bg-ok); border-color: color-mix(in srgb, var(--bg-ok) 45%, transparent); } .bg-bad { color: var(--bg-bad); border-color: color-mix(in srgb, var(--bg-bad) 45%, transparent); } .bg-del { color: var(--bg-m); }
.bg-muted { color: var(--bg-m); font-size: 12.5px; }
.bg-sp { flex: 1; }
.bg-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.bg-empty { color: var(--bg-m); padding: 18px; text-align: center; }
.bg-ui input:not([type=checkbox]):not([type=file]), .bg-ui textarea { width: 100%; border: 1px solid var(--bg-l) !important; border-radius: 8px !important; padding: 8px 10px !important; font: inherit !important;
  color: var(--bg-t) !important; -webkit-text-fill-color: var(--bg-t) !important; caret-color: var(--bg-t) !important; background: var(--bg-in) !important; opacity: 1 !important; box-shadow: none; }
.bg-ui input:not([type=checkbox]):not([type=file]):focus, .bg-ui textarea:focus { border-color: var(--bg-a) !important; outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bg-a) 25%, transparent) !important; }
.bg-ui input::placeholder, .bg-ui textarea::placeholder { color: var(--bg-m) !important; -webkit-text-fill-color: var(--bg-m) !important; opacity: .8 !important; }
.bg-ui textarea { resize: vertical; }
.bg-ui label { display: block; font-size: 12.5px; color: var(--bg-m); font-weight: 500; }
.bg-ui label > input, .bg-ui label > textarea { margin-top: 4px; }

/* форма репорта */
.bg-form.bg-away { visibility: hidden; }
.bg-form.bg-drop .bg-box { outline: 3px dashed var(--bg-a); outline-offset: -8px; }
.bg-path { background: var(--bg-c2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.bg-plabel { font-weight: 600; margin-bottom: 8px; }
.bg-pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bg-url { margin-top: 6px; word-break: break-all; }
.bg-clabel { margin-bottom: 10px; }
.bg-adds { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.bg-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.bg-items .bg-empty { grid-column: 1 / -1; border: 1px dashed var(--bg-l); border-radius: 10px; padding: 14px; }
.bg-item { border: 1px solid var(--bg-l); border-radius: 10px; overflow: hidden; position: relative; background: var(--bg-c2); }
.bg-item img, .bg-item video, .bg-filebox { display: block; width: 100%; height: 100px; object-fit: cover; background: #0b0f17; }
.bg-item img { cursor: zoom-in; }
.bg-filebox { display: grid; place-items: center; font-size: 34px; background: var(--bg-c2); }
.bg-badge { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11.5px; border-radius: 6px; padding: 2px 6px; }
.bg-iname { font-size: 11.5px; color: var(--bg-m); padding: 5px 8px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-iact { display: flex; gap: 4px; padding: 5px 6px 6px; }
.bg-iact button { border: 1px solid var(--bg-l); background: var(--bg-c); border-radius: 6px; font-size: 12px; padding: 3px 7px; cursor: pointer; color: var(--bg-t); }
.bg-iact button:last-child { margin-left: auto; }
.bg-progress { margin-top: 12px; height: 26px; background: var(--bg-c2); border-radius: 8px; position: relative; overflow: hidden; }
.bg-progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--bg-a) 35%, transparent); transition: width .2s; }
.bg-progress span { position: relative; font-size: 12.5px; line-height: 26px; padding-left: 10px; }
.bg-foot { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.bg-busy .bg-foot button, .bg-busy .bg-adds { opacity: .5; pointer-events: none; }

/* панель записи */
.bg-recbar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 2147483200; display: flex; align-items: center; gap: 8px;
  background: #111827; color: #fff; border-radius: 999px; padding: 7px 8px 7px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.bg-recbar b { font-variant-numeric: tabular-nums; min-width: 44px; }
.bg-recbar button { border: 0; border-radius: 999px; padding: 7px 12px; cursor: pointer; font: inherit; font-weight: 600; background: #374151; color: #fff; }
.bg-recbar .bg-rdone { background: #22c55e; color: #052e14; }
.bg-recbar .bg-rcancel { background: transparent; color: #9ca3af; padding: 7px 9px; }
.bg-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: bg-blink 1s infinite; }
.bg-recbar.paused .bg-dot { animation: none; background: #f59e0b; }
@keyframes bg-blink { 50% { opacity: .25; } }

/* разметка скрина */
.bg-annot { position: fixed; inset: 0; z-index: 2147483300; background: #0b0f17; display: flex; flex-direction: column; }
.bg-atool { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; background: #151b27; border-bottom: 1px solid #263044; }
.bg-agrp { display: flex; gap: 4px; align-items: center; padding-right: 8px; border-right: 1px solid #263044; }
.bg-agrp:last-child { border-right: 0; }
.bg-aend { margin-left: auto; }
.bg-atool button { min-width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: #222b3b; color: #e5e7eb; cursor: pointer; font: inherit; font-size: 16px; padding: 0 10px; }
.bg-atool button.on { border-color: #7aa2ff; background: #2a3a5c; }
.bg-atool .bg-sw { min-width: 26px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #3b4558; padding: 0; }
.bg-atool .bg-sw.on { border-color: #fff; box-shadow: 0 0 0 2px #7aa2ff; }
.bg-atool [data-w] i { display: block; width: 18px; background: #e5e7eb; border-radius: 4px; }
.bg-atool .bg-primary { background: var(--bg-a); color: #fff; font-size: 14px; font-weight: 600; }
.bg-atool [data-act] { font-size: 14px; }
.bg-astage { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 4px; }
.bg-astage canvas { cursor: crosshair; box-shadow: 0 0 0 1px #263044, 0 10px 40px rgba(0,0,0,.5); touch-action: none; background: #fff; }
.bg-ahint { color: #9aa4b6; font-size: 12.5px; text-align: center; padding: 6px 10px 10px; }
.bg-atext { position: fixed; z-index: 2147483400; min-width: 180px; border: 2px solid #7aa2ff !important; background: rgba(0,0,0,.7) !important; font: 600 16px Inter, Arial, sans-serif !important; padding: 4px 6px !important; border-radius: 6px; outline: none; }

/* кадр из видео, вопросы */
.bg-vgrab video { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; margin-top: 10px; }
.bg-ask .bg-box { width: min(520px, 100%); }
.bg-ask textarea, .bg-ask .bg-pgrid { margin-top: 12px; }

/* мои репорты */
.bg-mine .bg-box { width: min(640px, 100%); }
.bg-mrow { border: 1px solid var(--bg-l); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.bg-mtext { margin-top: 6px; white-space: pre-wrap; }
.bg-st { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 2px 8px; margin-left: 4px; }
.st-open { background: #fff4d6; color: #92600a; } .st-done { background: #dcfce7; color: #166534; } .st-rej { background: #fee2e2; color: #991b1b; }
.bg-note { margin-top: 8px; background: var(--bg-c2); border-left: 3px solid var(--bg-a); padding: 6px 10px; border-radius: 6px; font-size: 13px; white-space: pre-wrap; }
.bg-crumb { color: var(--bg-m); font-size: 12.5px; margin-top: 4px; }
.bg-crumb span { color: var(--bg-t); font-weight: 500; }
.bg-crumb a, .bg-link { margin-left: 8px; color: var(--bg-a); text-decoration: none; font-size: 12.5px; border: 0; background: none; cursor: pointer; padding: 0; font-family: inherit; }

/* админ: вкладка «Баг-репорты» */
.bg-admin { position: fixed; inset: 0; z-index: 2147482900; background: var(--bg-c2); display: flex; flex-direction: column; }
.bg-ahead { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--bg-c); border-bottom: 1px solid var(--bg-l); flex-wrap: wrap; }
.bg-ahead h2 { margin: 0; font-size: 19px; }
.bg-buckets { display: flex; gap: 4px; background: var(--bg-c2); padding: 3px; border-radius: 10px; }
.bg-buckets button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; color: var(--bg-m); }
.bg-buckets button.on { background: var(--bg-c); color: var(--bg-t); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.bg-buckets span { font-weight: 700; margin-left: 2px; }
.bg-search { max-width: 280px; }
.bg-abody { flex: 1; display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 0; }
.bg-topics { overflow: auto; padding: 12px; border-right: 1px solid var(--bg-l); background: var(--bg-c); }
.bg-ttitle { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--bg-m); font-weight: 600; padding: 4px 8px 8px; }
.bg-topics button { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--bg-t); }
.bg-topics button span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bg-topics button b { font-size: 12px; background: var(--bg-c2); border-radius: 10px; padding: 1px 8px; }
.bg-topics button:hover { background: var(--bg-c2); }
.bg-topics button.on { background: var(--bg-on); color: var(--bg-a); }
.bg-cards { overflow: auto; padding: 16px 18px 40px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.bg-card { background: var(--bg-c); border: 1px solid var(--bg-l); border-radius: 12px; padding: 14px 16px; max-width: 1100px; transition: opacity .25s, transform .25s; }
.bg-card.bg-gone { opacity: 0; transform: translateX(30px); }
.bg-card header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bg-author { font-weight: 600; }
.bg-author i { font-style: normal; font-weight: 500; color: var(--bg-m); font-size: 12px; margin-left: 6px; }
.bg-card header .bg-st { margin-left: auto; }
.bg-comment { margin-top: 10px; white-space: pre-wrap; line-height: 1.5; overflow-wrap: anywhere; }
.bg-shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bg-shots img { height: 150px; max-width: 100%; border-radius: 8px; border: 1px solid var(--bg-l); cursor: zoom-in; object-fit: cover; }
.bg-vid { margin-top: 12px; }
.bg-vid video { width: 100%; max-width: 720px; max-height: 420px; background: #000; border-radius: 8px; display: block; margin-bottom: 4px; }
.bg-files { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.bg-files a { color: var(--bg-a); }
.bg-meta { margin-top: 10px; font-size: 12px; color: var(--bg-m); }
.bg-meta summary { cursor: pointer; }
.bg-card footer { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.bg-more { align-self: center; }
.bg-lightbox { position: fixed; inset: 0; z-index: 2147483500; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.bg-lightbox img { max-width: 100%; max-height: calc(100vh - 90px); border-radius: 6px; }
.bg-lightbox .bg-btn { position: fixed; top: 16px; right: 16px; }

/* пункт меню разделов */
.bg-navitem { display: flex; align-items: center; gap: 6px; border: 1px dashed color-mix(in srgb, currentColor 35%, transparent); background: transparent; color: inherit; border-radius: 8px; padding: 7px 10px; cursor: pointer; font: inherit; font-size: 13.5px; }
.bg-navitem.in-side { margin: 8px 10px; width: calc(100% - 20px); }
.bg-navitem:hover { background: rgba(47,107,255,.08); }

/* тост */
.bg-toast { position: fixed; left: 50%; top: 18px; transform: translate(-50%, -20px); opacity: 0; z-index: 2147483600; background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); transition: all .25s; font: 500 14px Inter, system-ui, sans-serif; max-width: min(560px, calc(100vw - 32px)); }
.bg-toast.on { opacity: 1; transform: translate(-50%, 0); }
.bg-toast.bad { background: #991b1b; }

@media (max-width: 760px) {
  .bg-pgrid { grid-template-columns: 1fr; }
  .bg-abody { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .bg-topics { max-height: 32vh; border-right: 0; border-bottom: 1px solid var(--bg-l); }
  .bg-search { max-width: none; flex-basis: 100%; }
  .bg-shots img { height: 110px; }
  .bg-box { padding: 14px; }
}

/* v2: выбор момента скрина */
.bg-mshot { padding: 6px 10px 8px; }
.bg-mshead { display: flex; flex-wrap: wrap; gap: 2px 6px; }
.bg-mshead small { flex-basis: 100%; color: var(--bg-m); font-size: 12px; padding-left: 24px; }
.bg-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 2px 22px; }
.bg-chips button { width: auto !important; border: 1px solid var(--bg-l) !important; background: var(--bg-c2) !important; color: var(--bg-t) !important; border-radius: 999px !important;
  padding: 5px 11px !important; font: 500 12.5px Inter, system-ui, sans-serif !important; cursor: pointer; }
.bg-chips button:hover { border-color: var(--bg-a) !important; color: var(--bg-a) !important; }
.bg-shotwrap { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bg-shotwrap .bg-chips { padding: 0; }
.bg-waitbar .bg-wtext { font-weight: 500; padding-right: 4px; }
.bg-waitbar .bg-wtext b { font-variant-numeric: tabular-nums; }
/* v2: инструменты «Область» и «Ластик» */
.bg-atool [data-tool="crop"], .bg-atool [data-tool="eraser"], .bg-atool [data-act="uncrop"] { font-size: 13.5px; }
/* v411: выпадающие списки с поиском (раздел / страница / вкладка) */
.bg-combo { position: relative; }
.bg-combo > input { padding-right: 28px !important; background-image: linear-gradient(45deg, transparent 50%, var(--bg-m) 50%), linear-gradient(135deg, var(--bg-m) 50%, transparent 50%) !important;
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55% !important; background-size: 5px 5px !important; background-repeat: no-repeat !important; cursor: pointer; }
.bg-combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 280px; overflow: auto; background: var(--bg-c); border: 1px solid var(--bg-l);
  border-radius: 10px; box-shadow: 0 14px 34px var(--bg-shadow); padding: 4px; }
.bg-opt { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--bg-t); font-size: 13.5px; font-weight: 400; }
.bg-opt small { color: var(--bg-m); font-size: 11.5px; }
.bg-opt.on, .bg-opt:hover { background: var(--bg-c2); }
.bg-opt.sel span { font-weight: 600; color: var(--bg-a); }
.bg-optnone { padding: 9px 10px; color: var(--bg-m); font-size: 12.5px; }
