/* ============================================================
   Библиотека Кирилла — токены темы

   Палитра «архивная карточка»: тёплая бумага, чернильно-зелёный
   акцент (штамп/каталожная печать), латунный жёлтый для «избранного».
   Классика / Романс / Этюд получают устойчивый цвет-метку —
   как цветные ярлычки на корешках нотных папок.
   ============================================================ */

:root {
  --paper: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #edeeea;
  --ink: #1b1c19;
  --muted: #6a6c63;
  --muted-badge: var(--muted);
  /* Текст/иконки на цветных плашках произведений (карточка окрашена под
     состав) — своя переменная, потому что обычный приглушённый серый
     плохо читается поверх насыщенного цветного фона: в тёмной теме нужен
     белый, а в светлой — наоборот, тёмный (почти как основной текст), а
     не блёклый средне-серый var(--muted-badge). */
  --card-muted: var(--ink);
  --border: #e2e3dd;
  --accent: #33523c;
  --accent-ink: #1f3626;
  --accent-soft: #e2e9e1;
  --danger: #b23c30;
  --danger-soft: #fae4e0;
  --gold: #9c7318;
  --gold-soft: #f5ecd4;

  --group-genre: #7fa080;
  --group-geo: #c98f6e;
  --group-lang: #6f8fae;
  --group-category: #a97fc0;

  /* Составы — цвет карточки в исходном Keep кодировал тип состава */

  --shadow: 0 1px 2px rgba(20, 20, 18, 0.04), 0 4px 14px rgba(20, 20, 18, 0.05);
  --shadow-lift: 0 6px 16px rgba(20, 20, 18, 0.08), 0 18px 36px rgba(20, 20, 18, 0.09);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", monospace;

  --content-bg-overlay: rgba(255, 255, 255, 0.25);

  color-scheme: light;
}

/* Тёмная тема: системная (когда пользователь не выбрал явно) и по ручному переключателю */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131417;
    --surface: #1c1d21;
    --surface-2: #25262b;
    --ink: #edeef0;
    --muted: #93959d;
    --muted-badge: #c4c6cc;
    --card-muted: #ffffff;
    --border: #33343a;
    --accent: #7bb28c;
    --accent-ink: #a9d6b6;
    --accent-soft: #223028;
    --danger: #e2897c;
    --danger-soft: #33231f;
    --gold: #dcb56a;
    --gold-soft: #362e1c;
    --group-genre: #6f9a78;
    --group-geo: #b0855f;
    --group-lang: #6c93b8;
    --group-category: #a67fc4;
    --content-bg-overlay: rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131417;
  --surface: #1c1d21;
  --surface-2: #25262b;
  --ink: #edeef0;
  --muted: #93959d;
  --muted-badge: #c4c6cc;
  --card-muted: #ffffff;
  --border: #33343a;
  --accent: #7bb28c;
  --accent-ink: #a9d6b6;
  --accent-soft: #223028;
  --danger: #e2897c;
  --danger-soft: #33231f;
  --gold: #dcb56a;
  --gold-soft: #362e1c;
  --group-genre: #6f9a78;
  --group-geo: #b0855f;
  --group-lang: #6c93b8;
  --group-category: #a67fc4;
  --content-bg-overlay: rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100%; }

/* ---------- Шапка ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  cursor: pointer;
}
.brand-mark {
  display: flex;
  flex-shrink: 0;
}
.brand-mark img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.brand-name {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.32;
}
.brand-line {
  font-size: 13.5px;
  letter-spacing: 0.02em;
}

.search-wrap {
  flex: 0 1 320px;
  min-width: 160px;
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 10px 9px 14px;
  gap: 8px;
}
.search-wrap input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
.search-wrap input::placeholder { color: var(--muted); }
.search-icon { color: var(--muted); flex-shrink: 0; }

.search-clear-btn {
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.search-clear-btn:hover { background: var(--border); color: var(--ink); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.theme-toggle {
  display: flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  background: var(--surface);
  flex-shrink: 0;
}
.theme-toggle-btn {
  border: none;
  background: none;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
}
.theme-toggle-btn:hover { background: var(--surface-2); }
.theme-toggle-btn.active { background: var(--accent-soft); color: var(--accent-ink); }

.user-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
#user-info { color: var(--ink); font-weight: 500; }

#login-overlay.login-overlay { background: var(--paper); }
.login-bg-emblem {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: min(61vmin, 640px);
  max-width: none;
  opacity: 0.25;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.login-bg-emblem-left { right: calc(50% + 220px); }
.login-bg-emblem-right { left: calc(50% + 220px); }
.login-overlay .login-modal { position: relative; z-index: 1; width: min(360px, 100%); }
.login-modal form { display: flex; flex-direction: column; gap: 14px; }
.login-error { color: var(--danger); font-size: 13px; }

.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
  margin-top: 12px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.user-row-name { font-weight: 600; flex: 1; min-width: 0; }
.user-row select {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
}

/* ---------- Разметка ---------- */

.layout {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: 224px;
  flex-shrink: 0;
  padding: 22px 12px;
  position: sticky;
  top: var(--topbar-h, 82px);
  height: calc(100vh - var(--topbar-h, 82px));
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-block { margin-bottom: 24px; flex-shrink: 0; }

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding: 0 12px 8px;
}

.add-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.add-btn:hover { background: var(--accent-soft); }

.sections-dropdown { position: relative; flex-shrink: 0; }
.sections-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.sections-btn:hover { background: var(--surface-2); }
.sections-btn svg { flex-shrink: 0; color: var(--muted); }

.sections-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.filter:hover { background: var(--surface-2); }
.filter.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

.ensemble-filter-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.filter-icon { flex-shrink: 0; color: var(--muted); }
.filter.active .filter-icon { color: var(--accent-ink); }

.filter.clear-tags {
  color: var(--danger);
  font-size: 13px;
}
.filter.clear-tags:hover { background: var(--danger-soft); }

.chip-group-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 12px 4px;
}

.active-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
}
.active-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  cursor: pointer;
}
.active-tag-chip svg { flex-shrink: 0; opacity: 0.7; }
.active-tag-chip:hover svg { opacity: 1; }

.sidebar-tags-block {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
}
.tag-search-input {
  margin: 0 12px 8px;
  width: calc(100% - 24px);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  flex-shrink: 0;
}
.tag-search-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.tag-sort {
  display: flex;
  gap: 4px;
  margin: 0 12px 8px;
  flex-shrink: 0;
}
.tag-sort-btn {
  flex: 1;
  font: inherit;
  font-size: 11px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.tag-sort-btn:hover { background: var(--surface-2); }
.tag-sort-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.tag-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.tag-filter-btn {
  justify-content: space-between;
  padding: 4px 12px;
  font-size: 13px;
}
.tag-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}

.content {
  flex: 1;
  padding: 26px 28px 60px;
  min-width: 0;
  position: relative;
  /* Собственный градиентный фон вместо фото: тёплый золотистый отблеск и
     холодный акцентно-зелёный — в тон гербу и общей палитре, без картинки. */
  background:
    linear-gradient(var(--content-bg-overlay), var(--content-bg-overlay)),
    radial-gradient(circle at 88% 6%, color-mix(in srgb, var(--gold) 19%, transparent) 0%, transparent 42%),
    radial-gradient(circle at 6% 96%, color-mix(in srgb, var(--accent) 17%, transparent) 0%, transparent 48%),
    linear-gradient(165deg, var(--paper) 0%, var(--surface-2) 100%);
  border-radius: var(--radius-lg);
}

.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.content-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.section-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: none;
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.section-tab:hover { background: var(--surface-2); color: var(--ink); }
.section-tab.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}
.section-tab .filter-icon { flex-shrink: 0; color: var(--muted); }
.section-tab.active .filter-icon { color: var(--accent-ink); }
.section-tab .filter-label { display: flex; align-items: center; gap: 7px; }
.section-tab .tag-count { font-family: var(--font-mono); font-size: 11px; color: inherit; opacity: 0.75; }

.view-toggle {
  display: flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  background: var(--surface);
  flex-shrink: 0;
}
.view-toggle-btn {
  border: none;
  background: none;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
}
.view-toggle-btn:hover { background: var(--surface-2); }
.view-toggle-btn.active { background: var(--accent-soft); color: var(--accent-ink); }

.empty-state {
  text-align: center;
  color: var(--ink);
  padding: 70px 20px;
  font-size: 15px;
}

.load-more-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}
.load-more-wrap .load-more-buttons {
  display: flex;
  gap: 8px;
}
.result-count { font-size: 12.5px; }

/* ---------- Сетка / карточки ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.grid.list-view .card {
  flex-direction: row;
  align-items: center;
  padding: 10px 14px;
  gap: 16px;
}
.grid.list-view .card-head { flex: 1; min-width: 0; }
.grid.list-view .card-subtitle,
.grid.list-view .card-tags,
.grid.list-view .status-badge { display: none; }
.grid.list-view .card-footer { margin-top: 0; padding-top: 0; border-top: none; flex-shrink: 0; }

/* ---------- Заметки: папки и drag-and-drop ---------- */

#create-note-folder-btn.note-folder-create {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}
#create-note-folder-btn.note-folder-create:hover { background: var(--surface-2); color: var(--ink); }
.note-folder-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 14px;
}
.note-folder-back {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
}
.note-folder-back:hover { text-decoration: underline; }
.note-folder-name {
  color: var(--muted);
}
.note-folder-name::before { content: "/"; margin-right: 8px; color: var(--border); }

.folder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.folder-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
}
.folder-card-rename,
.folder-card-delete {
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
}
.folder-card-rename:hover { background: var(--border); color: var(--ink); }
.folder-card-delete:hover { background: var(--danger-soft); color: var(--danger); }
.folder-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.folder-card svg { color: var(--gold); flex-shrink: 0; }
.folder-card .folder-card-name { font-weight: 600; color: var(--ink); }
.folder-card .folder-card-count { font-size: 12px; color: var(--muted); }
.folder-card.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  border-style: dashed;
}

.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: 0.45; }

/* ---------- Концерты ---------- */

.concerts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
  flex-wrap: wrap;
}
.concerts-new-btn { margin: 0; }
.concerts-filter-toggle { display: flex; gap: 4px; }
.concerts-filter-btn {
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.concerts-filter-btn:hover { background: var(--surface-2); }
.concerts-filter-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.concerts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}
.concert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.concert-row-info { min-width: 0; flex: 1; cursor: pointer; border-radius: 6px; padding: 4px 6px; margin: -4px -6px; }
.concert-row-info:hover { background: var(--accent-soft); }
.concert-row-title { font-weight: 600; color: var(--ink); }
.concert-row-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.concert-row-downloads {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.concert-row-downloads button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 5px;
  background: none;
  padding: 1px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.concert-row-downloads button:hover { opacity: 1; transform: translateY(-1px); }
.concert-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.concerts-empty { color: var(--muted); font-size: 14px; padding: 20px 0; text-align: center; }

.concert-piece-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}
.concert-piece-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13px;
}
.concert-piece-row .concert-piece-num {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
  width: 18px;
  padding-top: 2px;
}
.concert-piece-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  border-radius: 6px;
  padding: 3px 6px;
  margin: -3px -6px;
}
.concert-piece-info:hover { background: var(--accent-soft); }
.concert-piece-row .concert-piece-title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.concert-piece-row .concert-piece-title .concert-piece-key { font-weight: 400; color: var(--muted); }
.concert-piece-row .concert-piece-subtitle { font-size: 12px; color: var(--muted); font-style: italic; }
.concert-piece-row .concert-piece-composer { font-size: 12px; color: var(--muted); }
.concert-piece-row .concert-piece-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1px; }
.concert-piece-row-actions { display: flex; gap: 2px; flex-shrink: 0; padding-top: 2px; }
.concert-piece-move,
.concert-piece-remove {
  border: none;
  background: none;
  color: var(--muted);
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
}
.concert-piece-move:hover { background: var(--border); color: var(--ink); }
.concert-piece-remove:hover { background: var(--danger-soft); color: var(--danger); }
.concert-piece-move:disabled { opacity: 0.3; cursor: not-allowed; }
.concert-piece-empty { color: var(--muted); font-size: 13px; padding: 8px 2px; }

.grid:not(.list-view) .card { min-height: 190px; }
.card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 16px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.card:active {
  transform: translateY(-1px) scale(0.983);
  transition: transform 0.08s ease;
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Эффект глянца — диагональный блик пробегает по карточке при наведении
   и мгновенно при нажатии (на случай тач-экрана, где hover не сработает). */
.card::after {
  content: "";
  position: absolute;
  top: -10%;
  left: -60%;
  width: 45%;
  height: 130%;
  background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
  transform: skewX(-20deg);
  pointer-events: none;
  /* opacity:0 в покое — из-за skewX прямоугольник даже при left:-60% может
     краем задевать угол карточки; прятать его только смещением недостаточно.
     transition:none здесь же — уход курсора мгновенно сбрасывает блик без
     обратной анимации, сама анимация задаётся только на :hover/:active. */
  opacity: 0;
  transition: none;
}
.card:hover::after { left: 130%; opacity: 1; transition: left 0.6s ease, opacity 0.1s ease; }
.card:active::after { left: 130%; opacity: 1; transition: left 0.25s ease, opacity 0.05s ease; }

/* Состав — лёгкий градиент цветом (или двумя) от правого края карточки;
   сам градиент собирается в JS инлайн-стилем, т.к. составы теперь
   произвольные (пользователь может завести свой, как новый тег). */

.ensemble-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  display: inline-block;
}
span.ensemble-dot {
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.ensemble-picker-wrap { position: relative; }
.ensemble-picker-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
}
.ensemble-picker-toggle:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#f-ensemble-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ensemble-picker-toggle svg { flex-shrink: 0; color: var(--muted); }

.ensemble-picker-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  max-height: 260px;
  display: flex;
  flex-direction: column;
}
.ensemble-picker-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ensemble-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink);
}
.ensemble-picker-row:hover { background: var(--surface-2); }
.ensemble-picker-row input[type="checkbox"] { flex-shrink: 0; }

.ensemble-picker-new {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 6px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.ensemble-picker-new input[type="text"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 8px;
}
.ensemble-picker-new input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
}
.ensemble-picker-new input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.ensemble-picker-new input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
.ensemble-picker-new input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }
.ensemble-picker-new .add-row-btn { flex-shrink: 0; white-space: nowrap; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-head-text { min-width: 0; }

.card-title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  line-height: 1.3;
  text-wrap: balance;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.card-key {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--card-muted);
}
.card-subtitle {
  font-size: 12.5px;
  font-style: italic;
  color: var(--card-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-composer {
  font-size: 13px;
  color: var(--card-muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.catalog-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--card-muted);
  white-space: nowrap;
}

.status-badge {
  align-self: flex-start;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 5px;
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 500;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 24px;
  overflow: hidden;
}
.tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted-badge);
  border: 1px solid var(--border);
}
/* На цветной плашке произведения фон тега уже не var(--surface-2), а
   полупрозрачная подложка поверх окрашенной карточки — обычный приглушённый
   цвет текста там плохо читается, нужен более светлый. */
.card-tags .tag { color: var(--card-muted); }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.attach-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--card-muted);
  white-space: nowrap;
}
.attach-badge svg { flex-shrink: 0; }
.attach-badge.attach-empty { color: var(--danger); opacity: 0.75; }

.card-star {
  border: none;
  background: none;
  padding: 4px;
  cursor: pointer;
  color: var(--card-muted);
  display: flex;
}
.card-star.active { color: var(--gold); }

.card-quick-actions {
  display: flex;
  gap: 2px;
}
.icon-btn {
  border: none;
  background: none;
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--card-muted);
  display: flex;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn:disabled:hover { background: none; }
.icon-btn-danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Модалка ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 14, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
/* Карточка произведения, открытая поверх окна концерта, должна быть выше */
#modal-overlay { z-index: 150; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: min(780px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 30px;
  box-shadow: var(--shadow-lift);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--surface-2);
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.modal-close:hover { color: var(--ink); }

.modal-body {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.modal-preview {
  flex: 1;
  min-width: 220px;
  /* Совпадает с шириной .preview-frame-wrap при max-height:440px и
     соотношении А4 (210:297) — иначе список файлов под превью оказывался
     шире самой страницы. */
  max-width: 312px;
}
.preview-placeholder {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  aspect-ratio: 210 / 297;
  max-height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  padding: 12px;
}
.preview-caption { font-size: 13px; line-height: 1.6; }
.muted { color: var(--muted); font-size: 12px; }

.preview-add-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-top: 4px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  cursor: pointer;
  overflow: hidden;
}
.preview-add-btn:hover { opacity: 0.88; }

.file-input-visually-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.preview-frame-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 210 / 297;
  max-height: 440px;
  cursor: zoom-in;
  position: relative;
}
.preview-frame-wrap img,
.preview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  object-fit: contain;
  background: var(--surface-2);
  pointer-events: none;
}
.note-text-display,
.note-text-input {
  width: 100%;
  height: 100%;
  padding: 18px;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-y: auto;
}
.note-text-input {
  border: none;
  resize: none;
  outline: none;
}
.note-text-display:empty::before,
.note-text-display .muted { color: var(--muted); }

.preview-frame-wrap::after {
  content: "Нажмите, чтобы увеличить";
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--surface);
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 9px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  white-space: nowrap;
}
.preview-frame-wrap:hover::after { opacity: 1; }
.preview-frame-wrap.is-note-text { cursor: text; }
.preview-frame-wrap.is-note-text::after { display: none; }

.preview-add-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  border: none;
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 10px;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
}
.preview-add-overlay:hover { background: rgba(0, 0, 0, 0.55); }

.note-attach-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.note-attach-row:hover { background: var(--surface-2); color: var(--ink); border-color: var(--accent); }

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.attachment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--ink);
  background: var(--surface);
}
.attachment-row.is-primary { border-color: var(--accent); background: var(--accent-soft); }
#upload-progress { margin-top: 8px; }
.attachment-icon { color: var(--muted); display: flex; flex-shrink: 0; }
.attachment-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-open {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}
.attachment-open:hover { background: var(--accent-soft); }
.attachment-open:hover .attachment-label { color: var(--accent-ink); text-decoration: underline; }
.attachment-open .attachment-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-label-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 7px;
}
.attachment-label-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.attachment-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.attachment-primary-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.attachment-primary-btn:hover { background: var(--surface-2); }
.attachment-primary-label {
  font-size: 11px;
  color: var(--accent-ink);
  font-weight: 600;
  white-space: nowrap;
}

.attachment-remove-btn {
  border: none;
  background: none;
  color: var(--muted);
  padding: 3px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
}
.attachment-remove-btn:hover { background: var(--danger-soft); color: var(--danger); }


.modal-info {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-right: 34px;
}
.modal-title-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}
.modal-key {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
}
.modal-subtitle {
  font-size: 13.5px;
  font-style: italic;
  color: var(--muted);
  margin-top: 2px;
}

.modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.modal-badges .catalog-badge {
  padding: 4px 9px;
  border-radius: 5px;
  color: var(--muted-badge);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.ensemble-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.review-badge {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 5px;
  font-weight: 500;
}
.review-badge.draft { background: var(--surface-2); color: var(--muted-badge); border: 1px dashed var(--border); }
.review-badge.pending { background: var(--accent); color: var(--surface); }
.review-badge.trashed { background: var(--danger-soft); color: var(--danger); }

.modal-meta {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 6px;
  font-size: 13.5px;
}
.modal-meta dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 1px;
}
.modal-meta dd {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
}

.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }

/* ---------- Форма создания/редактирования ---------- */

#edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field-row {
  display: flex;
  gap: 12px;
}
.field-row .field { flex: 1; min-width: 0; }
.field-row .field-key { flex: 0 0 110px; }
.field-row .field-date { flex: 0 0 160px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.field input,
.field select,
.field-block select {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.field input:focus,
.field select:focus,
.field-block select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-block-label {
  font-size: 12px;
  color: var(--muted);
}
.field-block-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cf-import-label {
  position: relative;
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.cf-import-label:hover { background: var(--accent); color: var(--surface); }

.concert-piece-search input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.concert-piece-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.tag-autocomplete-wrap { position: relative; }
.tag-autocomplete {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  max-height: 220px;
  overflow-y: auto;
}
.tag-autocomplete-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.tag-autocomplete-item:hover,
.tag-autocomplete-item.active { background: var(--accent-soft); color: var(--accent-ink); }

.repeat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.repeat-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.repeat-row select,
.repeat-row input {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
}
.repeat-row select { flex: 0 0 128px; }
.repeat-row input { flex: 1; min-width: 0; }
.repeat-row select:focus,
.repeat-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.remove-row-btn {
  border: none;
  background: none;
  color: var(--muted);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
}
.remove-row-btn:hover { background: var(--danger-soft); color: var(--danger); }

.add-row-btn {
  align-self: flex-start;
  border: 1px dashed var(--border);
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.add-row-btn:hover { background: var(--accent-soft); }

@media (max-width: 480px) {
  .repeat-row { flex-wrap: wrap; }
  .repeat-row select { flex: 1 1 100%; }
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.modal-actions-primary {
  flex-wrap: nowrap;
  gap: 6px;
}
.modal-actions-primary .action-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 4px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.action-btn {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.action-btn:hover { background: var(--surface-2); }
.action-btn.edit { color: var(--accent-ink); border-color: var(--accent); }
.action-btn.edit:hover { background: var(--accent-soft); }
.action-btn.danger { color: var(--danger); border-color: var(--danger); }
.action-btn.danger:hover { background: var(--danger-soft); }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.action-btn.icon-only {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-actions-secondary {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.modal-hint {
  font-size: 12.5px;
  color: var(--muted);
  min-height: 16px;
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .topbar { gap: 10px; padding: 12px 16px; }
  .content { padding: 20px 16px 48px; }
  .field-row { flex-direction: column; gap: 12px; }
  .field-row .field-key,
  .field-row .field-role,
  .field-row .field-date { flex-basis: auto; }
}

/* ---------- Диалог выбора файла(ов) ---------- */

.picker-modal { width: min(420px, 100%); }
.picker-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-right: 20px;
}
.picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  max-height: 320px;
  overflow-y: auto;
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
}
.picker-row:hover { background: var(--surface-2); }
.picker-row input { flex-shrink: 0; }
.picker-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Всплывающее уведомление (тост) ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  max-width: min(420px, calc(100vw - 32px));
  background: var(--ink);
  color: var(--paper);
  font-size: 13.5px;
  line-height: 1.4;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.toast-action-btn {
  flex: none;
  background: var(--paper);
  color: var(--ink);
  border: none;
  border-radius: var(--radius-sm, 6px);
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.toast-action-btn:hover {
  opacity: 0.85;
}

/* ---------- Крупный просмотр вложения (приблизить/отдалить/потянуть) ---------- */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 8, 0.88);
  z-index: 200;
  display: flex;
  flex-direction: column;
}
.lightbox-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
}
.lightbox-toolbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.lightbox-toolbar button:hover { background: rgba(255, 255, 255, 0.18); }
#lightbox-close { margin-left: 12px; }
#lightbox-zoom-level { color: #fff; font-size: 13px; min-width: 44px; text-align: center; }

.lightbox-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
#lightbox-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lightbox-content iframe {
  width: 90%;
  height: 100%;
  border: none;
  background: #fff;
  border-radius: var(--radius-sm);
}
#lightbox-content img {
  max-width: 90%;
  max-height: 100%;
  object-fit: contain;
  cursor: grab;
  user-select: none;
  transition: transform 0.05s linear;
}
#lightbox-content img.is-dragging { cursor: grabbing; transition: none; }
