/* Панель управления. Стиль — панель управления сайта dosyagaeva.pro
   (public/css/admin.css): тёплый светлый фон, белые карточки, графит и золото,
   Manrope в тексте и Playfair Display в заголовках.
   Вёрстка от телефона: панелью пользуются с телефона на ходу, а на компьютере
   карточки просто встают в несколько колонок. */

:root {
  --a-bg: #f3efe7;
  --a-panel: #ffffff;
  --a-ink: #20201e;
  --a-muted: #7c7363;
  --a-line: #e4ddcf;
  --a-line-strong: #d6cdba;
  --a-gold: #b9954f;
  --a-gold-soft: #f3ead7;
  --a-graphite: #1f1f1f;
  --a-danger: #b6493a;
  --a-ok: #3f7a4f;
  --a-cream-deep: #efe7d8;
  --a-radius: 10px;
  --a-radius-sm: 7px;
  --a-font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --a-display: 'Playfair Display', Georgia, serif;
  --a-shadow: 0 18px 40px -28px rgba(31, 31, 31, 0.4);
  --a-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--a-font);
  color: var(--a-ink);
  background: var(--a-bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--a-gold); outline-offset: 2px; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background-color: var(--a-bg); }
::-webkit-scrollbar-thumb {
  background-color: var(--a-muted);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: var(--a-radius-sm);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--a-gold); }

/* ───────────────────────────── знак ───────────────────────────── */
.lb-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0;
  background: var(--a-graphite); color: var(--a-gold);
  border: 1px solid rgba(201, 168, 106, 0.5);
  font-family: var(--a-display); font-size: 0.95rem; letter-spacing: 1px;
}

/* ───────────────────────────── вход ───────────────────────────── */
.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 1.5rem; }
.login-card {
  width: 100%; max-width: 400px; background: var(--a-panel);
  border: 1px solid var(--a-line); border-radius: var(--a-radius);
  padding: 2.6rem 2.2rem; box-shadow: var(--a-shadow); text-align: center;
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 0.7rem; font-family: var(--a-display); font-size: 1.4rem; }
.login-sub { color: var(--a-muted); margin: 0.4rem 0 1.8rem; font-size: 0.9rem; }
.login-error { background: #fbe9e6; color: var(--a-danger); padding: 0.7rem 1rem; border-radius: var(--a-radius-sm); font-size: 0.88rem; margin-bottom: 1.2rem; text-align: left; }
.login-form { text-align: left; }
.login-foot { color: var(--a-muted); font-size: 0.8rem; margin: 1.4rem 0 0; }

/* ───────────────────────────── поля ───────────────────────────── */
.a-field { margin-bottom: 1.1rem; text-align: left; }
.a-field > label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--a-muted); margin-bottom: 0.4rem; letter-spacing: 0.01em; }
.a-help { font-size: 0.78rem; color: var(--a-muted); margin-top: 0.35rem; }
.a-input {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--a-ink);
  background: #fcfbf8; border: 1px solid var(--a-line-strong); border-radius: var(--a-radius-sm);
  padding: 0.62em 0.8em; transition: border-color 0.2s, box-shadow 0.2s;
}
.a-input:focus { outline: none; border-color: var(--a-gold); box-shadow: 0 0 0 3px var(--a-gold-soft); }
.a-input--code {
  font-size: 1.9rem; font-weight: 700; letter-spacing: 0.2em; text-align: center;
  color: var(--a-gold); font-variant-numeric: tabular-nums; padding: 0.4em 0.5em;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.1rem; }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }

/* ───────────────────────────── кнопки ───────────────────────────── */
.a-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font-family: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1;
  padding: 0.75em 1.1em; border-radius: var(--a-radius-sm); min-height: 40px;
  background: #fff; color: var(--a-ink); border: 1px solid var(--a-line-strong);
  transition: all 0.2s var(--a-ease); white-space: nowrap;
}
.a-btn:hover { border-color: var(--a-gold); color: var(--a-gold); }
.a-btn--primary { background: var(--a-graphite); color: #fff; border-color: var(--a-graphite); }
.a-btn--primary:hover { background: #000; color: #fff; border-color: #000; }
.a-btn--gold { background: var(--a-gold); color: #fff; border-color: var(--a-gold); }
.a-btn--gold:hover { background: #a9863f; color: #fff; border-color: #a9863f; }
.a-btn--danger { color: var(--a-danger); border-color: #e6c9c3; }
.a-btn--danger:hover { background: var(--a-danger); color: #fff; border-color: var(--a-danger); }
.a-btn--block { width: 100%; }
.a-btn--sm { padding: 0.5em 0.75em; font-size: 0.82rem; min-height: 32px; }
.a-btn[disabled] { opacity: 0.5; pointer-events: none; }
.a-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; flex-shrink: 0;
  border-radius: var(--a-radius-sm); border: 1px solid var(--a-line);
  background: #fff; color: var(--a-ink);
  transition: border-color 0.2s, color 0.2s;
}
.icon-btn:hover { border-color: var(--a-gold); color: var(--a-gold); }
.icon-btn[disabled] { opacity: 0.4; pointer-events: none; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.is-on { color: var(--a-gold); border-color: var(--a-gold); }

.link-btn {
  background: none; border: none; padding: 0; color: var(--a-gold);
  font-size: 0.82rem; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }

/* ───────────────────────────── шапка ───────────────────────────── */
/* Шапка и разделы прилипают к верху вместе */
.head { position: sticky; top: 0; z-index: 30; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  background: var(--a-graphite); color: #d7cfc0;
}
.tb-brand { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.tb-brand .lb-mark { width: 36px; height: 36px; }
.tb-brand b { display: block; font-family: var(--a-display); font-weight: 500; font-size: 1.05rem; color: #fbf7ef; line-height: 1.2; }
.tb-brand small { display: block; font-size: 0.72rem; color: #968c79; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-conn { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; color: #cfc6b6; margin-left: auto; white-space: nowrap; }
.tb-actions { display: flex; gap: 0.4rem; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 0.4em;
  background: none; border: 1px solid rgba(255, 255, 255, 0.16); color: #e9e1d2;
  border-radius: var(--a-radius-sm); padding: 0.5em 0.8em; font-size: 0.85rem; font-weight: 600;
  transition: all 0.2s;
}
.tb-btn:hover { border-color: var(--a-gold); color: var(--a-gold); }
.tb-btn svg { width: 16px; height: 16px; }
.tb-btn--gold { background: var(--a-gold); border-color: var(--a-gold); color: #fff; }
.tb-btn.is-attn { border-color: var(--a-gold); color: var(--a-gold); }
.mono { font-family: Consolas, 'Courier New', monospace; font-size: 0.82rem; overflow-wrap: anywhere; }
.tb-btn--gold:hover { background: #a9863f; border-color: #a9863f; color: #fff; }
@media (max-width: 640px) {
  .tb-btn .tb-label { display: none; }
  .tb-conn span { display: none; }
}

/* Открытый отель: название или выбор из списка, когда отелей несколько */
.tb-hotel { min-width: 0; display: flex; }
.tb-hotel:empty { display: none; }
.tb-hotel-name {
  font-size: 0.86rem; font-weight: 600; color: #fbf7ef;
  border-left: 1px solid rgba(255, 255, 255, 0.16); padding-left: 1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-hotel-select {
  max-width: 16rem; min-width: 0; font: inherit; font-size: 0.86rem; font-weight: 600;
  color: #fbf7ef; background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(201, 168, 106, 0.55); border-radius: var(--a-radius-sm);
  padding: 0.42em 0.6em; text-overflow: ellipsis;
}
.tb-hotel-select:focus { outline: none; border-color: var(--a-gold); }
.tb-hotel-select option { color: #1f1f1f; background: #fff; }
@media (max-width: 640px) {
  .tb-brand small { display: none; }
  .tb-hotel-name { padding-left: 0.7rem; }
  .tb-hotel-select { max-width: 9.5rem; }
}
/* Узкий телефон: от марки остаётся значок, место — названию отеля */
@media (max-width: 480px) {
  .tb-brand > span:last-child { display: none; }
  .tb-hotel { flex: 1 1 auto; }
  .tb-hotel-select { max-width: 100%; width: 100%; }
  .tb-hotel-name { border-left: none; padding-left: 0; }
}

/* Раздел «Видео»: ролики, загрузки, место под видео */
.vid-list { display: flex; flex-direction: column; gap: 0.6rem; }
.vid-row {
  display: flex; align-items: center; gap: 1rem;
  background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  padding: 0.85rem 1.1rem; box-shadow: var(--a-shadow);
}
.vid-row.is-bad { border-color: var(--a-danger); }
.vid-main { flex: 1; min-width: 0; }
.vid-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid-meta { color: var(--a-muted); font-size: 0.82rem; margin-top: 0.15rem; }
.vid-warn { color: #8a6420; font-size: 0.82rem; margin-top: 0.3rem; line-height: 1.4; }
.vid-actions { display: flex; gap: 0.9rem; flex-shrink: 0; }
.up-bar { height: 6px; background: var(--a-line); border-radius: 3px; overflow: hidden; margin-top: 0.45rem; }
.up-bar i { display: block; height: 100%; background: var(--a-gold); transition: width 0.3s; }
.storage { margin: -0.3rem 0 1.3rem; max-width: 26rem; }
.storage-text { font-size: 0.86rem; color: var(--a-muted); }
@media (max-width: 560px) {
  .vid-row { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .vid-actions { justify-content: flex-end; }
}

/* Ключ лицензии: моноширинный, чтобы его было легко сверить с письмом */
.a-input--key { font-family: Consolas, 'Courier New', monospace; letter-spacing: 0.04em; }

/* Ключи и отели сервера в окне лицензий */
.key-list { display: flex; flex-direction: column; margin-bottom: 0.9rem; }
.key-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem; flex-wrap: wrap;
  padding: 0.55rem 0; border-bottom: 1px solid var(--a-line); font-size: 0.9rem;
}
.key-actions { display: flex; gap: 0.8rem; }

/* Разделы — как пункты меню в кабинете сайта: активный залит золотом */
.tabs {
  display: flex; gap: 0.3rem; overflow-x: auto; scrollbar-width: none;
  padding: 0 clamp(1rem, 3vw, 2rem) 0.65rem;
  background: var(--a-graphite);
  border-bottom: 1px solid rgba(201, 168, 106, 0.25);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 0.5em; white-space: nowrap;
  background: none; border: none; color: #cfc6b6; font-size: 0.9rem; font-weight: 600;
  padding: 0.5em 0.9em; border-radius: var(--a-radius-sm);
  transition: background 0.2s, color 0.2s;
}
.tab:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.tab.is-active { background: var(--a-gold); color: #fff; }
.tab-n { background: rgba(255, 255, 255, 0.12); border-radius: 100px; font-size: 0.72rem; padding: 0.1em 0.55em; font-weight: 700; }
.tab.is-active .tab-n { background: rgba(0, 0, 0, 0.2); }
.tab-short { display: none; }
/* На узком телефоне все разделы должны помещаться без прокрутки */
@media (max-width: 480px) {
  .tab-full { display: none; }
  .tab-short { display: inline; }
  .tabs { gap: 0.1rem; }
  .tab { padding: 0.5em 0.6em; gap: 0.4em; }
  /* Счётчики — только у открытого раздела: иначе четыре вкладки не помещаются */
  .tab:not(.is-active) .tab-n { display: none; }
}

.offline {
  background: var(--a-gold-soft); color: #7a5f2c; border-bottom: 1px solid #ecdcc0;
  padding: 0.6rem clamp(1rem, 3vw, 2rem); font-size: 0.86rem;
}

/* ───────────────────────────── основное ───────────────────────────── */
.main { padding: 1.6rem clamp(1rem, 3vw, 2rem) calc(7rem + var(--safe-b)); max-width: 1320px; margin: 0 auto; }
.a-topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.a-topbar h1 { font-family: var(--a-display); font-weight: 500; font-size: 1.9rem; margin: 0; line-height: 1.1; }
.a-topbar .sub { color: var(--a-muted); font-size: 0.9rem; margin-top: 0.3rem; }
.a-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.7em;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--a-gold);
}
.eyebrow::before { content: ''; width: 24px; height: 1px; background: currentColor; opacity: 0.6; }

.chips { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.chip {
  border: 1px solid var(--a-line-strong); background: #fff; color: var(--a-ink);
  border-radius: 100px; padding: 0.42em 0.95em; font-size: 0.84rem; font-weight: 600;
  transition: all 0.2s;
}
.chip span { color: var(--a-muted); font-weight: 500; margin-left: 0.35em; }
.chip:hover { border-color: var(--a-gold); color: var(--a-gold); }
.chip.is-active { background: var(--a-gold); border-color: var(--a-gold); color: #fff; }
.chip.is-active span { color: rgba(255, 255, 255, 0.8); }

/* ───────────────────────── общий показ ───────────────────────── */
.sessions { display: grid; gap: 0.9rem; margin-bottom: 1.6rem; }
.session-card {
  border-radius: var(--a-radius); padding: 1.3rem 1.4rem;
  color: #f3ece0;
  background: radial-gradient(120% 120% at 80% 0%, #262625 0%, var(--a-graphite) 60%);
  box-shadow: var(--a-shadow);
}
.session-card .eyebrow { color: #c9a86a; }
.ss-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ss-title { font-family: var(--a-display); font-weight: 500; font-size: 1.45rem; margin: 0.5rem 0 0.2rem; line-height: 1.2; }
.ss-meta { color: #a99f8d; font-size: 0.85rem; }
.ss-time { font-variant-numeric: tabular-nums; color: #f3ece0; font-size: 0.95rem; white-space: nowrap; }
.ss-seek { width: 100%; margin: 1rem 0 0.9rem; accent-color: #c9a86a; }
.ss-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ss-btn {
  display: inline-flex; align-items: center; gap: 0.45em;
  background: none; border: 1px solid rgba(243, 236, 224, 0.3); color: #f3ece0;
  border-radius: var(--a-radius-sm); padding: 0.6em 0.95em; font-size: 0.86rem; font-weight: 600;
  transition: all 0.2s;
}
.ss-btn:hover { border-color: #c9a86a; color: #c9a86a; }
.ss-btn--gold { background: #c9a86a; border-color: #c9a86a; color: var(--a-graphite); }
.ss-btn--gold:hover { background: #d6b77c; color: var(--a-graphite); }
.ss-btn svg { width: 16px; height: 16px; }

/* ───────────────────────────── группы и ТВ ───────────────────────────── */
.group { margin-bottom: 1.8rem; }
.group-head { display: flex; align-items: baseline; gap: 0.8rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.group-head h2 { font-family: var(--a-display); font-weight: 500; font-size: 1.25rem; margin: 0; }
.group-head .count { color: var(--a-muted); font-size: 0.85rem; }

.tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.9rem; }

.tv-card {
  background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  padding: 0.95rem 1rem 0.9rem; box-shadow: var(--a-shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tv-card:hover { border-color: var(--a-line-strong); }
.tv-card.is-selected { border-color: var(--a-gold); box-shadow: 0 0 0 2px var(--a-gold); }
.tv-card.is-offline .tvc-what, .tv-card.is-offline .tvc-title b { color: var(--a-muted); }

.tvc-head { display: flex; align-items: center; gap: 0.6rem; }
.tvc-check { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -4px -2px -4px -4px; cursor: pointer; }
.tvc-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--a-gold); cursor: pointer; }
.tvc-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 0.5rem; }
.tvc-title b { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 0.7rem; padding: 0.2em 0.6em; border-radius: 100px; font-weight: 600; white-space: nowrap; background: var(--a-bg); color: var(--a-muted); border: 1px solid var(--a-line); }
.badge--gold { background: var(--a-gold-soft); color: #7a5f2c; border-color: #ecdcc0; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--a-line-strong); flex-shrink: 0; display: inline-block; }
.dot.ok { background: var(--a-ok); }
.dot.warn { background: var(--a-gold); }
.dot.bad { background: var(--a-danger); }

.tvc-state { display: flex; justify-content: space-between; gap: 0.8rem; margin: 0.75rem 0 0.45rem; font-size: 0.9rem; }
.tvc-what { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvc-what.is-error { color: var(--a-danger); white-space: normal; }
.tvc-time { color: var(--a-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 3px; background: var(--a-cream-deep); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--a-gold); }

/* Экран и строка, назначенные ТВ */
.tvc-extra { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.65rem; }
.tag {
  display: inline-flex; align-items: center; gap: 0.35em; max-width: 100%;
  font-size: 0.74rem; font-weight: 600; color: #7a5f2c;
  background: var(--a-gold-soft); border: 1px solid #ecdcc0; border-radius: 100px;
  padding: 0.2em 0.65em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tag svg { width: 13px; height: 13px; flex-shrink: 0; }

.tvc-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.75rem; }
.tvc-meta { color: var(--a-muted); font-size: 0.78rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvc-meta b { color: var(--a-gold); font-weight: 600; }
.tvc-actions { display: flex; gap: 0.35rem; }

.empty-state { text-align: center; color: var(--a-muted); padding: 3rem 1rem; background: var(--a-panel); border: 1px dashed var(--a-line-strong); border-radius: var(--a-radius); }
.empty-state h2 { font-family: var(--a-display); font-weight: 500; color: var(--a-ink); margin: 0 0 0.6rem; }
.empty-state p { max-width: 46ch; margin: 0 auto 1.2rem; }

/* ───────────────────────── панель выбора ───────────────────────── */
.selbar {
  position: fixed; left: 50%; bottom: calc(1rem + var(--safe-b)); transform: translateX(-50%);
  z-index: 40; width: min(1100px, calc(100% - 1.5rem));
  display: flex; align-items: center; gap: 0.8rem;
  background: var(--a-graphite); color: #f3ece0; border-radius: var(--a-radius);
  padding: 0.6rem 0.7rem 0.6rem 1.1rem; box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.6);
}
.sel-count { font-weight: 700; white-space: nowrap; font-size: 0.9rem; }
.sel-actions { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.sel-actions::-webkit-scrollbar { display: none; }
.sb-btn {
  display: inline-flex; align-items: center; gap: 0.4em; white-space: nowrap;
  background: none; border: 1px solid rgba(243, 236, 224, 0.22); color: #f3ece0;
  border-radius: var(--a-radius-sm); padding: 0.6em 0.85em; font-size: 0.85rem; font-weight: 600;
  transition: all 0.2s;
}
.sb-btn:hover { border-color: #c9a86a; color: #c9a86a; }
.sb-btn--gold { background: #c9a86a; border-color: #c9a86a; color: var(--a-graphite); }
.sb-btn--gold:hover { background: #d6b77c; color: var(--a-graphite); }
.sb-btn svg { width: 16px; height: 16px; }
@media (max-width: 640px) {
  .selbar { flex-wrap: wrap; padding: 0.7rem; }
  .sel-actions { width: 100%; margin-left: 0; }
}

/* ───────────────────────────── окна ───────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(31, 31, 31, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; visibility: hidden; transition: opacity 0.25s;
}
.modal-overlay.is-open { opacity: 1; visibility: visible; }
.modal {
  background: var(--a-bg); border-radius: var(--a-radius);
  width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; overflow: auto;
  padding: 1.5rem; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5);
}
.modal--wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.modal-head h3 { font-family: var(--a-display); font-weight: 500; margin: 0; font-size: 1.35rem; }
.modal-foot { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.4rem; flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
@media (max-width: 560px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: var(--a-radius) var(--a-radius) 0 0; max-height: 92dvh; padding-bottom: calc(1.5rem + var(--safe-b)); }
}

.a-hint { background: var(--a-gold-soft); border: 1px solid #ecdcc0; border-radius: var(--a-radius-sm); padding: 0.8rem 1rem; font-size: 0.86rem; color: #7a5f2c; margin-bottom: 1.2rem; }

/* Список видео в окне запуска */
.media-search { margin-bottom: 0.8rem; }
.media-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 46vh; overflow: auto; padding: 2px; }
.media-folder { font-size: 0.72rem; font-weight: 700; color: var(--a-muted); letter-spacing: 0.08em; text-transform: uppercase; margin: 0.6rem 0 0.1rem; }
.media-row {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--a-line); border-radius: var(--a-radius-sm);
  padding: 0.7rem 0.9rem; color: var(--a-ink); font-size: 0.92rem;
  transition: border-color 0.2s;
}
.media-row:hover { border-color: var(--a-gold); }
.media-row.is-selected { border-color: var(--a-gold); box-shadow: 0 0 0 2px var(--a-gold); background: #fffdf8; }
.media-row .mr-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-row .mr-sub { color: var(--a-muted); font-size: 0.78rem; white-space: nowrap; }

.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; border-top: 1px solid var(--a-line); }
.opt-row:first-of-type { border-top: none; }
.opt-row b { display: block; font-size: 0.92rem; }
.opt-row span { display: block; color: var(--a-muted); font-size: 0.8rem; line-height: 1.4; }

.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.toggle .track { position: absolute; inset: 0; background: var(--a-line-strong); border-radius: 100px; transition: background 0.2s; }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.toggle input:checked ~ .track { background: var(--a-gold); }
.toggle input:checked ~ .knob { transform: translateX(18px); }

.range-row { display: flex; align-items: center; gap: 0.8rem; }
.range-row input[type=range] { flex: 1; accent-color: var(--a-gold); }
.range-row .rv { min-width: 4.5em; text-align: right; color: var(--a-muted); font-variant-numeric: tabular-nums; font-size: 0.86rem; }

.info-list { display: grid; grid-template-columns: 130px 1fr; gap: 0.45rem 1rem; margin: 0 0 1.2rem; font-size: 0.88rem; }
.info-list dt { color: var(--a-muted); }
.info-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.section-title { font-family: var(--a-display); font-weight: 500; font-size: 1.1rem; margin: 1.4rem 0 0.7rem; }
.section-sub { font-size: 0.78rem; font-weight: 600; color: var(--a-muted); margin: 0.2rem 0 0.5rem; }

textarea.a-input { resize: vertical; min-height: 6.5em; line-height: 1.45; }
select.a-input { cursor: pointer; }

/* ─────────────────────── экраны, строки, картинки ─────────────────────── */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.9rem; margin-bottom: 2.2rem; }
.lib-grid--wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.lib-card {
  display: flex; flex-direction: column; gap: 0.85rem; width: 100%; text-align: left;
  background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  padding: 0.9rem; box-shadow: var(--a-shadow); color: var(--a-ink); font: inherit;
  transition: border-color 0.2s;
}
.lib-card:hover { border-color: var(--a-gold); }
.lc-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.lc-body b { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-body span { color: var(--a-muted); font-size: 0.8rem; line-height: 1.4; }
.lc-body .lc-use.is-on { color: var(--a-ok); font-weight: 600; }
/* На телефоне карточка экрана — строкой: схема слева, подписи справа */
@media (max-width: 560px) {
  .lib-card--row { flex-direction: row; align-items: center; gap: 0.9rem; padding: 0.75rem; }
  .lib-card--row .lp { width: 116px; flex-shrink: 0; }
}

/* Строки выбора экрана или бегущей строки: название и описание друг под другом */
.media-row--stack { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.media-row--stack .mr-title { width: 100%; }
.media-row--stack .mr-sub { white-space: normal; }

/* Схема шаблона: тёмный «экран» с зонами видео и меню */
.lp {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9;
  background: var(--a-graphite); border-radius: var(--a-radius-sm); overflow: hidden;
}
.lp-zone { position: absolute; display: flex; align-items: center; justify-content: center; }
.lp-main { color: rgba(243, 236, 224, 0.5); background: radial-gradient(120% 120% at 80% 0%, #33312e 0%, #1f1f1f 70%); }
.lp-side { color: #c9a86a; background: #2a2723; border-left: 1px solid rgba(201, 168, 106, 0.45); }
.lp-zone svg { width: 24%; max-width: 30px; min-width: 14px; height: auto; }

.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.pick {
  display: flex; flex-direction: column; gap: 0.4rem; text-align: left; min-width: 0;
  background: #fff; border: 1px solid var(--a-line); border-radius: var(--a-radius-sm);
  padding: 0.6rem; color: var(--a-ink); font: inherit; transition: border-color 0.2s;
}
.pick:hover { border-color: var(--a-gold); }
.pick.is-selected { border-color: var(--a-gold); box-shadow: 0 0 0 2px var(--a-gold); background: #fffdf8; }
.pick b { font-size: 0.86rem; }
.pick-sub { color: var(--a-muted); font-size: 0.75rem; line-height: 1.35; }
@media (max-width: 560px) { .pick-sub { display: none; } }

.seg { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; background: var(--a-cream-deep); border-radius: var(--a-radius-sm); padding: 0.25rem; }
.seg-btn {
  border: none; background: none; color: var(--a-ink); font-size: 0.86rem; font-weight: 600;
  padding: 0.5em 0.95em; border-radius: 5px; transition: background 0.2s, color 0.2s;
}
.seg-btn:hover { color: var(--a-gold); }
.seg-btn.is-active { background: #fff; color: var(--a-ink); box-shadow: 0 1px 3px rgba(31, 31, 31, 0.15); }
.kind-box { margin-top: 1rem; }
.opt-row .seg { flex-shrink: 0; }
@media (max-width: 560px) { .opt-row:has(.seg) { flex-direction: column; align-items: flex-start; } }

/* Слайды экрана: выбранные с номерами, остальные — чтобы добавить */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; margin-bottom: 0.8rem; }
.thumb {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--a-graphite); border: 1px solid var(--a-line); border-radius: var(--a-radius-sm);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb.is-on { border-color: var(--a-gold); box-shadow: 0 0 0 2px var(--a-gold); }
.thumb-n {
  position: absolute; left: 0.3rem; top: 0.3rem; min-width: 1.6em; height: 1.6em; padding: 0 0.35em;
  display: flex; align-items: center; justify-content: center;
  border-radius: 100px; background: var(--a-gold); color: #fff; font-size: 0.72rem; font-weight: 700;
}
.thumb--add {
  flex-direction: column; gap: 0.3rem; background: #fff; border: 1px dashed var(--a-line-strong);
  color: var(--a-muted); font-size: 0.78rem; font-weight: 600; transition: all 0.2s;
}
.thumb--add:hover { border-color: var(--a-gold); color: var(--a-gold); }
.thumb--add svg { width: 20px; height: 20px; }

.lib-section .group-head { align-items: center; }
.lib-upload { margin-left: auto; cursor: pointer; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
.img-item {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left;
  background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  box-shadow: var(--a-shadow); color: var(--a-ink); font: inherit; transition: border-color 0.2s;
}
.img-item:hover { border-color: var(--a-gold); }
.img-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--a-graphite); display: block; }
.img-name { padding: 0.5rem 0.7rem 0; font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-sub { padding: 0 0.7rem 0.55rem; font-size: 0.74rem; color: var(--a-muted); }
.img-preview { display: flex; justify-content: center; background: var(--a-graphite); border-radius: var(--a-radius-sm); margin-bottom: 0.8rem; overflow: hidden; }
.img-preview img { max-width: 100%; max-height: 50vh; display: block; }

/* ───────────────────────────── расписание ───────────────────────────── */
.sch-eyebrow { margin: 0.4rem 0 0.8rem; }
.timeline {
  max-width: 760px;
  background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  box-shadow: var(--a-shadow); padding: 0.3rem 1.1rem; margin-bottom: 2rem;
}
.tl-row { display: grid; grid-template-columns: 4rem 1fr auto; gap: 0.8rem; align-items: baseline; padding: 0.65rem 0; border-top: 1px solid var(--a-line); }
.tl-row:first-child { border-top: none; }
/* Время — прописными цифрами: «старинные» цифры Playfair в часах пляшут */
.tl-time { font-family: var(--a-display); font-size: 1.15rem; font-weight: 500; font-variant-numeric: lining-nums tabular-nums; }
.tl-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-st { font-size: 0.78rem; color: var(--a-muted); white-space: nowrap; }
.tl-row.is-done .tl-time, .tl-row.is-done .tl-name, .tl-row.is-skip .tl-time, .tl-row.is-skip .tl-name { color: var(--a-muted); }
.tl-row.is-done .tl-st { color: var(--a-ok); font-weight: 600; }
.tl-row.is-next .tl-time, .tl-row.is-next .tl-st { color: var(--a-gold); font-weight: 600; }
.tl-row.is-next .tl-name { font-weight: 700; }

.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0.9rem; }
@media (max-width: 400px) { .ev-grid { grid-template-columns: 1fr; } }
.ev-card {
  background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  box-shadow: var(--a-shadow); padding: 0.9rem 1rem; transition: border-color 0.2s, opacity 0.2s;
}
.ev-card:hover { border-color: var(--a-line-strong); }
.ev-card.is-off { opacity: 0.6; }
.ev-head { display: flex; align-items: center; gap: 0.8rem; }
.ev-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.9rem;
  background: none; border: none; padding: 0; text-align: left; color: inherit; font: inherit;
}
.ev-main:hover .ev-title b { color: var(--a-gold); }
.ev-time { font-family: var(--a-display); font-size: 1.9rem; font-weight: 500; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.ev-title { min-width: 0; display: flex; flex-direction: column; }
.ev-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.2s; }
.ev-title span { font-size: 0.8rem; color: var(--a-muted); }
.ev-body { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.ev-line { display: flex; align-items: flex-start; gap: 0.45rem; }
.ev-line svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 0.22em; color: var(--a-gold); }
.ev-next { font-size: 0.78rem; color: var(--a-muted); margin-top: 0.25rem; }
.ev-next.is-error { color: var(--a-danger); }

.day-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.day {
  width: 2.75rem; height: 2.4rem; border-radius: var(--a-radius-sm);
  border: 1px solid var(--a-line-strong); background: #fff; color: var(--a-ink);
  font-weight: 700; font-size: 0.85rem; transition: all 0.2s;
}
.day:hover { border-color: var(--a-gold); }
.day.is-on { background: var(--a-gold); border-color: var(--a-gold); color: #fff; }
.day-quick { display: flex; gap: 0.9rem; margin-left: 0.5rem; flex-wrap: wrap; }
.ev-time-input { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.kind-box .chips { margin-bottom: 0.8rem; }

/* Бегущая строка в миниатюре — как на ТВ: графит или золото */
.tp {
  display: block; overflow: hidden; white-space: nowrap;
  background: var(--a-graphite); color: #f3ece0;
  border-top: 1px solid rgba(201, 168, 106, 0.5); border-radius: 5px;
  font-size: 0.86rem; line-height: 2.3; padding: 0 0.8rem;
}
.tp--gold { background: #c9a86a; color: var(--a-graphite); border-color: #b9954f; }
.tp-track { display: inline-block; }
.tp-sep { color: #c9a86a; padding: 0 0.9em; }
.tp--gold .tp-sep { color: var(--a-graphite); opacity: 0.5; }
.tp-track.is-moving { animation: tpMove 20s linear infinite; }
@keyframes tpMove { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tp-track.is-moving { animation: none; } }
.tp-screen {
  position: relative; width: 100%; max-width: 420px; aspect-ratio: 16 / 9; margin: 0 auto 1.2rem;
  background: radial-gradient(120% 120% at 80% 0%, #33312e 0%, #1f1f1f 70%);
  border-radius: var(--a-radius-sm); overflow: hidden;
}
.tp-screen .tp { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0; padding: 0; }
.tp-screen.is-top .tp { top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid rgba(201, 168, 106, 0.5); }

/* ───────────────────────────── уведомления ───────────────────────────── */
.toast {
  position: fixed; right: 1.2rem; bottom: calc(1.2rem + var(--safe-b)); z-index: 200;
  background: var(--a-graphite); color: #fff; padding: 0.9rem 1.2rem;
  border-radius: var(--a-radius-sm); box-shadow: var(--a-shadow);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: all 0.3s var(--a-ease); font-size: 0.9rem; max-width: min(380px, calc(100% - 2.4rem));
}
.toast.is-show { opacity: 1; transform: none; }
.toast.is-error { background: var(--a-danger); }
.toast.is-ok { background: var(--a-ok); }
body.has-selbar .toast { bottom: calc(6rem + var(--safe-b)); }
