/* ND MEDIA — общая основа кабинетов (рекламодателя и точки) и админки.
   Главный узнаваемый элемент — «экран»: рамка планшета с тем, что идёт в эфире.
   Остальное спокойное: один белый лист на бумажном фоне, разделение отступами и тонкими линиями.
   Тёмная тема — :root[data-theme="dark"] (переключатель в шапке). */
@import url('fonts/fonts.css');

:root {
  --paper: #f3f5fa;      /* фон страницы */
  --sheet: #ffffff;      /* рабочий лист */
  --field: #ffffff;      /* поля ввода */
  --ink: #0c1630;        /* основной текст */
  --ink-2: #3a4664;      /* второстепенный текст */
  --muted: #6a7593;      /* подписи */
  --line: rgba(12, 22, 48, .09);
  --line-2: rgba(12, 22, 48, .16);
  --signal: #3563ff;     /* действие, бренд */
  --signal-soft: #e8eeff;
  --air: #ff3d57;        /* «в эфире» — только для живого показа */
  --amber: #f2a516;      /* требует внимания */
  --amber-ink: #a86d00;
  --amber-soft: #fff4dc;
  --green: #12a87a;      /* на связи, одобрено */
  --green-soft: #e2f6ef;
  --danger: #d12a43;
  --red-soft: #ffe8eb;
  --display: 'Unbounded', 'Manrope', sans-serif;
  --font: 'Manrope', system-ui, sans-serif;
  /* имена, которых ждёт общий подвал legal-ui.js */
  --panel: var(--sheet); --accent: var(--signal); --text: var(--ink);
}
:root[data-theme="dark"] {
  --paper: #0a0f1f; --sheet: #121a2e; --field: #0e1527;
  --ink: #e8ecf7; --ink-2: #b8c2da; --muted: #8a95b0;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .16);
  --signal-soft: rgba(53, 99, 255, .2); --amber-ink: #f2b84a; --amber-soft: rgba(242, 165, 22, .16);
  --green-soft: rgba(18, 168, 122, .16); --danger: #ff6b7f; --red-soft: rgba(255, 61, 87, .16);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 500 15px/1.5 var(--font); font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--signal) 45%, transparent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 700; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--danger); margin: 8px 0 0; min-height: 18px; font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.scroll-x { overflow-x: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Шапка кабинета ---------- */
.top { display: flex; align-items: center; gap: 28px; max-width: 1280px; margin: 0 auto; padding: 18px 32px; }
.brand { display: flex; align-items: center; gap: 10px; font: 800 17px/1 var(--display); letter-spacing: .02em; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 10px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.nav a:hover { background: var(--sheet); text-decoration: none; }
.nav a[aria-current] { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.who { margin-left: auto; text-align: right; line-height: 1.25; }
.who b { display: block; font-size: 14px; }
.who span { font-size: 12px; color: var(--muted); }
.top-acts { display: flex; gap: 8px; align-items: center; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px;
  padding: 11px 18px; font-weight: 700; font-size: 14px; background: var(--signal); color: #fff; text-decoration: none;
}
.btn:hover { background: #2a55e6; text-decoration: none; }
.btn.ghost, .btn.sec { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost:hover, .btn.sec:hover { background: var(--paper); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.ok { background: var(--green); }
.btn.no, .btn.dng { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.no:hover, .btn.dng:hover { background: var(--red-soft); }
.btn.icon { padding: 9px 11px; }

/* ---------- Лист ---------- */
.sheet { max-width: 1280px; margin: 0 auto 48px; background: var(--sheet); border-radius: 24px; box-shadow: 0 1px 0 var(--line), 0 30px 60px -40px rgba(12, 22, 48, .25); }
.band { padding: 36px 40px; }
.band + .band { border-top: 1px solid var(--line); }
.cols { display: grid; gap: 40px; }
.cols > * { min-width: 0; }
.sec-title { font: 700 19px/1.3 var(--display); letter-spacing: -.01em; margin-bottom: 4px; }
.sec-sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.row-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 18px; }
.row-head .sec-sub { margin: 0; }
.row-head .end { margin-left: auto; }
.empty { color: var(--muted); margin: 0; }

/* ---------- Экран: фото настольной стойки, на её экране — ролик ----------
   stand.webp — фото устройства сети с прозрачным фоном; в области экрана на фото оставлен только
   полупрозрачный блик стекла. Ролик (.display) лежит под фото и проецируется на экран с перспективой
   скриптом nd-screen.js. Статус «в эфире» — над стойкой, вне экрана. */
.screen { width: 220px; flex: none; margin: 0; }
.bezel { position: relative; aspect-ratio: 565 / 745; }
.bezel::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: url(stand.webp) center / 100% 100% no-repeat; filter: drop-shadow(0 14px 14px rgba(12, 22, 48, .18)); }
:root[data-theme="dark"] .bezel::after { filter: drop-shadow(0 0 1px rgba(255, 255, 255, .25)); }
/* Экраны в сети вертикальные (9:16). Фиксированная ширина — текст заглушки чёткий при любом размере стойки. */
.display { position: absolute; left: 0; top: 0; width: 180px; aspect-ratio: 9 / 16; transform-origin: 0 0; overflow: hidden; container-type: inline-size; background: #0b1124; }
.display > img, .display > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.screen.off .display { filter: grayscale(1) brightness(.45); }
.cap { margin-top: 12px; line-height: 1.35; }
.cap b { display: block; font-size: 14px; }
.cap span { font-size: 13px; color: var(--muted); }
.cap .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; }
.air {
  position: absolute; top: 0; left: 0; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 7px; border-radius: 99px; background: rgba(12, 22, 48, .72); color: #fff;
  font-size: 11px; font-weight: 700; backdrop-filter: blur(4px);
}
.air::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--air); box-shadow: 0 0 0 3px rgba(255, 61, 87, .3); }
.air.idle::before { background: #9aa3b8; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) { .air:not(.idle)::before { animation: onair 2.4s ease-in-out infinite; } }
@keyframes onair { 50% { box-shadow: 0 0 0 6px rgba(255, 61, 87, 0); } }
.badge-own { position: absolute; top: 0; right: 0; z-index: 2; padding: 3px 8px; border-radius: 99px; background: var(--signal); color: #fff; font-size: 11px; font-weight: 800; }
/* Заглушка экрана: реклама сети или веб-страница — без картинки ролика */
.net { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 8cqw;
  background: radial-gradient(120% 90% at 90% 0%, rgba(143, 92, 245, .55), transparent 60%), linear-gradient(150deg, #10234f, #0c1630); color: #fff; }
.net b { font: 800 11cqw/1.1 var(--display); }
.net span { font-size: 7cqw; font-weight: 700; color: rgba(255, 255, 255, .75); margin-top: 2cqw; }

/* ---------- Таблицы ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .nw { white-space: nowrap; }
.tbl .acts { display: flex; gap: 8px; justify-content: flex-end; }
.tbl .acts .btn { white-space: nowrap; }
.thumb { position: relative; display: block; width: 38px; aspect-ratio: 9 / 16; border-radius: 6px; overflow: hidden; background: #0b1124; border: 0; padding: 0; }
.thumb > img, .thumb > video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .net { padding: 0; }
.thumb .net > * { display: none; }
.title-cell b, .title-cell .linkish { display: block; }
.linkish { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; text-align: left; cursor: pointer; }
.linkish:hover { color: var(--signal); }
.title-cell span { font-size: 13px; color: var(--muted); }
.place-cat { display: inline-block; padding: 2px 9px; border-radius: 99px; background: var(--paper); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

/* ---------- Состояния ---------- */
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.on { color: var(--green); }
.state.wait { color: var(--amber-ink); }
.state.bad { color: var(--danger); }
.state.off { color: var(--muted); }
.note-bad { display: block; font-size: 12.5px; color: var(--danger); margin-top: 3px; font-weight: 500; max-width: 46ch; }

/* Заряд: полоска + число */
.bat { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.bat i { position: relative; width: 34px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px var(--line-2); flex: none; }
.bat i::after { content: ''; position: absolute; left: 2px; top: 2px; bottom: 2px; width: calc((100% - 4px) * var(--v)); border-radius: 1.5px; background: var(--green); }
.bat.low i::after { background: var(--amber); }
.bat.crit i::after { background: var(--air); }
.bat.chg { color: var(--green); }

/* ---------- Поля ---------- */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .field input, .field select {
  border: 1px solid var(--line-2); border-radius: 11px; padding: 11px 13px; font: 500 15px var(--font); color: var(--ink); background: var(--field); width: 100%;
}
.input:focus, .field input:focus, .field select:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 20%, transparent); }
.drop {
  position: relative; display: grid; place-items: center; gap: 6px; text-align: center; padding: 24px 18px; cursor: pointer;
  border: 1.5px dashed var(--line-2); border-radius: 16px; background: var(--field); color: var(--ink-2); font-size: 14px;
}
.drop:hover, .drop:focus-within { border-color: var(--signal); }
.drop b { font-size: 15px; color: var(--ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .picked { font-weight: 700; color: var(--signal); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-2); background: var(--field); cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--signal-soft); box-shadow: inset 0 0 0 1.5px var(--signal); color: var(--signal); }
.chip:has(input:checked)::before { content: '✓'; font-weight: 800; }
.chip:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--signal) 45%, transparent); outline-offset: 2px; }

/* ---------- Модальное окно ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(8, 14, 32, .55); }
.modal { width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; background: var(--sheet); border-radius: 22px; padding: 26px; box-shadow: 0 40px 80px -30px rgba(8, 14, 32, .5); }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .sheet { border-radius: 18px; margin: 0 8px 32px; }
  .band { padding: 24px 18px; }
  .tbl .hide-m { display: none; }
  .row-head { flex-wrap: wrap; gap: 4px 16px; }
  .row-head .sec-sub { flex-basis: 100%; order: 3; }
  .tbl td.thumb-cell, .tbl th.thumb-cell, .tbl .pv-btn { display: none; }
}

/* Общий подвал с юридическими ссылками (legal-ui.js): на узком экране ссылки переносятся,
   иначе подвал раздвигал страницу шире экрана телефона. */
@media (max-width: 760px) {
  #legalFoot { margin-left: 8px !important; margin-right: 8px !important; overflow-wrap: anywhere; }
  #legalFoot a { white-space: normal !important; display: inline-block; }
}

/* ---------- Карточки вместо системных окон (nd-dialog.js) ---------- */
.overlay.nd-dialog { z-index: 90; align-items: center; }
.nd-dialog .modal { max-width: 500px; padding: 28px; }
.nd-card .sec-title { margin-bottom: 8px; }
.nd-text { margin: 0 0 6px; color: var(--ink-2); white-space: pre-line; }
.nd-fields { display: grid; gap: 14px; margin-top: 16px; }
.nd-row { display: flex; gap: 8px; align-items: stretch; }
.nd-row > input, .nd-row > textarea { flex: 1; min-width: 0; width: 100%; }
.field textarea, .nd-row textarea {
  border: 1px solid var(--line-2); border-radius: 11px; padding: 11px 13px; font: 500 15px/1.45 var(--font); color: var(--ink); background: var(--field); resize: vertical;
}
.field textarea:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 20%, transparent); }
.nd-mono { letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.nd-hint { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.nd-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.nd-err:empty { display: none; }
.btn.dng-solid { background: var(--danger); color: #fff; }
.btn.dng-solid:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.nd-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 95; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); }
.nd-toast { display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 18px; border-radius: 16px; background: var(--ink); color: #fff;
  font-size: 14px; line-height: 1.45; box-shadow: 0 20px 40px -18px rgba(12, 22, 48, .55); white-space: pre-line; border-left: 4px solid var(--green); }
:root[data-theme="dark"] .nd-toast { background: #1d2740; }
.nd-toast.bad { border-left-color: var(--air); }
.nd-toast span { flex: 1; }
.nd-toast button { border: 0; background: transparent; color: rgba(255, 255, 255, .6); padding: 0 2px; font-size: 14px; }
.nd-toast button:hover { color: #fff; }
.nd-toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@media (prefers-reduced-motion: no-preference) { .nd-toast { animation: ndIn .22s ease-out; } }
@keyframes ndIn { from { opacity: 0; transform: translateY(8px); } }
