/* Панель управления: поверх общих токенов site.css */
.panel { min-height: 100dvh; }
.panel [hidden] { display: none !important; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; transition: filter .2s, border-color .2s, color .2s;
}
.btn--accent { background: var(--accent); color: #1b1309; }
.btn--accent:hover { filter: brightness(1.08); }
.btn--ghost { border: 1px solid var(--line-2); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--danger { border: 1px solid rgba(230, 90, 80, .35); color: #ef8a80; }
.btn--danger:hover { border-color: #ef8a80; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--muted); border: 1px solid var(--line); }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn:disabled { opacity: .3; }

input, textarea, select {
  width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .2s;
  font-family: var(--font);
}
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
label.f { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .row2 { grid-template-columns: 1fr; } }

/* вход */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login__box { width: min(360px, 100%); display: grid; gap: 12px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-2); }
.login__box h1 { margin: 6px 0 6px; font-size: 22px; }
.login__err { min-height: 20px; margin: 0; color: #ef8a80; font-size: 13px; }
.login__back { justify-self: center; font-size: 14px; color: var(--muted); transition: color .2s; }
.login__back:hover { color: var(--text); }

/* шапка */
.a-top {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; padding: 12px var(--gutter);
  background: rgba(12, 11, 10, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.a-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.a-tabs button { padding: 8px 14px; border-radius: 99px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.a-tabs button.is-active { background: var(--surface-2); color: var(--text); }
.a-top__right { display: flex; align-items: center; gap: 12px; }
.disk { min-width: 160px; font: 500 11.5px/1.3 var(--mono); color: var(--muted); }
.disk__bar { height: 5px; margin-top: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.disk__bar span { display: block; height: 100%; background: var(--accent); }
.disk.is-low .disk__bar span { background: #ef8a80; }
@media (max-width: 800px) {
  .a-top { flex-wrap: wrap; }
  .a-tabs { order: 3; flex-basis: 100%; }
  .a-top__right { margin-left: auto; }
  .disk { min-width: 120px; }
}

.a-main { max-width: 1100px; margin: 0 auto; padding: 28px var(--gutter) 120px; }
.pane h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.pane .hint { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.card-a { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); padding: 18px; }
.card-a + .card-a { margin-top: 14px; }
.stack { display: grid; gap: 12px; }

/* загрузка */
.drop {
  display: grid; gap: 14px; padding: 22px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--bg-2);
  transition: border-color .2s, background .2s; margin-bottom: 26px;
}
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.drop__file { font-size: 14px; color: var(--muted); }
.drop__file b { color: var(--text); }
.upbar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.upbar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* видеотека */
.vlist { display: grid; gap: 10px; }
.vitem { display: grid; grid-template-columns: 132px 1fr auto; gap: 16px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
.vitem__thumb { width: 132px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--surface); position: relative; }
.vitem__thumb img { width: 100%; height: 100%; object-fit: cover; }
.vitem__thumb .tag { position: absolute; right: 6px; bottom: 6px; font: 500 10.5px/1 var(--mono); background: rgba(0,0,0,.65); padding: 3px 5px; border-radius: 4px; }
.vitem__body { min-width: 0; display: grid; gap: 6px; }
.vitem__titles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vitem__titles input { padding: 7px 10px; }
.vitem__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 400 12px/1.4 var(--mono); color: var(--dim); }
.vitem__meta .ok { color: #8fc79a; }
.vitem__meta .warn { color: var(--accent); }
.vitem__meta .bad { color: #ef8a80; }
.vitem__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.progress { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .5s; }
@media (max-width: 760px) {
  .vitem { grid-template-columns: 96px 1fr; }
  .vitem__thumb { width: 96px; }
  .vitem__titles { grid-template-columns: 1fr; }
  .vitem__actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* видеофон раздела */
.bgv { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.bgv__preview { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.bgv__preview video, .bgv__preview img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 700px) { .bgv { grid-template-columns: 1fr; } }
.bgv__preview { position: relative; }
.bgv__preview.is-off video, .bgv__preview.is-off img { opacity: .25; filter: grayscale(1); }
.bgv__badge { position: absolute; inset: auto 8px 8px; padding: 6px 8px; border-radius: 6px; background: rgba(10, 13, 19, .85); font-size: 12px; font-weight: 600; color: var(--text); text-align: center; }

/* переключатель */
.switch { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__ui { position: relative; width: 42px; height: 24px; flex: 0 0 auto; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line-2); transition: background .2s, border-color .2s; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + .switch__ui { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); background: #160d00; }
.switch input:focus-visible + .switch__ui { outline: 2px solid var(--blue); outline-offset: 2px; }

/* разделы */
.sec-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.sec-tabs button { padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 14px; color: var(--muted); }
.sec-tabs button.is-active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.subhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.subhead h3 { margin: 0; font-size: 18px; }
.media-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.media-pick img, .media-pick video { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--surface); }
.cat-a__head { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; }
.cat-a__videos { display: grid; gap: 6px; margin-top: 12px; }
.chip-v { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 6px; border-radius: 10px; background: var(--surface); }
.chip-v img { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.chip-v span { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-v .ctrl { display: flex; gap: 4px; }
.cat-a__add { margin-top: 10px; display: flex; gap: 8px; }
.cat-a__add select { flex: 1; }
@media (max-width: 700px) { .cat-a__head { grid-template-columns: 1fr; } }

/* фото и клиенты */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); padding: 10px; display: grid; gap: 8px; }
.tile__img { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface); display: grid; place-items: center; }
.tile__img img { width: 100%; height: 100%; object-fit: cover; }
.tile__img--logo { aspect-ratio: 3 / 2; background: #ece6dc; }
.tile__img--logo.is-dark { background: #1d1a17; }
.tile__img--logo img { object-fit: contain; }
.tile__ctrl { display: flex; gap: 4px; justify-content: space-between; align-items: center; }
.tile input[type=range] { padding: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.check input { width: auto; }

.savebar {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: 0 20px 60px -20px rgba(0,0,0,.8);
  font-size: 14px; max-width: calc(100% - 24px);
}
.savebar[hidden] { display: none; }
@media (max-width: 520px) { .savebar span { display: none; } }
.empty-a { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 14px; }

/* окно выбора обложки */
body.pm-open { overflow: hidden; }
.pmodal { position: fixed; inset: 0; z-index: 200; background: rgba(5, 7, 10, .78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.pmodal__box { width: min(1100px, 100%); min-width: 0; background: #11151c; border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px; padding: 20px 22px 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); }
.pmodal.is-busy .pmodal__box { cursor: progress; }
.pmodal.is-busy [data-pm-take], .pmodal.is-busy .pmodal__side label { opacity: .5; pointer-events: none; }
.pmodal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pmodal__head h3 { min-width: 0; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmodal__grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; align-items: start; }
.pmodal__video { background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
.pmodal__grid.is-vertical .pmodal__video { aspect-ratio: auto; height: min(62vh, 640px); }
.pmodal__video video { width: 100%; height: 100%; display: block; object-fit: contain; }
.pmodal__steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.pmodal__tc { min-width: 92px; text-align: center; font: 500 14px/1 var(--mono, monospace); color: var(--paper, #eef1f6); }
.pmodal__side { display: grid; gap: 12px; }
.pmodal__side .btn { width: 100%; justify-content: center; }
.pmodal__label { font-size: 13px; color: var(--mist, #9aa3b0); }
.pmodal__current { border-radius: 10px; overflow: hidden; background: #0a0d13; aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--mist, #9aa3b0); font-size: 13px; }
.pmodal__grid.is-vertical .pmodal__current { aspect-ratio: 9 / 16; max-height: 300px; }
.pmodal__current img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pmodal .hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 820px) {
  .pmodal { padding: 10px; place-items: start center; }
  .pmodal__box { padding: 16px; }
  .pmodal__grid { grid-template-columns: minmax(0, 1fr); }
  .pmodal__grid.is-vertical .pmodal__video { height: 56vh; }
  .pmodal__current { max-width: 260px; }
}
