/* Админка: цвета и шрифт из брендбука (красный #E41F1A, графит #333233, Ysabeau). */
@font-face { font-family: "Ysabeau"; src: url("/admin/fonts/Ysabeau-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Ysabeau"; src: url("/admin/fonts/Ysabeau-SemiBold.ttf") format("truetype"); font-weight: 600; }

:root {
  --red: #E41F1A; --red-dark: #b81713; --grey: #333233; --muted: #7a7779;
  --line: #e7e4e3; --soft: #f5f3f2; --bg: #faf9f8; --white: #fff;
  --ok: #2e7d32; --warn: #b26a00;
  --font: "Ysabeau", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--grey); font: 16px/1.45 var(--font); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 600; margin: 0; }
h2 { font-size: 20px; font-weight: 600; margin: 28px 0 12px; }
h3 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(228, 31, 26, .25); border-color: var(--red); }
textarea { resize: vertical; line-height: 1.5; }
label { display: block; font-size: 14px; color: var(--muted); }
label > input, label > select { margin-top: 4px; color: var(--grey); font-size: 16px; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 14px; }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }
.err { color: var(--red); font-size: 14px; }
.mt { margin-top: 14px; }
.grow { flex: 1; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-label { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
.span-3 { grid-column: 1 / -1; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--white); color: var(--grey); font: inherit; font-size: 15px; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: var(--grey); }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--white); font-weight: 600; }
.btn.primary:hover { background: var(--red-dark); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { color: var(--red); }
.btn.big { padding: 11px 22px; font-size: 16px; }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: default; pointer-events: none; }
.icon { border: 0; background: transparent; cursor: pointer; padding: 4px 7px; border-radius: 6px; color: var(--muted); font-size: 13px; }
.icon:hover { background: var(--soft); color: var(--grey); }
.icon.danger:hover { color: var(--red); }
.icon:disabled { opacity: .3; cursor: default; background: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--white); padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--grey); color: var(--white); }

/* каркас */
.layout { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--white); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-logo { width: 100%; max-width: 190px; margin: 0 6px 6px; }
.side-title { font-size: 13px; color: var(--muted); margin: 0 8px 18px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { padding: 9px 12px; border-radius: 8px; color: var(--grey); }
.side nav a:hover { background: var(--soft); text-decoration: none; }
.side nav a.on { background: var(--grey); color: var(--white); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.pub-status { font-size: 13px; color: var(--muted); padding: 0 4px; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch button { border: 1px solid var(--line); background: var(--white); border-radius: 6px; padding: 3px 10px; cursor: pointer; font: inherit; font-size: 13px; color: var(--muted); }
.lang-switch button.on { border-color: var(--grey); color: var(--grey); font-weight: 600; }
.main { flex: 1; padding: 24px 32px 80px; max-width: 1180px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.page-head h1 { flex: 1; min-width: 200px; }
.page-head.sticky { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.dirty { color: var(--warn); font-size: 14px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.boot { padding: 40px; color: var(--muted); }

/* вход */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login h2 { margin: 0; }
.login-logo { width: 220px; }

/* поля на языках */
.i18n { display: flex; flex-direction: column; gap: 6px; }
.i18n-row { display: flex; align-items: center; gap: 8px; color: var(--grey); }
.i18n-row input { margin: 0; }
.lang-chip { flex: none; width: 34px; text-align: center; font-size: 12px; font-weight: 600; padding: 3px 0; border-radius: 5px; background: var(--soft); color: var(--muted); }
.i18n-row.empty .lang-chip { background: #fff3e0; color: var(--warn); }
.para .tabs { display: flex; gap: 4px; margin-bottom: -1px; flex-wrap: wrap; }
.para .tabs button { border: 1px solid var(--line); border-bottom: 0; background: var(--soft); border-radius: 8px 8px 0 0; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; color: var(--muted); }
.para .tabs button.on { background: var(--white); color: var(--grey); font-weight: 600; }
.para .tabs button.empty::after { content: " •"; color: var(--warn); }
.para textarea { border-top-left-radius: 0; }

/* экспонаты */
.ex-list { display: flex; flex-direction: column; gap: 8px; }
.ex-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 0; }
.ex-item .order { display: flex; flex-direction: column; }
.ex-link { display: flex; align-items: center; gap: 14px; flex: 1; color: var(--grey); }
.ex-link:hover { text-decoration: none; }
.ex-link:hover .ex-title { color: var(--red); }
.ex-title { font-size: 17px; font-weight: 600; }
.thumb { width: 64px; height: 64px; border-radius: 8px; background: var(--soft); overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.cover { height: 210px; border: 1px dashed var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--soft); overflow: hidden; }
.cover img { max-width: 100%; max-height: 100%; object-fit: contain; }
.page-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-body { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.page-body.l-photo-top { grid-template-columns: 1fr; }
.page-body.l-text { grid-template-columns: 1fr; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.photo { position: relative; width: 136px; height: 136px; border-radius: 8px; background: var(--soft); overflow: hidden; border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: contain; }
.photo-tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: rgba(255,255,255,.9); }
.photo.add { border-style: dashed; cursor: pointer; font: inherit; font-size: 22px; color: var(--muted); }
.photo.add:hover { color: var(--red); border-color: var(--red); }

/* экраны */
.screens { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.screens .card { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.screen-head { display: flex; gap: 10px; align-items: center; }
.profile-badge { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--red); color: var(--white); font-weight: 600; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.pick-list { margin: 0; padding-left: 22px; }
.pick-list li { display: flex; align-items: center; gap: 4px; padding: 3px 0; border-bottom: 1px solid var(--soft); }
.pick-list li { display: list-item; }
.pick-list li > * { vertical-align: middle; }
.pick-list li .grow { display: inline-block; min-width: 60%; }

/* медиа */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; max-height: 60vh; overflow: auto; padding: 2px; }
.media-grid.big { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-height: none; }
.media-tile { position: relative; aspect-ratio: 1; border: 2px solid var(--line); border-radius: 8px; background: var(--soft); padding: 0; cursor: pointer; overflow: hidden; }
.media-tile img, .media-card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.media-tile.sel { border-color: var(--red); }
.media-tile .badge { position: absolute; top: 6px; right: 6px; background: var(--red); color: var(--white); border-radius: 12px; min-width: 24px; height: 24px; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.media-card { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.media-card a { display: block; aspect-ratio: 1; background: var(--soft); border-radius: 6px; overflow: hidden; margin-bottom: 6px; }

/* таблицы */
.table { width: 100%; border-collapse: separate; border-spacing: 0; padding: 0; overflow: hidden; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 400; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td select { width: auto; margin: 2px 4px 2px 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--ok); }
.dot.off { background: #c9c5c4; }
.warn-list { margin: 8px 0 0; padding-left: 20px; }
.warn-list li { margin: 3px 0; }

/* окна, уведомления */
.modal-bg { position: fixed; inset: 0; background: rgba(30, 28, 29, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--white); border-radius: 12px; padding: 22px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; }
.modal-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-foot .muted { margin-right: auto; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code { flex: 1; background: var(--soft); padding: 8px 10px; border-radius: 6px; word-break: break-all; }
.toasts { position: fixed; right: 20px; top: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--grey); color: var(--white); padding: 10px 16px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.15); max-width: 420px; }
.toast.err { background: var(--red); }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .side { width: auto; height: auto; position: static; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 16px; }
  .grid-2, .grid-3, .page-body { grid-template-columns: 1fr; }
}

/* ===== v4: точки, аудиогид, ТВ, устройства ===== */
.grid-4 { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1fr; gap: 12px; align-items: end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
select.auto { width: auto; }
.check { display: flex; align-items: center; gap: 10px; color: var(--grey); font-size: 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.point-card { margin: 0; display: flex; flex-direction: column; gap: 10px; color: inherit; }
.point-card:hover { text-decoration: none; border-color: var(--grey); }
.point-card:hover .ex-title { color: var(--red); }
.thumbs { display: flex; gap: 6px; min-height: 52px; }
.thumbs img { width: 52px; height: 52px; object-fit: contain; background: var(--soft); border-radius: 6px; }
.profile-badge.inline { display: inline-flex; width: 34px; height: 34px; font-size: 16px; vertical-align: middle; margin-right: 6px; }
.ex-num { font-weight: 600; color: var(--muted); width: 26px; text-align: center; }
.para .tabs button.long::after { content: " !"; color: var(--warn); font-weight: 600; }
.nav-badge { margin-left: 8px; background: var(--red); color: var(--white); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 600; }
.side nav a.on .nav-badge { background: var(--white); color: var(--red); }
.offline-banner { display: block; background: #fdecea; color: var(--red); border: 1px solid #f5c2bf; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-weight: 600; }
.offline-banner:hover { text-decoration: none; background: #fbe0dd; }
.dot.bad { background: var(--red); }
.type-chip { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--soft); white-space: nowrap; }
.type-chip.tv { background: #e8eef9; color: #2f4f8a; }
.code-label { max-width: 260px; }
.code-input { font-size: 26px !important; letter-spacing: .25em; font-weight: 600; text-align: center; }

/* аудиогид */
.audio-table td.track { white-space: nowrap; }
.audio-table td.track.empty { background: #fffaf2; }
.num-btn { border: 0; background: var(--grey); color: var(--white); font: inherit; font-weight: 600; font-size: 18px; min-width: 42px; height: 42px; border-radius: 10px; cursor: pointer; }
.num-btn:hover { background: var(--red); }
.play { border: 0; background: var(--red); color: var(--white); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 13px; vertical-align: middle; }
.play.on { background: var(--grey); }
.dur { display: inline-block; min-width: 38px; margin: 0 4px 0 6px; font-variant-numeric: tabular-nums; vertical-align: middle; }
.track .icon { vertical-align: middle; }
label.icon { display: inline-flex; color: var(--grey); font-size: 16px; }
.progress { position: relative; height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; min-width: 90px; }
.progress span { display: block; height: 100%; background: var(--red); transition: width .2s; }
.progress.big { height: 30px; margin: 10px 0; border-radius: 8px; }
.progress.big b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--grey); }

/* ТВ */
.vthumb { width: 160px; height: 90px; background: #000; border-radius: 6px; flex: none; }

@media (max-width: 900px) { .grid-4 { grid-template-columns: 1fr; } }

/* окно подтверждения (вместо confirm/prompt) */
.dialog-bg { z-index: 60; }
.dialog { max-width: 460px; }
.dialog-text { font-size: 17px; margin: 0 0 8px; white-space: pre-line; }
.dialog-input { font-size: 20px !important; margin: 6px 0 4px; }
.fatal { background: #fdecea; color: #8a1c14; border: 1px solid #f5c2bf; border-radius: 8px; padding: 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word; margin: 0 0 16px; cursor: pointer; }
/* Chrome < 88 не знает aspect-ratio: плитки фото не схлопываются в ноль */
.media-tile { min-height: 110px; }
.media-card a { min-height: 150px; }
