.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 12px;
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff; padding: 14px; border-radius: 8px;
  max-width: 95vw; width: 500px; max-height: 85vh;
  display: flex; flex-direction: column;
}
.modal h3 { margin: 0 0 8px; font-size: 14px; }
.modal .hint { font-size: 12px; color: #666; margin: 0 0 8px; }
.modal textarea {
  flex: 1; min-height: 200px; font-family: monospace;
  font-size: 12px; padding: 8px; border: 1px solid #ccc;
  border-radius: 4px; resize: none;
}
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.import-modal { overflow-y: auto; }
#importUrlError { overflow-wrap: anywhere; }
#importUrlFallback a { display: block; margin-bottom: 8px; }
#btnImportDownloaded { max-width: 100%; white-space: normal; }
.drive-modal { width: 540px; overflow-y: auto; }
.drive-file-link { display: block; overflow-wrap: anywhere; margin: 4px 0; }
.drive-file-link.hidden { display: none; }
.drive-status { font-weight: 600; margin: 6px 0; }
.drive-message { font-size: 13px; overflow-wrap: anywhere; margin: 0 0 10px; }
.drive-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.drive-actions .btn { white-space: normal; }
.drive-modal .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.drive-conflict { background: #fff3cd; padding: 10px; margin-top: 12px; border-radius: 5px; }
.drive-conflict p { margin: 0 0 8px; font-size: 13px; }
.drive-settings { margin-top: 14px; border-top: 1px solid #ddd; padding-top: 10px; }
.drive-settings summary { cursor: pointer; margin-bottom: 8px; }
.drive-settings label { display: block; font-size: 12px; margin: 8px 0 4px; }
.drive-settings input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.drive-settings .btn { margin-top: 10px; }
.drive-setup-steps { font-size: 12px; padding-left: 20px; overflow-wrap: anywhere; }
.drive-setup-steps li { margin-bottom: 5px; }
.account-modal { width: 480px; overflow-y: auto; }
.account-modal input { width: 100%; padding: 9px; border: 1px solid #ccc; border-radius: 4px; margin: 4px 0 8px; font-size: 16px; }
.account-modal label { display: block; font-size: 12px; }
.account-modal .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.account-email-hint { margin-top: 14px !important; }
.account-status { font-weight: 600; margin: 6px 0; }
.account-message { font-size: 13px; overflow-wrap: anywhere; margin: 0 0 12px; }
.account-email { overflow-wrap: anywhere; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-actions .btn { white-space: normal; }
.account-conflict { background: #fff3cd; padding: 10px; margin-top: 12px; border-radius: 5px; }
.account-conflict p { font-size: 13px; margin: 0 0 8px; }
.account-backup { margin-top: 16px; padding-top: 10px; border-top: 1px solid #ddd; }
.account-backup summary { cursor: pointer; margin-bottom: 8px; }
#accountCodeRow { margin-top: 12px; }

.movement-modal {
  width: 420px; max-height: 90vh; overflow-y: auto;
}
.movement-modal .movement-field-label {
  display: block; font-size: 12px; color: #555;
  margin: 8px 0 4px;
}
.movement-modal .movement-field-label:first-of-type { margin-top: 0; }
.movement-modal .movement-name-input {
  width: 100%; padding: 9px; border: 1px solid #ccc;
  border-radius: 4px; font-size: 16px;
}
.movement-modal .movement-notes-input {
  width: 100%; height: 64px; min-height: 64px; flex: none;
  padding: 8px; border: 1px solid #ccc; border-radius: 4px;
  font-family: inherit; font-size: 14px; line-height: 1.35;
  resize: vertical;
}
.movement-modal .error {
  color: #c0392b; font-size: 12px; min-height: 16px;
  margin-top: 6px;
}


.combo-video-modal {
  width: 720px; max-height: 92vh; overflow-y: auto;
}
.combo-video-player {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #111; border-radius: 6px; overflow: hidden;
  margin-bottom: 8px;
}
.combo-video-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0;
}
.combo-video-empty {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  color: #9aa5b1; font-size: 13px; text-align: center;
  padding: 16px;
}
.combo-video-player [hidden] { display: none !important; }
.combo-video-label {
  display: block; font-size: 12px; color: #555;
  margin: 8px 0 4px;
}
.combo-video-input {
  width: 100%; padding: 9px; border: 1px solid #ccc;
  border-radius: 4px; font-size: 14px;
}
.combo-video-list {
  display: flex; flex-direction: column; gap: 6px;
}
.combo-video-row {
  display: flex; gap: 6px; align-items: center;
  padding: 4px; border: 1px solid #e3e7ec; border-radius: 6px;
}
.combo-video-row.active { border-color: #3498db; background: #eef5fb; }
.combo-video-row-input {
  flex: 1; padding: 8px; border: 1px solid #ccc;
  border-radius: 4px; font-size: 14px; min-width: 0;
}
.combo-video-modal .error {
  color: #c0392b; font-size: 12px; min-height: 16px;
  margin-top: 6px;
}
.combo-video-modal .btn.danger { background: #c0392b; }
.combo-video-modal .btn.danger:active { background: #a93226; }
.combo-video-modal .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.combo-video-actions { flex-wrap: wrap; }

.node-videos-modal {
  width: 460px; max-height: 90vh; overflow-y: auto;
}
.node-videos-modal .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.node-videos-list {
  max-height: 170px; overflow-y: auto;
  margin-top: 8px;
}
.node-video-item {
  width: 100%; display: flex; flex-direction: column; gap: 1px;
  text-align: left; font-family: inherit; color: inherit;
  background: #f8f9fb; border: 1px solid #e3e7ec;
  border-radius: 6px; padding: 6px 9px; margin-bottom: 6px;
  cursor: pointer;
}
.node-video-item:hover { background: #eef5fb; border-color: #cfe0ee; }
.node-video-item.active {
  background: #eef5fb; border-color: #3498db;
  box-shadow: inset 3px 0 0 #3498db;
}
.node-video-item-head {
  font-size: 12px; font-weight: 600; color: #2c3e50;
}
.node-video-item-meta {
  font-size: 11px; color: #27ae60;
}
.node-video-item-seq {
  max-width: 100%; font-size: 11px; color: #7f8c8d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.movement-videos-modal {
  width: 520px; max-height: 90vh; overflow-y: auto;
}
.movement-videos-modal .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.movement-videos-list {
  max-height: 200px; overflow-y: auto;
  margin-top: 8px;
}
.movement-video-item {
  width: 100%; display: flex; flex-direction: column; gap: 2px;
  text-align: left; font-family: inherit; color: inherit;
  background: #f8f9fb; border: 1px solid #e3e7ec;
  border-radius: 6px; padding: 6px 9px; margin-bottom: 6px;
  cursor: pointer;
}
.movement-video-item:hover { background: #eef5fb; border-color: #cfe0ee; }
.movement-video-item.active {
  background: #eef5fb; border-color: #3498db;
  box-shadow: inset 3px 0 0 #3498db;
}
.movement-video-item-head {
  font-size: 12px; font-weight: 600; color: #2c3e50;
}
.movement-video-item-places {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
}
.movement-video-item-places-label {
  font-size: 11px; color: #7f8c8d;
}
.movement-video-place {
  font-size: 11px; color: #1e8449; background: #e8f6ee;
  border: 1px solid #bfe3cc; border-radius: 10px;
  padding: 1px 6px; white-space: nowrap;
}
.movement-video-item-seq {
  max-width: 100%; font-size: 11px; color: #7f8c8d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.media-modal {
  width: 720px; max-height: 92vh; overflow-y: auto;
}
.media-modal .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.import-modal {
  width: 420px; max-height: 90vh; overflow-y: auto;
}
.import-options {
  display: flex; flex-direction: column; gap: 8px;
}
.import-field-label {
  display: block; font-size: 12px; color: #555;
  margin: 8px 0 4px;
}
.import-url-input {
  width: 100%; padding: 9px; border: 1px solid #ccc;
  border-radius: 4px; font-size: 14px;
}
.import-modal .error {
  color: #c0392b; font-size: 12px; min-height: 16px; margin-top: 6px;
}

.combo-description-modal {
  width: 520px; max-height: 90vh; overflow-y: auto;
}
.mention-editor.multiline.combo-description-input {
  width: 100%; min-height: 120px; padding: 8px;
  border: 1px solid #ccc; border-radius: 4px;
  font-family: inherit; font-size: 14px; line-height: 1.4;
}
/* Окно выбора из библиотеки (замена движения, преп, смена родителя):
   список прокручивается внутри окна, само окно не выходит за экран. */
.library-picker-modal {
  width: 460px; max-height: 85vh; min-height: 0;
}
.library-picker-search {
  width: 100%; padding: 9px; border: 1px solid #ccc;
  border-radius: 4px; font-size: 15px; margin-bottom: 8px;
}
.library-picker-list {
  flex: 1 1 auto; min-height: 60px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid #eef1f4; border-radius: 6px; padding: 6px;
}
.library-picker-item {
  display: flex; align-items: center; gap: 8px;
  text-align: left; background: #fff;
  border: 1px solid #e3e7ec; border-radius: 5px;
  padding: 8px 10px; cursor: pointer; font-size: 13px;
}
.library-picker-item:hover { background: #f0f5fb; border-color: #cfe0ee; }
.library-picker-item.current { background: #fff8f0; border-color: #f0c9a0; }
.library-picker-none { color: #7f8c8d; font-style: italic; }
.library-picker-body {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.library-picker-name { overflow-wrap: anywhere; }
.library-picker-sub { font-size: 11px; color: #7f8c8d; }
.library-picker-current {
  flex-shrink: 0; font-size: 11px; color: #e67e22;
}
.library-picker-empty { font-size: 12px; color: #888; padding: 6px; }
.library-picker-new {
  margin-top: 8px; align-self: flex-start;
  max-width: 100%; overflow-wrap: anywhere; text-align: left;
}

/* Комбинации под одним видео (окна видео узла и движения) */
.video-combo-block {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: 4px; padding: 4px 0 0 8px;
  border-left: 2px solid #dfe8f1;
}
